[multiple changes]
authorRichard Henderson <rth@gcc.gnu.org>
Mon, 26 Jun 2000 16:42:23 +0000 (09:42 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 26 Jun 2000 16:42:23 +0000 (09:42 -0700)
2000-06-26  Joseph S. Myers  <jsm28@cam.ac.uk>

        * c-decl.c (grokdeclarator): Don't warn about `long long' in C99.
        Make warnings about implicit int be pedwarns in C99.  Don't warn
        about duplicate type qualifiers in C99.
        (start_function): Make warning about implict int return type be a
        pedwarn in C99.
        * c-lex.c (yylex): Don't warn about `long long' in C99.
        * c-typeck.c (c_expand_return): In C99, always pedwarn about
        `return' with no value in function returning non-void.

2000-06-26  Richard Henderson  <rth@cygnus.com>

        * c-typeck.c (pedwarn_c99): New.
        * diagnostic.c (verror, vwarning, vpedwarn): Export.
        * toplev.h: Prototype them.

From-SVN: r34713

gcc/ChangeLog
gcc/c-decl.c
gcc/c-lex.c
gcc/c-tree.h
gcc/c-typeck.c
gcc/diagnostic.c
gcc/toplev.h

index 81db24fb8e1619ffa0423f35b9805ade92691f75..f4a7d8e13eb2fe6562dcd6809807988383eb5e5a 100644 (file)
@@ -1,3 +1,20 @@
+2000-06-26  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * c-decl.c (grokdeclarator): Don't warn about `long long' in C99.
+       Make warnings about implicit int be pedwarns in C99.  Don't warn
+       about duplicate type qualifiers in C99.
+       (start_function): Make warning about implict int return type be a
+       pedwarn in C99.
+       * c-lex.c (yylex): Don't warn about `long long' in C99.
+       * c-typeck.c (c_expand_return): In C99, always pedwarn about
+       `return' with no value in function returning non-void.
+
+2000-06-26  Richard Henderson  <rth@cygnus.com>
+
+       * c-typeck.c (pedwarn_c99): New.
+       * diagnostic.c (verror, vwarning, vpedwarn): Export.
+       * toplev.h: Prototype them.
+
 2000-06-26  J. David Anglin  <dave@hiauly1.hia.nrc.ca>
 
        * c-typeck.c (digest_init): Return error_mark_node node when
@@ -11,7 +28,7 @@
 
 2000-06-25 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
 
-        * gengenrtl.c (special_rtx): Fix typo in comment.
+       * gengenrtl.c (special_rtx): Fix typo in comment.
 
 2000-06-26  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
 
@@ -50,7 +67,7 @@
        
 2000-06-25  John David Anglin  <dave.anglin@nrc.ca>
 
-        * config/vax/vax.h (TARGET_SWITCHES): Provide descriptions.
+       * config/vax/vax.h (TARGET_SWITCHES): Provide descriptions.
 
 2000-06-25 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
 
index cabc4c197e2a466ec6a76038d6c842394d76f67f..54acc37b45959058b70165a46adde29ca6a3c967 100644 (file)
@@ -3955,7 +3955,8 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
                      error ("`long long long' is too long for GCC");
                    else
                      {
-                       if (pedantic && ! in_system_header && warn_long_long)
+                       if (pedantic && !flag_isoc99 && ! in_system_header
+                           && warn_long_long)
                          pedwarn ("ANSI C does not support `long long'");
                        longlong = 1;
                      }
@@ -4018,7 +4019,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
          if ((warn_implicit_int || warn_return_type) && funcdef_flag)
            warn_about_return_type = 1;
          else if (warn_implicit_int || flag_isoc99)
-           warning ("type defaults to `int' in declaration of `%s'", name);
+           pedwarn_c99 ("type defaults to `int' in declaration of `%s'", name);
        }
 
       defaulted_int = 1;
@@ -4168,11 +4169,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
   restrictp = !! (specbits & 1 << (int) RID_RESTRICT) + TYPE_RESTRICT (type);
   volatilep = !! (specbits & 1 << (int) RID_VOLATILE) + TYPE_VOLATILE (type);
   inlinep = !! (specbits & (1 << (int) RID_INLINE));
-  if (constp > 1)
+  if (constp > 1 && ! flag_isoc99)
     pedwarn ("duplicate `const'");
-  if (restrictp > 1)
+  if (restrictp > 1 && ! flag_isoc99)
     pedwarn ("duplicate `restrict'");
-  if (volatilep > 1)
+  if (volatilep > 1 && ! flag_isoc99)
     pedwarn ("duplicate `volatile'");
   if (! flag_gen_aux_info && (TYPE_QUALS (type)))
     type = TYPE_MAIN_VARIANT (type);
@@ -4526,11 +4527,11 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
                      error ("invalid type modifier within pointer declarator");
                    }
                }
-             if (constp > 1)
+             if (constp > 1 && ! flag_isoc99)
                pedwarn ("duplicate `const'");
-             if (volatilep > 1)
+             if (volatilep > 1 && ! flag_isoc99)
                pedwarn ("duplicate `volatile'");
-             if (restrictp > 1)
+             if (restrictp > 1 && ! flag_isoc99)
                pedwarn ("duplicate `restrict'");
 
              type_quals = ((constp ? TYPE_QUAL_CONST : 0)
@@ -5743,7 +5744,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
 
   if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl1))))
     {
-      error ("return-type is an incomplete type");
+      error ("return type is an incomplete type");
       /* Make it return void instead.  */
       TREE_TYPE (decl1)
        = build_function_type (void_type_node,
@@ -5751,7 +5752,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes)
     }
 
   if (warn_about_return_type)
-    warning ("return-type defaults to `int'");
+    pedwarn_c99 ("return type defaults to `int'");
 
   /* Save the parm names or decls from this function's declarator
      where store_parm_decls will find them.  */
index 41a88b0e667ab4ab85e7d904827df365b4fff11f..8b917ff56a25303adfe343965b3c2aba3c01cf9d 100644 (file)
@@ -1781,7 +1781,8 @@ yylex ()
                      {
                        if (spec_long_long)
                          error ("three `l's in integer constant");
-                       else if (pedantic && ! in_system_header && warn_long_long)
+                       else if (pedantic && ! flag_isoc99
+                                && ! in_system_header && warn_long_long)
                          pedwarn ("ANSI C forbids long long integer constants");
                        spec_long_long = 1;
                      }
index 7c86e2676d06a6cb5aad318b9ab18a90bd767d12..474aaaec1d5cd6bfccaf417b3b865c5615a3eb53 100644 (file)
@@ -297,6 +297,8 @@ extern void c_expand_asm_operands           PARAMS ((tree, tree, tree,
                                                         const char *, int));
 extern void c_expand_return                    PARAMS ((tree));
 extern tree c_expand_start_case                 PARAMS ((tree));
+extern void pedwarn_c99                                PARAMS ((const char *, ...))
+                                                       ATTRIBUTE_PRINTF_1;
 
 /* in c-iterate.c */
 extern void init_iterators                     PARAMS ((void));
index cd9da659e53cf6083ab06dd64e98bcddd2da7d00..c882dd9038631c73e0699e3883bf7d5efb0eb7e5 100644 (file)
@@ -6623,8 +6623,9 @@ c_expand_return (retval)
   if (!retval)
     {
       current_function_returns_null = 1;
-      if (warn_return_type && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
-       warning ("`return' with no value, in function returning non-void");
+      if ((warn_return_type || flag_isoc99)
+         && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
+       pedwarn_c99 ("`return' with no value, in function returning non-void");
       expand_null_return ();
     }
   else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE)
@@ -6752,3 +6753,27 @@ c_expand_start_case (exp)
 
   return exp;
 }
+
+/* Issue an ISO C99 pedantic warning MSGID.  */
+
+void
+pedwarn_c99 VPARAMS ((const char *msgid, ...))
+{
+#ifndef ANSI_PROTOTYPES
+  const char *msgid;
+#endif
+  va_list ap;
+
+  VA_START (ap, msgid);
+
+#ifndef ANSI_PROTOTYPES
+  msgid = va_arg (ap, const char *);
+#endif
+
+  if (flag_isoc99)
+    vpedwarn (msgid, ap);
+  else
+    vwarning (msgid, ap);
+
+  va_end (ap);
+}
index 36d4b4037459665634d3ac1bbf7e8ab01c0bd97b..564c4883cf63ef71931c4f665f2d32cced0f09d1 100644 (file)
@@ -64,14 +64,11 @@ static void v_error_with_file_and_line PARAMS ((const char *, int,
                                                const char *, va_list));
 static void v_error_with_decl PARAMS ((tree, const char *, va_list));
 static void v_error_for_asm PARAMS ((rtx, const char *, va_list));
-static void verror PARAMS ((const char *, va_list));
 static void vfatal PARAMS ((const char *, va_list)) ATTRIBUTE_NORETURN;
 static void v_warning_with_file_and_line PARAMS ((const char *, int,
                                                  const char *, va_list));
 static void v_warning_with_decl PARAMS ((tree, const char *, va_list));
 static void v_warning_for_asm PARAMS ((rtx, const char *, va_list));
-static void vwarning PARAMS ((const char *, va_list));
-static void vpedwarn PARAMS ((const char *, va_list));
 static void v_pedwarn_with_decl PARAMS ((tree, const char *, va_list));
 static void v_pedwarn_with_file_and_line PARAMS ((const char *, int,
                                                  const char *, va_list));
@@ -858,7 +855,7 @@ v_error_for_asm (insn, msgid, ap)
 
 /* Report an error at the current line number.  */
 
-static void
+void
 verror (msgid, ap)
      const char *msgid;
      va_list ap;
@@ -946,7 +943,7 @@ v_warning_for_asm (insn, msgid, ap)
 
 /* Report a warning at the current line number.  */
 
-static void
+void
 vwarning (msgid, ap)
      const char *msgid;
      va_list ap;
@@ -957,7 +954,7 @@ vwarning (msgid, ap)
 /* These functions issue either warnings or errors depending on
    -pedantic-errors.  */
 
-static void
+void
 vpedwarn (msgid, ap)
      const char *msgid;
      va_list ap;
index 952d3631bb36abf1d3004ef3bb7229e946ae181c..dd359f770a03d45a0624c92f3cb022bb7f7c9193 100644 (file)
@@ -70,10 +70,13 @@ extern void _fatal_insn                     PARAMS ((const char *,
 #endif
 extern void warning                    PARAMS ((const char *, ...))
                                                ATTRIBUTE_PRINTF_1;
+extern void vwarning                   PARAMS ((const char *, va_list));
 extern void error                      PARAMS ((const char *, ...))
                                                ATTRIBUTE_PRINTF_1;
+extern void verror                     PARAMS ((const char *, va_list));
 extern void pedwarn                    PARAMS ((const char *, ...))
                                                ATTRIBUTE_PRINTF_1;
+extern void vpedwarn                   PARAMS ((const char *, va_list));
 extern void pedwarn_with_file_and_line PARAMS ((const char *, int,
                                                  const char *, ...))
   ATTRIBUTE_PRINTF_3;