decl.c (pushdecl, [...]): Don't call a variadic function with a non-literal format string.

* decl.c (pushdecl, grokdeclarator): Don't call a variadic
        function with a non-literal format string.

        * lex.c (do_identifier): Likewise.

        * typeck.c (build_unary_op): Likewise.

From-SVN: r30641
This commit is contained in:
Kaveh R. Ghazi 1999-11-23 16:17:52 +00:00 committed by Kaveh Ghazi
parent a3dd1d4395
commit b9d1251954
4 changed files with 28 additions and 17 deletions

View File

@ -1,3 +1,12 @@
1999-11-23 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* decl.c (pushdecl, grokdeclarator): Don't call a variadic
function with a non-literal format string.
* lex.c (do_identifier): Likewise.
* typeck.c (build_unary_op): Likewise.
1999-11-23 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (DECL_NEEDED_P): Tweak to match documentation.

View File

@ -3965,22 +3965,21 @@ pushdecl (x)
/* No shadow warnings for vars made for inlining. */
&& ! DECL_FROM_INLINE (x))
{
const char *warnstring = NULL;
if (oldlocal != NULL_TREE && TREE_CODE (oldlocal) == PARM_DECL)
warnstring = "declaration of `%s' shadows a parameter";
warning ("declaration of `%s' shadows a parameter",
IDENTIFIER_POINTER (name));
else if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE
&& current_class_ptr
&& !TREE_STATIC (name))
warnstring = "declaration of `%s' shadows a member of `this'";
warning ("declaration of `%s' shadows a member of `this'",
IDENTIFIER_POINTER (name));
else if (oldlocal != NULL_TREE)
warnstring = "declaration of `%s' shadows previous local";
warning ("declaration of `%s' shadows previous local",
IDENTIFIER_POINTER (name));
else if (oldglobal != NULL_TREE)
/* XXX shadow warnings in outer-more namespaces */
warnstring = "declaration of `%s' shadows global declaration";
if (warnstring)
warning (warnstring, IDENTIFIER_POINTER (name));
warning ("declaration of `%s' shadows global declaration",
IDENTIFIER_POINTER (name));
}
}
@ -9776,9 +9775,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
op ? operator_name_string (tmp) : name);
}
else
error (((decl_context == PARM || decl_context == CATCHPARM)
? "storage class specified for parameter `%s'"
: "storage class specified for typename"), name);
{
if (decl_context == PARM || decl_context == CATCHPARM)
error ("storage class specified for parameter `%s'", name);
else
error ("storage class specified for typename");
}
RIDBIT_RESET (RID_REGISTER, specbits);
RIDBIT_RESET (RID_AUTO, specbits);
RIDBIT_RESET (RID_EXTERN, specbits);

View File

@ -3164,18 +3164,18 @@ do_identifier (token, parsing, args)
}
else if (!DECL_ERROR_REPORTED (id))
{
static char msg[]
= "name lookup of `%s' changed for new ANSI `for' scoping";
DECL_ERROR_REPORTED (id) = 1;
if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (id)))
{
error (msg, IDENTIFIER_POINTER (token));
error ("name lookup of `%s' changed for new ANSI `for' scoping",
IDENTIFIER_POINTER (token));
cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", id);
id = error_mark_node;
}
else
{
pedwarn (msg, IDENTIFIER_POINTER (token));
pedwarn ("name lookup of `%s' changed for new ANSI `for' scoping",
IDENTIFIER_POINTER (token));
cp_pedwarn_at (" using obsolete binding at `%D'", id);
}
}

View File

@ -4790,7 +4790,7 @@ build_unary_op (code, xarg, noconvert)
return fold (build1 (code, argtype, arg));
}
error (errstring);
error ("%s", errstring);
return error_mark_node;
}