Fix Coverity 'Uninitialized pointer fields' - member variables are now initialized

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13887 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-11-14 22:17:28 +00:00
commit fd24b188e2
8 changed files with 104 additions and 54 deletions

View file

@ -156,7 +156,9 @@ public:
dmethods_seq(NULL),
dmethods_table(NULL),
n_dmethods(0),
n_directors(0) {
n_directors(0),
first_class_dmethod(0),
curr_class_dmethod(0) {
/* for now, multiple inheritance in directors is disabled, this
should be easy to implement though */
director_multiple_inheritance = 0;

View file

@ -25,7 +25,6 @@ class D : public Language {
const String *empty_string;
const String *public_string;
const String *protected_string;
const String *static_string;
/*
* Files and file sections containing C/C++ code.
@ -274,7 +273,9 @@ public:
dmethods_seq(NULL),
dmethods_table(NULL),
n_dmethods(0),
unknown_types(NULL) {
unknown_types(NULL),
first_class_dmethod(0),
curr_class_dmethod(0) {
// For now, multiple inheritance with directors is not possible. It should be
// easy to implement though.

View file

@ -132,6 +132,7 @@ public:
variable_name(NULL),
proxy_class_constants_code(NULL),
module_class_constants_code(NULL),
enum_code(NULL),
package(NULL),
jnipackage(NULL),
package_path(NULL),
@ -151,7 +152,9 @@ public:
dmethods_seq(NULL),
dmethods_table(NULL),
n_dmethods(0),
n_directors(0) {
n_directors(0),
first_class_dmethod(0),
curr_class_dmethod(0) {
/* for now, multiple inheritance in directors is disabled, this
should be easy to implement though */
director_multiple_inheritance = 0;

View file

@ -145,17 +145,29 @@ public:
* Initialize member data
* --------------------------------------------------------------------- */
LUA() {
f_begin = 0;
f_runtime = 0;
f_header = 0;
f_wrappers = 0;
f_init = 0;
f_initbeforefunc = 0;
PrefixPlusUnderscore = 0;
s_cmd_tab = s_var_tab = s_const_tab = s_luacode = 0;
current=NO_CPP;
LUA() :
f_begin(0),
f_runtime(0),
f_header(0),
f_wrappers(0),
f_init(0),
f_initbeforefunc(0),
PrefixPlusUnderscore(0),
s_cmd_tab(0),
s_var_tab(0),
s_const_tab(0),
s_methods_tab(0),
s_attr_tab(0),
s_luacode(0),
s_dot_get(0),
s_dot_set(0),
s_vars_meta_tab(0),
have_constructor(0),
have_destructor(0),
destructor_action(0),
class_name(0),
constructor_name(0),
current(NO_CPP) {
}
/* NEW LANGUAGE NOTE:***********************************************

View file

@ -58,9 +58,24 @@ private:
}
public:
OCTAVE():f_begin(0), f_runtime(0), f_header(0), f_doc(0), f_wrappers(0),
f_init(0), f_initbeforefunc(0), f_directors(0), f_directors_h(0),
s_global_tab(0), s_members_tab(0), class_name(0) {
OCTAVE():
f_begin(0),
f_runtime(0),
f_header(0),
f_doc(0),
f_wrappers(0),
f_init(0),
f_initbeforefunc(0),
f_directors(0),
f_directors_h(0),
s_global_tab(0),
s_members_tab(0),
class_name(0),
have_constructor(0),
have_destructor(0),
constructor_name(0),
docs(0)
{
/* Add code to manage protected constructors and directors */
director_prot_ctor_code = NewString("");
Printv(director_prot_ctor_code,

View file

@ -810,33 +810,37 @@ public:
*
* Initialize member data
* --------------------------------------------------------------------- */
RUBY() {
module = 0;
modvar = 0;
feature = 0;
prefix = 0;
last_autodoc = NewString("");
current = NO_CPP;
classes = 0;
klass = 0;
special_methods = 0;
f_begin = 0;
f_runtime = 0;
f_header = 0;
f_wrappers = 0;
f_init = 0;
f_initbeforefunc = 0;
useGlobalModule = false;
multipleInheritance = false;
director_prot_ctor_code = NewString("");
Printv(director_prot_ctor_code,
"if ( $comparison ) { /* subclassed */\n",
" $director_new \n",
"} else {\n", " rb_raise(rb_eRuntimeError,\"accessing abstract class or protected constructor\"); \n", " return Qnil;\n", "}\n", NIL);
director_multiple_inheritance = 0;
director_language = 1;
}
RUBY() :
module(0),
modvar(0),
feature(0),
prefix(0),
current(0),
classes(0),
klass(0),
special_methods(0),
f_directors(0),
f_directors_h(0),
f_directors_helpers(0),
f_begin(0),
f_runtime(0),
f_runtime_h(0),
f_header(0),
f_wrappers(0),
f_init(0),
f_initbeforefunc(0),
useGlobalModule(false),
multipleInheritance(false) {
last_autodoc = NewString("");
current = NO_CPP;
director_prot_ctor_code = NewString("");
Printv(director_prot_ctor_code,
"if ( $comparison ) { /* subclassed */\n",
" $director_new \n",
"} else {\n", " rb_raise(rb_eRuntimeError,\"accessing abstract class or protected constructor\"); \n", " return Qnil;\n", "}\n", NIL);
director_multiple_inheritance = 0;
director_language = 1;
}
/* ---------------------------------------------------------------------
* main()

View file

@ -24,9 +24,21 @@ S-Exp Options (available with -sexp)\n\
static File *out = 0;
class Sexp:public Language {
public:
int indent_level;
Sexp():indent_level(0) {
DOHHash *print_circle_hash;
int print_circle_count;
int hanging_parens;
bool need_whitespace;
bool need_newline;
public:
Sexp():
indent_level(0),
print_circle_hash(0),
print_circle_count(0),
hanging_parens(0),
need_whitespace(0),
need_newline(0) {
}
virtual ~ Sexp() {
@ -51,12 +63,6 @@ public:
}
}
DOHHash *print_circle_hash;
int print_circle_count;
int hanging_parens;
bool need_whitespace;
bool need_newline;
/* Top of the parse tree */
virtual int top(Node *n) {
if (out == 0) {

View file

@ -40,7 +40,14 @@ class TypePass:private Dispatcher {
Hash *classhash;
List *normalize;
TypePass() {
TypePass() :
inclass(0),
module(0),
importmode(0),
nsname(0),
nssymname(0),
classhash(0),
normalize(0) {
}
/* Normalize a type. Replaces type with fully qualified version */