Fix previous commit

Revert changes inadvertently included, and fix `=` to `==`.
This commit is contained in:
Olly Betts 2022-03-20 19:44:23 +13:00
commit b2c58115d7
20 changed files with 38 additions and 39 deletions

View file

@ -1730,7 +1730,7 @@ program : interface {
Setattr($1,"classes",classes);
Setattr($1,"name",ModuleName);
if (!module_node && ModuleName) {
if ((!module_node) && ModuleName) {
module_node = new_node("module");
Setattr(module_node,"name",ModuleName);
}

View file

@ -810,7 +810,7 @@ static Node *template_locate(String *name, Parm *tparms, Symtab *tscope) {
success:
Delete(tname);
Delete(possiblepartials);
if (template_debug && n) {
if ((template_debug) && (n)) {
/*
Printf(stdout, "Node: %p\n", n);
Swig_print_node(n);
@ -868,7 +868,7 @@ Node *Swig_cparse_template_locate(String *name, Parm *tparms, Symtab *tscope) {
Swig_error(cparse_file, cparse_line, "Template '%s' undefined.\n", name);
}
if (template_debug && n) {
if ((template_debug) && (n)) {
Printf(stdout, "Templated function found: %p\n", n);
Swig_print_node(n);
}

View file

@ -450,7 +450,7 @@ int DohPrintv(DOHFile * f, ...) {
va_start(ap, f);
while (1) {
obj = va_arg(ap, void *);
if (!obj || obj == DohNone)
if ((!obj) || (obj == DohNone))
break;
if (DohCheck(obj)) {
ret += DohDump(obj, f);
@ -475,7 +475,7 @@ int DohCopyto(DOH *in, DOH *out) {
char *cw;
char buffer[16384];
if (!in || !out)
if ((!in) || (!out))
return 0;
while (1) {
ret = Read(in, buffer, 16384);

View file

@ -653,7 +653,7 @@ int Language::includeDirective(Node *n) {
int Language::insertDirective(Node *n) {
/* %insert directive */
if (!ImportMode || Getattr(n, "generated")) {
if ((!ImportMode) || Getattr(n, "generated")) {
String *code = Getattr(n, "code");
String *section = Getattr(n, "section");
File *f = 0;
@ -2703,7 +2703,7 @@ int Language::constructorDeclaration(Node *n) {
over = Swig_symbol_isoverloaded(n);
if (over)
over = first_nontemplate(over);
if (over && !overloading) {
if ((over) && (!overloading)) {
/* If the symbol is overloaded. We check to see if it is a copy constructor. If so,
we invoke copyconstructorHandler() as a special case. */
if (Getattr(n, "copy_constructor") && (!Getattr(CurrentClass, "has_copy_constructor"))) {
@ -3332,7 +3332,7 @@ Node *Language::classLookup(const SwigType *s) {
break;
nstab = Getattr(n, "sym:symtab");
n = 0;
if (!nstab || nstab == stab) {
if ((!nstab) || (nstab == stab)) {
break;
}
stab = nstab;
@ -3420,7 +3420,7 @@ Node *Language::enumLookup(SwigType *s) {
break;
nstab = Getattr(n, "sym:symtab");
n = 0;
if (!nstab || nstab == stab) {
if ((!nstab) || (nstab == stab)) {
break;
}
stab = nstab;

View file

@ -1422,7 +1422,7 @@ public:
b = First(baselist);
while (b.item) {
String *bname = Getattr(b.item, "name");
if (!bname || GetFlag(b.item, "feature:ignore") || !Getattr(b.item, "module")) {
if ((!bname) || GetFlag(b.item, "feature:ignore") || (!Getattr(b.item, "module"))) {
b = Next(b);
continue;
}
@ -1972,7 +1972,7 @@ public:
// For the sake of compiling with -Wall -Werror we print constants
// only when necessary
int need_constants = 0;
if ((elua_ltr || eluac_ltr) && old_metatable_bindings)
if ( (elua_ltr || eluac_ltr) && (old_metatable_bindings) )
need_constants = 1;
else if (!is_instance) // static part need constants tab
need_constants = 1;

View file

@ -1007,7 +1007,7 @@ public:
b = First(baselist);
while (b.item) {
String *bname = Getattr(b.item, "name");
if (!bname || GetFlag(b.item, "feature:ignore") || !Getattr(b.item, "module")) {
if ((!bname) || GetFlag(b.item, "feature:ignore") || (!Getattr(b.item, "module"))) {
b = Next(b);
continue;
}

View file

@ -158,12 +158,12 @@ List *Swig_overload_rank(Node *n, bool script_lang_wrapping) {
}
String *t1 = Getattr(p1, "tmap:typecheck:precedence");
String *t2 = Getattr(p2, "tmap:typecheck:precedence");
if (!t1 && !nodes[i].error) {
if ((!t1) && (!nodes[i].error)) {
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[i].n), Getline(nodes[i].n),
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
Swig_name_decl(nodes[i].n), SwigType_str(Getattr(p1, "type"), 0));
nodes[i].error = 1;
} else if (!t2 && !nodes[j].error) {
} else if ((!t2) && (!nodes[j].error)) {
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[j].n), Getline(nodes[j].n),
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
Swig_name_decl(nodes[j].n), SwigType_str(Getattr(p2, "type"), 0));

View file

@ -935,7 +935,7 @@ public:
* Create a stub for this function, provided it's not a member function
* -------------------------------------------------------------------- */
if (blessed && !member_func) {
if ((blessed) && (!member_func)) {
Printv(func_stubs, "*", iname, " = *", cmodule, "::", iname, ";\n", NIL);
}
@ -1257,7 +1257,7 @@ public:
if (verbose > 0) {
fprintf(stdout, "setclassname: Found actualpackage: %s\n", Char(actualpackage));
}
if (!compat && !Strchr(symname,':')) {
if ((!compat) && (!Strchr(symname,':'))) {
fullname = NewStringf("%s::%s",actualpackage,symname);
} else {
fullname = NewString(symname);
@ -1896,7 +1896,7 @@ public:
String *code = Getattr(n, "code");
String *section = Getattr(n, "section");
if (!ImportMode && Cmp(section, "perl") == 0) {
if ((!ImportMode) && (Cmp(section, "perl") == 0)) {
Printv(additional_perl_code, code, NIL);
} else {
Language::insertDirective(n);

View file

@ -3474,7 +3474,7 @@ public:
if (builtin)
Printf(f_init, "\t SwigPyBuiltin_AddPublicSymbol(public_interface, \"%s\");\n", global_name);
have_globals = 1;
if (!builtin && shadow && (!(shadow & PYSHADOW_MEMBER))) {
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER))) {
Printf(f_shadow_stubs, "%s = %s.%s\n", global_name, module, global_name);
}
}
@ -3632,7 +3632,7 @@ public:
if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) {
Replaceall(tm, "$value", value);
if (needs_swigconstant(n) && !builtin && shadow && !(shadow & PYSHADOW_MEMBER) && (!in_class || !Getattr(n, "feature:python:callback"))) {
if (needs_swigconstant(n) && !builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER)) && (!in_class || !Getattr(n, "feature:python:callback"))) {
// Generate `*_swigconstant()` method which registers the new constant.
//
// *_swigconstant methods are required for constants of class type.
@ -3670,7 +3670,7 @@ public:
return SWIG_NOWRAP;
}
if (!builtin && shadow && !(shadow & PYSHADOW_MEMBER)) {
if (!builtin && (shadow) && (!(shadow & PYSHADOW_MEMBER))) {
String *f_s;
if (!in_class) {
f_s = f_shadow;

View file

@ -1362,7 +1362,7 @@ List * R::Swig_overload_rank(Node *n,
Parm *p2 = nodes[j].parms;
int differ = 0;
int num_checked = 0;
while (p1 && p2 && num_checked < nodes[i].argc) {
while (p1 && p2 && (num_checked < nodes[i].argc)) {
if (debugMode) {
Printf(stdout,"p1 = '%s', p2 = '%s'\n", Getattr(p1,"type"), Getattr(p2,"type"));
}
@ -1379,12 +1379,12 @@ List * R::Swig_overload_rank(Node *n,
if (debugMode) {
Printf(stdout,"t1 = '%s', t2 = '%s'\n", t1, t2);
}
if (!t1 && !nodes[i].error) {
if ((!t1) && (!nodes[i].error)) {
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[i].n), Getline(nodes[i].n),
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
Swig_name_decl(nodes[i].n), SwigType_str(Getattr(p1, "type"), 0));
nodes[i].error = 1;
} else if (!t2 && !nodes[j].error) {
} else if ((!t2) && (!nodes[j].error)) {
Swig_warning(WARN_TYPEMAP_TYPECHECK, Getfile(nodes[j].n), Getline(nodes[j].n),
"Overloaded method %s not supported (incomplete type checking rule - no precedence level in typecheck typemap for '%s').\n",
Swig_name_decl(nodes[j].n), SwigType_str(Getattr(p2, "type"), 0));

View file

@ -807,7 +807,7 @@ public:
b = First(baselist);
while (b.item) {
String *bname = Getattr(b.item, "name");
if (!bname || GetFlag(b.item, "feature:ignore") || !Getattr(b.item, "module")) {
if ((!bname) || GetFlag(b.item, "feature:ignore") || (!Getattr(b.item, "module"))) {
b = Next(b);
continue;
}

View file

@ -601,7 +601,7 @@ class TypePass:private Dispatcher {
virtual int classforwardDeclaration(Node *n) {
/* Can't do inside a C struct because it breaks C nested structure wrapping */
if (!inclass || CPlusPlus) {
if ((!inclass) || (CPlusPlus)) {
String *name = Getattr(n, "name");
SwigType_typedef_class(name);
}

View file

@ -66,7 +66,7 @@ static int skip_tochar(String *s, int ch, String *out) {
break;
if (c == '\\') {
c = Getc(s);
if (c != EOF && out)
if ((c != EOF) && (out))
Putc(c, out);
}
}
@ -1155,7 +1155,7 @@ static DOH *Preprocessor_replace(DOH *s) {
Seek(s, -1, SEEK_CUR);
}
lenargs = Len(args);
if (!args || !lenargs) {
if ((!args) || (!lenargs)) {
/* This is not a defined() operator. */
Append(ns, id);
state = 0;
@ -1770,7 +1770,7 @@ String *Preprocessor_parse(String *s) {
}
} else if (Equal(id, kpp_line)) {
} else if (Equal(id, kpp_include)) {
if ((include_all || import_all) && allow) {
if (((include_all) || (import_all)) && (allow)) {
String *s1, *s2, *fn;
String *dirname;
int sysfile = 0;

View file

@ -363,7 +363,7 @@ static DOH *name_object_get(Hash *namehash, String *tname, SwigType *decl, SwigT
Hash *n = Getattr(namehash, tname);
if (n) {
rn = get_object(n, decl);
if (!rn && ncdecl)
if ((!rn) && ncdecl)
rn = get_object(n, ncdecl);
if (!rn)
rn = get_object(n, 0);
@ -380,7 +380,7 @@ DOH *Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType
return 0;
/* DB: This removed to more tightly control feature/name matching */
/* if (decl && SwigType_isqualifierdecl) {
/* if ((decl) && (SwigType_isqualifier(decl))) {
ncdecl = strchr(Char(decl),'.');
ncdecl++;
}

View file

@ -1207,7 +1207,7 @@ static void typemap_locals(String *s, ParmList *l, Wrapper *f, int argnum) {
/* If the user gave us $type as the name of the local variable, we'll use
the passed datatype instead */
if (argnum >= 0 && !isglobal) {
if ((argnum >= 0) && (!isglobal)) {
Printf(str, "%s%d", pn, argnum);
} else {
Append(str, pn);

View file

@ -1196,7 +1196,7 @@ String *SwigType_prefix(const SwigType *t) {
if (*d == '>') {
int nest = 1;
d--;
while ((d > c) && nest) {
while ((d > c) && (nest)) {
if (*d == '>')
nest++;
if (*d == '<')
@ -1208,7 +1208,7 @@ String *SwigType_prefix(const SwigType *t) {
/* Skip over params */
int nparen = 1;
d--;
while ((d > c) && nparen) {
while ((d > c) && (nparen)) {
if (*d == ')')
nparen++;
if (*d == '(')