summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-11-23 16:17:52 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>1999-11-23 16:17:52 +0000
commit5212eb00fc48c6742788d4ef06eb6068fd0a78ef (patch)
treea61ea478f0fcb2a256b53afbeceafcce84280409
parent03ebca09ee6e3b4bf8d1a9c9b56bd3a0136afb98 (diff)
downloadgcc-5212eb00fc48c6742788d4ef06eb6068fd0a78ef.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30641 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/decl.c26
-rw-r--r--gcc/cp/lex.c8
-rw-r--r--gcc/cp/typeck.c2
4 files changed, 28 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6c213df420b..1320b21696c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c1c7a914efc..f24bb3f011f 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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);
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index c3bdcd9faab..b7fc18fb819 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -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);
}
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index ec2f6065b6f..0bfb99c6e58 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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;
}