gcc-4.8 warning fixes

This commit is contained in:
William S Fulton 2024-01-15 23:06:13 +00:00
parent 472e9dd154
commit fe6c096dcb
5 changed files with 15 additions and 9 deletions

View File

@ -1771,8 +1771,9 @@ static String *add_qualifier_to_declarator(SwigType *type, SwigType *qualifier)
/* C++ decltype/auto type deduction. */
static SwigType *deduce_type(const struct Define *dtype) {
Node *n;
if (!dtype->val) return NULL;
Node *n = Swig_symbol_clookup(dtype->val, 0);
n = Swig_symbol_clookup(dtype->val, 0);
if (n) {
if (Strcmp(nodeType(n),"enumitem") == 0) {
/* For an enumitem, the "type" attribute gives us the underlying integer
@ -4445,10 +4446,10 @@ templateparameter : templcpptype def_args {
}
| parm {
Parm *p = $1;
String *name = Getattr(p, "name");
$$ = $1;
/* Correct the 'type name' parameter string, split into the appropriate "name" and "type" attributes */
String *name = Getattr(p, "name");
if (!name) {
String *type = Getattr(p, "type");
if ((Strncmp(type, "class ", 6) == 0) || (Strncmp(type, "typename ", 9) == 0)) {

View File

@ -269,7 +269,7 @@ static void cparse_template_expand(Node *templnode, Node *n, String *tname, Stri
Append(patchlist, uname);
}
if (!(Getattr(n, "templatetype"))) {
// Copied from handling "constructor" .. not sure if all this is needed
/* Copied from handling "constructor" .. not sure if all this is needed */
String *symname;
String *stripped_name = SwigType_templateprefix(name);
if (Strstr(tname, stripped_name)) {
@ -494,8 +494,9 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab
/* Printf(stdout,"partial '%s' '%s' ---> '%s'\n", tptype, ptype, partial_type); */
if (partial_name && strchr(Char(partial_name), '$') == Char(partial_name)) {
int index = atoi(Char(partial_name) + 1) - 1;
Parm *parm;
assert(index >= 0);
Parm *parm = ParmList_nth_parm(templateparms, index);
parm = ParmList_nth_parm(templateparms, index);
assert(parm);
if (parm) {
Setattr(parm, "type", partial_type);
@ -578,6 +579,8 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab
sz = Len(typelist);
for (i = 0; i < sz; i++) {
SwigType *s = Getitem(typelist, i);
Node *tynode;
String *tyname;
assert(!SwigType_isvariadic(s)); /* All parameters should have already been expanded, this is for function that contain variadic parameters only, such as f(v.p.V) */
SwigType_variadic_replace(s, unexpanded_variadic_parm, expanded_variadic_parms);
@ -588,8 +591,8 @@ int Swig_cparse_template_expand(Node *n, String *rname, ParmList *tparms, Symtab
We will not replace template args if a type/class exists with the same
name which is not a template.
*/
Node *tynode = Swig_symbol_clookup(s, 0);
String *tyname = tynode ? Getattr(tynode, "sym:name") : 0;
tynode = Swig_symbol_clookup(s, 0);
tyname = tynode ? Getattr(tynode, "sym:name") : 0;
/*
Printf(stdout, " replacing %s with %s to %s or %s to %s\n", s, name, dvalue, tbase, name_with_templateargs);
Printf(stdout, " %d %s to %s\n", tp == unexpanded_variadic_parm, name, ParmList_str_defaultargs(expanded_variadic_parms));

View File

@ -60,9 +60,10 @@ void Swig_extend_merge(Node *cls, Node *am) {
symname = Getattr(n,"sym:name");
DohIncref(symname);
if ((symname) && (!Getattr(n,"error"))) {
Node *c;
/* Remove node from its symbol table */
Swig_symbol_remove(n);
Node *c = Swig_symbol_add(symname,n);
c = Swig_symbol_add(symname,n);
if (c != n) {
/* Conflict with previous definition. Nuke previous definition */
String *e = NewStringEmpty();

View File

@ -1875,9 +1875,9 @@ String *Swig_name_decl(Node *n) {
if (nodetype && (Equal(nodetype, "constructor") || Equal(nodetype, "destructor") || Equal(nodetype, "cdecl"))) {
String *d = Getattr(n, "decl");
if (SwigType_isfunction(d)) {
Printv(decl, "(", ParmList_errorstr(Getattr(n, "parms")), ")", NIL);
SwigType *decl_temp = Copy(d);
SwigType *qualifiers = SwigType_pop_function_qualifiers(decl_temp);
Printv(decl, "(", ParmList_errorstr(Getattr(n, "parms")), ")", NIL);
if (qualifiers) {
String *qualifiers_string = SwigType_str(qualifiers, 0);
Printv(decl, " ", qualifiers_string, NIL);

View File

@ -1414,6 +1414,7 @@ void SwigType_variadic_replace(SwigType *t, Parm *unexpanded_variadic_parm, Parm
String *unexpanded_name = Getattr(unexpanded_variadic_parm, "name");
ParmList *expanded = CopyParmList(expanded_variadic_parms);
Parm *ep = expanded;
SwigType *fparms;
while (ep) {
SwigType *newtype = Copy(t);
SwigType_del_variadic(newtype);
@ -1422,7 +1423,7 @@ void SwigType_variadic_replace(SwigType *t, Parm *unexpanded_variadic_parm, Parm
ep = nextSibling(ep);
}
Clear(t);
SwigType *fparms = SwigType_function_parms_only(expanded);
fparms = SwigType_function_parms_only(expanded);
Append(t, fparms);
Delete(expanded);