Commit b9d12519 by Kaveh R. Ghazi Committed by Kaveh Ghazi

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
parent a3dd1d43
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> 1999-11-23 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (DECL_NEEDED_P): Tweak to match documentation. * cp-tree.h (DECL_NEEDED_P): Tweak to match documentation.
......
...@@ -3965,22 +3965,21 @@ pushdecl (x) ...@@ -3965,22 +3965,21 @@ pushdecl (x)
/* No shadow warnings for vars made for inlining. */ /* No shadow warnings for vars made for inlining. */
&& ! DECL_FROM_INLINE (x)) && ! DECL_FROM_INLINE (x))
{ {
const char *warnstring = NULL;
if (oldlocal != NULL_TREE && TREE_CODE (oldlocal) == PARM_DECL) 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 else if (IDENTIFIER_CLASS_VALUE (name) != NULL_TREE
&& current_class_ptr && current_class_ptr
&& !TREE_STATIC (name)) && !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) 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) else if (oldglobal != NULL_TREE)
/* XXX shadow warnings in outer-more namespaces */ /* XXX shadow warnings in outer-more namespaces */
warnstring = "declaration of `%s' shadows global declaration"; warning ("declaration of `%s' shadows global declaration",
IDENTIFIER_POINTER (name));
if (warnstring)
warning (warnstring, IDENTIFIER_POINTER (name));
} }
} }
...@@ -9776,9 +9775,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) ...@@ -9776,9 +9775,12 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
op ? operator_name_string (tmp) : name); op ? operator_name_string (tmp) : name);
} }
else else
error (((decl_context == PARM || decl_context == CATCHPARM) {
? "storage class specified for parameter `%s'" if (decl_context == PARM || decl_context == CATCHPARM)
: "storage class specified for typename"), name); error ("storage class specified for parameter `%s'", name);
else
error ("storage class specified for typename");
}
RIDBIT_RESET (RID_REGISTER, specbits); RIDBIT_RESET (RID_REGISTER, specbits);
RIDBIT_RESET (RID_AUTO, specbits); RIDBIT_RESET (RID_AUTO, specbits);
RIDBIT_RESET (RID_EXTERN, specbits); RIDBIT_RESET (RID_EXTERN, specbits);
......
...@@ -3164,18 +3164,18 @@ do_identifier (token, parsing, args) ...@@ -3164,18 +3164,18 @@ do_identifier (token, parsing, args)
} }
else if (!DECL_ERROR_REPORTED (id)) else if (!DECL_ERROR_REPORTED (id))
{ {
static char msg[]
= "name lookup of `%s' changed for new ANSI `for' scoping";
DECL_ERROR_REPORTED (id) = 1; DECL_ERROR_REPORTED (id) = 1;
if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (id))) 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); cp_error_at (" cannot use obsolete binding at `%D' because it has a destructor", id);
id = error_mark_node; id = error_mark_node;
} }
else 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); cp_pedwarn_at (" using obsolete binding at `%D'", id);
} }
} }
......
...@@ -4790,7 +4790,7 @@ build_unary_op (code, xarg, noconvert) ...@@ -4790,7 +4790,7 @@ build_unary_op (code, xarg, noconvert)
return fold (build1 (code, argtype, arg)); return fold (build1 (code, argtype, arg));
} }
error (errstring); error ("%s", errstring);
return error_mark_node; return error_mark_node;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment