decl.c (pushdecl, [...]): Don't call a variadic function with a non-literal format...
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Tue, 23 Nov 1999 16:17:52 +0000 (16:17 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Tue, 23 Nov 1999 16:17:52 +0000 (16:17 +0000)
        * 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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/lex.c
gcc/cp/typeck.c

index 6c213df..1320b21 100644 (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.
index c1c7a91..f24bb3f 100644 (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);
index c3bdcd9..b7fc18f 100644 (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);
            }
        }
index ec2f606..0bfb99c 100644 (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;
 }