This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] New flag -Wsystem-headers


O.K., here's a revised patch. It's rather longer than before,
so I split it into three parts:

    (1) cpplib -- adds -Wsystem-headers to cpplib.
    (2) toplevel -- adds -Wsystem-headers to common code, and describes it
        in invoke.texi.
    (3) other -- removes superfluous tests system headers from warning
        checks in C, C++ and Fortran front-ends, so that -Wsystem-headers
        will enable those warnings, too.

(1) and (2) are independent; (3) depends on (2), but can be omitted.

BTW, I wasn't quite sure what to do about the special behaviour of
-Wunknown-pragmas. I decided to require -Wsystem-headers to get
unknown pragma warnings from system headers. IMHO this is consistent
with current behaviour.

Bootstrapped on sparc-sun-solaris2.6.

    Brane

-- 
Branko Čibej                 <branko.cibej@hermes.si>
HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
voice: (+386 1) 586 53 49     fax: (+386 1) 586 52 70
2000-09-15  Branko Cibej  <branko.cibej@hermes.si>

	* cpplib.h (cpp_options): New member warn_system_headers.
	* cpphash.h (CPP_PEDANTIC, CPP_WTRADITIONAL): Don't test
	CPP_IN_SYSTEM_HEADER.
	* cpplib.c (do_import, do_pragma_once): Likewise.
	* cpperror.c (_cpp_begin_message): Test warn_system_headers
	and CPP_IN_SYSTEM_HEADER.
	* cppinit.c (handle_option): Recognize -Wsystem_headers.
	(print_help): Describe -Wsystem_headers.
	* cpplex.c (lex_line): Reorganize condition so that warnings
	about C++ comments in system headers can be enabled. Remove
	label do_line_comment.



Index: cpperror.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpperror.c,v
retrieving revision 1.37
diff -u -p -r1.37 cpperror.c
--- cpperror.c	2000/08/29 18:37:36	1.37
+++ cpperror.c	2000/09/15 16:00:37
@@ -122,7 +122,9 @@ _cpp_begin_message (pfile, code, file, l
     case WARNING:
       if (! CPP_OPTION (pfile, warnings_are_errors))
 	{
-	  if (CPP_OPTION (pfile, inhibit_warnings))
+	  if (CPP_OPTION (pfile, inhibit_warnings)
+              || (CPP_IN_SYSTEM_HEADER (pfile)
+                  && ! CPP_OPTION (pfile, warn_system_headers)))
 	    return 0;
 	  is_warning = 1;
 	}
@@ -138,7 +140,9 @@ _cpp_begin_message (pfile, code, file, l
     case PEDWARN:
       if (! CPP_OPTION (pfile, pedantic_errors))
 	{
-	  if (CPP_OPTION (pfile, inhibit_warnings))
+	  if (CPP_OPTION (pfile, inhibit_warnings)
+              || (CPP_IN_SYSTEM_HEADER (pfile)
+                  && ! CPP_OPTION (pfile, warn_system_headers)))
 	    return 0;
 	  is_warning = 1;
 	}
Index: cpphash.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpphash.h,v
retrieving revision 1.72
diff -u -p -r1.72 cpphash.h
--- cpphash.h	2000/09/12 03:42:29	1.72
+++ cpphash.h	2000/09/15 16:00:37
@@ -205,9 +205,9 @@ extern unsigned char _cpp_trigraph_map[U
   (CPP_BUFFER (PFILE) && CPP_BUFFER (PFILE)->inc \
    && CPP_BUFFER (PFILE)->inc->sysp)
 #define CPP_PEDANTIC(PF) \
-  (CPP_OPTION (PF, pedantic) && !CPP_IN_SYSTEM_HEADER (PF))
+  CPP_OPTION (PF, pedantic)
 #define CPP_WTRADITIONAL(PF) \
-  (CPP_OPTION (PF, warn_traditional) && !CPP_IN_SYSTEM_HEADER (PF))
+  CPP_OPTION (PF, warn_traditional)
 
 /* Hash step.  The hash calculation is duplicated in cpp_lookup and
    parse_name.  */
Index: cppinit.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cppinit.c,v
retrieving revision 1.108
diff -u -p -r1.108 cppinit.c
--- cppinit.c	2000/09/07 20:31:06	1.108
+++ cppinit.c	2000/09/15 16:00:39
@@ -1623,6 +1623,8 @@ cpp_handle_option (pfile, argc, argv)
 	    CPP_OPTION (pfile, warn_paste) = 1;
 	  else if (!strcmp (argv[i], "-Werror"))
 	    CPP_OPTION (pfile, warnings_are_errors) = 1;
+          else if (!strcmp (argv[i], "-Wsystem-headers"))
+            CPP_OPTION (pfile, warn_system_headers) = 1;
 	  else if (!strcmp (argv[i], "-Wno-traditional"))
 	    CPP_OPTION (pfile, warn_traditional) = 0;
 	  else if (!strcmp (argv[i], "-Wno-trigraphs"))
@@ -1639,6 +1641,8 @@ cpp_handle_option (pfile, argc, argv)
 	    CPP_OPTION (pfile, warn_paste) = 0;
 	  else if (!strcmp (argv[i], "-Wno-error"))
 	    CPP_OPTION (pfile, warnings_are_errors) = 0;
+          else if (!strcmp (argv[i], "-Wno-system-headers"))
+            CPP_OPTION (pfile, warn_system_headers) = 0;
 	  break;
  	}
     }
@@ -1735,6 +1739,8 @@ Switches:\n\
   -Wno-import               Do not warn about the use of #import\n\
   -Werror                   Treat all warnings as errors\n\
   -Wno-error                Do not treat warnings as errors\n\
+  -Wsystem-headers          Do not suppress warnings from system headers\n\
+  -Wno-system-headers       Suppress warnings from system headers\n\
   -Wall                     Enable all preprocessor warnings\n\
   -M                        Generate make dependencies\n\
   -MM                       As -M, but ignore system header files\n\
Index: cpplex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplex.c,v
retrieving revision 1.96
diff -u -p -r1.96 cpplex.c
--- cpplex.c	2000/09/15 05:55:36	1.96
+++ cpplex.c	2000/09/15 16:00:41
@@ -1435,9 +1435,8 @@ lex_line (pfile, list)
 		     irrespective of conformance mode, because lots of
 		     broken systems do that and trying to clean it up
 		     in fixincludes is a nightmare.  */
-		  if (CPP_IN_SYSTEM_HEADER (pfile))
-		    goto do_line_comment;
-		  else if (CPP_OPTION (pfile, cplusplus_comments))
+                  if (CPP_OPTION (pfile, cplusplus_comments)
+                      || CPP_IN_SYSTEM_HEADER (pfile))
 		    {
 		      if (CPP_OPTION (pfile, c89) && CPP_PEDANTIC (pfile)
 			  && ! buffer->warned_cplusplus_comments)
@@ -1449,7 +1448,6 @@ lex_line (pfile, list)
 			  "(this will be reported only once per input file)");
 			  buffer->warned_cplusplus_comments = 1;
 			}
-		    do_line_comment:
 		      buffer->cur = cur;
 #if 0 /* Leave until new lexer in place.  */
 		      if (cur[-2] != c)
Index: cpplib.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplib.c,v
retrieving revision 1.202
diff -u -p -r1.202 cpplib.c
--- cpplib.c	2000/08/29 18:37:37	1.202
+++ cpplib.c	2000/09/15 16:00:41
@@ -366,8 +366,7 @@ do_import (pfile)
   const U_CHAR *str;
   int ab;
 
-  if (CPP_OPTION (pfile, warn_import)
-      && !CPP_IN_SYSTEM_HEADER (pfile) && !pfile->import_warning)
+  if (!pfile->import_warning && CPP_OPTION (pfile, warn_import))
     {
       pfile->import_warning = 1;
       cpp_warning (pfile,
@@ -787,8 +786,7 @@ do_pragma_once (pfile)
 
   /* Allow #pragma once in system headers, since that's not the user's
      fault.  */
-  if (!CPP_IN_SYSTEM_HEADER (pfile))
-    cpp_warning (pfile, "#pragma once is obsolete");
+  cpp_warning (pfile, "#pragma once is obsolete");
       
   if (CPP_PREV_BUFFER (ip) == NULL)
     cpp_warning (pfile, "#pragma once outside include file");
Index: cpplib.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpplib.h,v
retrieving revision 1.121
diff -u -p -r1.121 cpplib.h
--- cpplib.h	2000/09/12 03:42:29	1.121
+++ cpplib.h	2000/09/15 16:00:42
@@ -349,6 +349,9 @@ struct cpp_options
   /* Nonzero means don't print warning messages.  */
   unsigned char inhibit_warnings;
 
+  /* Nonzero means don't suppress warnings from system headers.  */
+  unsigned char warn_system_headers;
+
   /* Nonzero means don't print error messages.  Has no option to
      select it, but can be set by a user of cpplib (e.g. fix-header).  */
   unsigned char inhibit_errors;


2000-09-15  Branko Cibej  <branko.cibej@hermes.si>

	* flags.h:  Declare warning flag warn_system_headers.
	* toplev.c:  Define it.
	(W_options): Add option -Wsystem-headers.
	* diagnostic.c (count_error): Test warn_system_headers.
	* invoke.texi:  Add description for -Wsystem-headers.



Index: diagnostic.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/diagnostic.c,v
retrieving revision 1.35
diff -u -p -r1.35 diagnostic.c
--- diagnostic.c	2000/09/06 18:43:35	1.35
+++ diagnostic.c	2000/09/15 16:00:43
@@ -1034,7 +1034,9 @@ int
 count_error (warningp)
      int warningp;
 {
-  if (warningp && inhibit_warnings)
+  if (warningp
+      && (inhibit_warnings
+          || (in_system_header && !warn_system_headers)))
     return 0;
 
   if (warningp && !warnings_are_errors)
Index: flags.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flags.h,v
retrieving revision 1.50
diff -u -p -r1.50 flags.h
--- flags.h	2000/09/13 19:34:04	1.50
+++ flags.h	2000/09/15 16:00:43
@@ -79,6 +79,10 @@ extern int mem_report;
 
 extern int inhibit_warnings;
 
+/* Don't suppress warnings from system headers.  -Wsystem-headers.  */
+
+extern int warn_system_headers;
+
 /* Do print extra warnings (such as for uninitialized variables).  -W.  */
 
 extern int extra_warnings;
Index: invoke.texi
===================================================================
RCS file: /cvs/gcc/egcs/gcc/invoke.texi,v
retrieving revision 1.217
diff -u -p -r1.217 invoke.texi
--- invoke.texi	2000/09/14 18:09:16	1.217
+++ invoke.texi	2000/09/15 16:00:47
@@ -139,7 +139,7 @@ in the following sections.
 -Wmain  -Wmissing-declarations  -Wmissing-noreturn
 -Wmultichar  -Wno-import  -Wpacked  -Wpadded
 -Wparentheses -Wpointer-arith  -Wredundant-decls
--Wreturn-type -Wshadow  -Wsign-compare -Wswitch
+-Wreturn-type -Wshadow  -Wsign-compare -Wswitch -Wsystem-headers
 -Wtrigraphs -Wundef  -Wuninitialized  -Wunknown-pragmas -Wunreachable-code 
 -Wunused -Wunused-function -Wunused-label -Wunused-parameter
 -Wunused-variable -Wunused-value -Wwrite-strings
@@ -1705,6 +1705,18 @@ All of the above @samp{-W} options combi
 warnings about constructions that some users consider questionable, and
 that are easy to avoid (or modify to prevent the warning), even in
 conjunction with macros.
+
+@item -Wsystem-headers
+@cindex warnings from system headers
+@cindex system headers, warnings from
+Print warning messages for constructs found in system header files.
+Warnings from system headers are normally suppressed, on the assumption
+that they usually do not indicate real problems and would only make the
+compiler output harder to read.  Using this command line option tells
+GCC to emit warnings from system headers as if they occurred in user
+code.  However, note that using @samp{-Wall} in conjunction with this
+option will @emph{not} warn about unknown pragmas in system
+headers---for that, @samp{-Wunknown-pragmas} must also be used.
 @end table
 
 The following @samp{-W@dots{}} options are not implied by @samp{-Wall}.
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.378
diff -u -p -r1.378 toplev.c
--- toplev.c	2000/09/13 19:34:04	1.378
+++ toplev.c	2000/09/15 16:00:50
@@ -1307,6 +1307,10 @@ target_options [] = TARGET_OPTIONS;
 
 int inhibit_warnings = 0;
 
+/* Don't suppress warnings from system headers.  -Wsystem-headers.  */
+
+int warn_system_headers = 0;
+
 /* Print various extra warnings.  -W.  */
 
 int extra_warnings = 0;
@@ -1406,6 +1410,7 @@ lang_independent_options W_options[] =
   {"unused-parameter", &warn_unused_parameter, 1, "Warn when a function parameter is unused" },
   {"unused-variable", &warn_unused_variable, 1, "Warn when a variable is unused" },
   {"unused-value", &warn_unused_value, 1, "Warn when an expression value is unused" },
+  {"system-headers", &warn_system_headers, 1, "Do not suppress warnings from system headers"},
   {"error", &warnings_are_errors, 1, ""},
   {"shadow", &warn_shadow, 1, "Warn when one local variable shadows another" },
   {"switch", &warn_switch, 1,



2000-09-15  Branko Cibej  <branko.cibej@hermes.si>

	* c-common.c, c-decl.c, c-lex.c, c-parse.in, c-typeck.c:
	Don't test in_system_header when checking warning conditions.
	* cp/decl.c, cp/decl2.c, cp/parse.y: Likewise.
	* f/lex.c (fflex_hash_): Make test of warn_unknown_pragmas
	consistent with the test in c-lex.c:cb_def_pragma and
	c-pragma.c:dispatch_pragma.



cd /home/brane/eval/gcc/gcc/gcc/
cvs diff -up 2>/dev/null
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.c,v
retrieving revision 1.151
diff -u -p -r1.151 c-common.c
--- c-common.c	2000/09/12 15:10:50	1.151
+++ c-common.c	2000/09/15 17:09:26
@@ -3323,7 +3323,7 @@ shorten_compare (op0_ptr, op1_ptr, resty
 		 are requested.  However, if OP0 is a constant that is
 		 >= 0, the signedness of the comparison isn't an issue,
 		 so suppress the warning.  */
-	      if (extra_warnings && !in_system_header
+	      if (extra_warnings
 		  && ! (TREE_CODE (primop0) == INTEGER_CST
 			&& ! TREE_OVERFLOW (convert (signed_type (type),
 						     primop0))))
@@ -3332,7 +3332,7 @@ shorten_compare (op0_ptr, op1_ptr, resty
 	      break;
 
 	    case LT_EXPR:
-	      if (extra_warnings && !in_system_header
+	      if (extra_warnings
 		  && ! (TREE_CODE (primop0) == INTEGER_CST
 			&& ! TREE_OVERFLOW (convert (signed_type (type),
 						     primop0))))
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-decl.c,v
retrieving revision 1.155
diff -u -p -r1.155 c-decl.c
--- c-decl.c	2000/09/11 20:25:44	1.155
+++ c-decl.c	2000/09/15 17:09:28
@@ -1770,7 +1770,7 @@ duplicate_decls (newdecl, olddecl, diffe
 
 	  /* If warn_traditional, warn when a non-static function
 	     declaration follows a static one.  */
-	  if (warn_traditional && !in_system_header
+	  if (warn_traditional
 	      && TREE_CODE (olddecl) == FUNCTION_DECL
 	      && !TREE_PUBLIC (olddecl)
 	      && TREE_PUBLIC (newdecl))
@@ -2756,7 +2756,7 @@ define_label (filename, line, name)
       decl = lookup_label (name);
     }
 
-  if (warn_traditional && !in_system_header && lookup_name (name))
+  if (warn_traditional && lookup_name (name))
     warning_with_file_and_line (filename, line,
 				"traditional C lacks a separate namespace for labels, identifier `%s' conflicts",
 				IDENTIFIER_POINTER (name));
@@ -3371,7 +3371,7 @@ shadow_tag_warned (declspecs, warned)
 	}
       else
 	{
-	  if (!warned && ! in_system_header)
+	  if (!warned)
 	    {
 	      warning ("useless keyword or type name in empty declaration");
 	      warned = 2;
@@ -4015,8 +4015,7 @@ grokdeclarator (declarator, declspecs, d
 		    error ("`long long long' is too long for GCC");
 		  else
 		    {
-		      if (pedantic && !flag_isoc99 && ! in_system_header
-			  && warn_long_long)
+		      if (pedantic && !flag_isoc99 && warn_long_long)
 			pedwarn ("ISO C89 does not support `long long'");
 		      longlong = 1;
 		    }
@@ -4071,8 +4070,7 @@ grokdeclarator (declarator, declspecs, d
 			  | (1 << (int) RID_SIGNED)
 			  | (1 << (int) RID_UNSIGNED))))
 	  /* Don't warn about typedef foo = bar.  */
-	  && ! (specbits & (1 << (int) RID_TYPEDEF) && initialized)
-	  && ! in_system_header)
+	  && ! (specbits & (1 << (int) RID_TYPEDEF) && initialized))
 	{
 	  /* Issue a warning if this is an ISO C 99 program or if -Wreturn-type
 	     and this is a function, or if -Wimplicit; prefer the former
@@ -4919,8 +4917,7 @@ grokparms (parms_info, funcdef_flag)
   last_function_parms = TREE_PURPOSE (parms_info);
   last_function_parm_tags = TREE_VALUE (parms_info);
 
-  if (warn_strict_prototypes && first_parm == 0 && !funcdef_flag
-      && !in_system_header)
+  if (warn_strict_prototypes && first_parm == 0 && !funcdef_flag)
     warning ("function declaration isn't a prototype");
 
   if (first_parm != 0
Index: c-lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-lex.c,v
retrieving revision 1.101
diff -u -p -r1.101 c-lex.c
--- c-lex.c	2000/09/12 23:45:51	1.101
+++ c-lex.c	2000/09/15 17:09:28
@@ -889,7 +889,7 @@ readescape (p, limit, cptr)
   switch (c)
     {
     case 'x':
-      if (warn_traditional && !in_system_header)
+      if (warn_traditional)
 	warning ("the meaning of `\\x' varies with -traditional");
 
       if (flag_traditional)
@@ -976,7 +976,7 @@ readescape (p, limit, cptr)
     case 'b': *cptr = TARGET_BS;	return p;
     case 'v': *cptr = TARGET_VT;	return p;
     case 'a':
-      if (warn_traditional && !in_system_header)
+      if (warn_traditional)
 	warning ("the meaning of '\\a' varies with -traditional");
       *cptr = flag_traditional ? c : TARGET_BELL;
       return p;
@@ -986,7 +986,7 @@ readescape (p, limit, cptr)
       if (c_language != clk_cplusplus && !flag_isoc99)
 	break;
 
-      if (warn_traditional && !in_system_header)
+      if (warn_traditional)
 	warning ("the meaning of '\\%c' varies with -traditional", c);
 
       return read_ucs (p, limit, cptr, c == 'u' ? 4 : 8);
@@ -2055,7 +2055,7 @@ lex_number (str, len)
 	  case 'f': case 'F':
 	    if (fflag)
 	      ERROR ("more than one 'f' suffix on floating constant");
-	    else if (warn_traditional && !in_system_header)
+	    else if (warn_traditional)
 	      warning ("traditional C rejects the 'f' suffix");
 
 	    fflag = 1;
@@ -2064,7 +2064,7 @@ lex_number (str, len)
 	  case 'l': case 'L':
 	    if (lflag)
 	      ERROR ("more than one 'l' suffix on floating constant");
-	    else if (warn_traditional && !in_system_header)
+	    else if (warn_traditional)
 	      warning ("traditional C rejects the 'l' suffix");
 
 	    lflag = 1;
@@ -2139,7 +2139,7 @@ lex_number (str, len)
 	    case 'u': case 'U':
 	      if (spec_unsigned)
 		error ("two 'u' suffixes on integer constant");
-	      else if (warn_traditional && !in_system_header)
+	      else if (warn_traditional)
 		warning ("traditional C rejects the 'u' suffix");
 
 	      spec_unsigned = 1;
@@ -2156,8 +2156,7 @@ lex_number (str, len)
 		    error ("'lul' is not a valid integer suffix");
 		  else if (c != spec_long)
 		    error ("'Ll' and 'lL' are not valid integer suffixes");
-		  else if (pedantic && ! flag_isoc99
-			   && ! in_system_header && warn_long_long)
+		  else if (pedantic && ! flag_isoc99 && warn_long_long)
 		    pedwarn ("ISO C89 forbids long long integer constants");
 		  spec_long_long = 1;
 		}
@@ -2267,8 +2266,7 @@ lex_number (str, len)
       /* We assume that constants specified in a non-decimal
 	 base are bit patterns, and that the programmer really
 	 meant what they wrote.  */
-      if (warn_traditional && !in_system_header
-	  && base == 10 && trad_type != ansi_type)
+      if (warn_traditional && base == 10 && trad_type != ansi_type)
 	{
 	  if (TYPE_PRECISION (trad_type) != TYPE_PRECISION (ansi_type))
 	    warning ("width of integer constant changes with -traditional");
Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-parse.in,v
retrieving revision 1.59
diff -u -p -r1.59 c-parse.in
--- c-parse.in	2000/09/14 23:44:46	1.59
+++ c-parse.in	2000/09/15 17:09:29
@@ -421,7 +421,7 @@ unop:     '&'
 	| '+'
 		{ $$ = CONVERT_EXPR;
 ifc
-  if (warn_traditional && !in_system_header)
+  if (warn_traditional)
     warning ("traditional C rejects the unary plus operator");
 end ifc
 		}
@@ -753,7 +753,7 @@ ifc
 end ifc
                   $$ = chainon ($1, $2);
 ifc
-		  if (warn_traditional && !in_system_header
+		  if (warn_traditional
 		      && (lineno != last_lineno || !last_input_filename ||
 			  strcmp (last_input_filename, input_filename)))
 		    {
Index: c-typeck.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-typeck.c,v
retrieving revision 1.87
diff -u -p -r1.87 c-typeck.c
--- c-typeck.c	2000/09/12 14:22:44	1.87
+++ c-typeck.c	2000/09/15 17:09:30
@@ -4390,7 +4390,7 @@ store_init_value (decl, init)
     }
 #endif
 
-  if (warn_traditional && !in_system_header
+  if (warn_traditional
       && AGGREGATE_TYPE_P (TREE_TYPE (decl)) && ! TREE_STATIC (decl))
     warning ("traditional C rejects automatic aggregate initialization");
 
@@ -6394,7 +6394,7 @@ process_init_element (value)
 	     code appears conditioned on e.g. __STDC__ to avoid
 	     "missing initializer" warnings and relies on default
 	     initialization to zero in the traditional C case.  */
-	  if (warn_traditional && !in_system_header
+	  if (warn_traditional
 	      && !(value && (integer_zerop (value) || real_zerop (value))))
 	    warning ("traditional C rejects initialization of unions");
 
@@ -6732,7 +6732,7 @@ c_expand_start_case (exp)
       tree index;
       type = TYPE_MAIN_VARIANT (TREE_TYPE (exp));
 
-      if (warn_traditional && !in_system_header
+      if (warn_traditional
 	  && (type == long_integer_type_node
 	      || type == long_unsigned_type_node))
 	warning ("`long' switch expression not converted to `int' in ISO C");
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.691
diff -u -p -r1.691 decl.c
--- decl.c	2000/09/13 01:02:51	1.691
+++ decl.c	2000/09/15 17:09:43
@@ -7178,7 +7178,7 @@ check_tag_decl (declspecs)
       /* Anonymous unions are objects, so they can have specifiers.  */;
       SET_ANON_AGGR_TYPE_P (t);
 
-      if (TREE_CODE (t) != UNION_TYPE && pedantic && ! in_system_header)
+      if (TREE_CODE (t) != UNION_TYPE && pedantic)
 	pedwarn ("ISO C++ prohibits anonymous structs");
     }
 
@@ -9496,7 +9496,7 @@ compute_array_index_type (name, size)
       /* Except that an extension we allow zero-sized arrays.  We
 	 always allow them in system headers because glibc uses
 	 them.  */
-      else if (integer_zerop (size) && pedantic && !in_system_header)
+      else if (integer_zerop (size) && pedantic)
 	{
 	  if (name)
 	    cp_pedwarn ("ISO C++ forbids zero-size array `%D'", name);
@@ -10191,7 +10191,7 @@ grokdeclarator (declarator, declspecs, d
 		{
 		  if (i == (int) RID_LONG && RIDBIT_SETP (i, specbits))
 		    {
-		      if (pedantic && ! in_system_header && warn_long_long)
+		      if (pedantic && warn_long_long)
 			pedwarn ("ISO C++ does not support `long long'");
 		      if (longlong)
 			error ("`long long long' is too long for GCC");
@@ -10278,7 +10278,7 @@ grokdeclarator (declarator, declspecs, d
 		 && in_namespace == NULL_TREE
 		 && current_namespace == global_namespace);
 
-      if (in_system_header || flag_ms_extensions)
+      if (flag_ms_extensions)
 	/* Allow it, sigh.  */;
       else if (pedantic || ! is_main)
 	cp_pedwarn ("ISO C++ forbids declaration of `%s' with no type",
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl2.c,v
retrieving revision 1.397
diff -u -p -r1.397 decl2.c
--- decl2.c	2000/09/13 01:02:52	1.397
+++ decl2.c	2000/09/15 17:09:47
@@ -3943,8 +3943,7 @@ reparse_absdcl_as_casts (decl, expr)
       expr = build_c_cast (type, expr);
     }
 
-  if (warn_old_style_cast && ! in_system_header
-      && current_lang_name != lang_name_c)
+  if (warn_old_style_cast && current_lang_name != lang_name_c)
     warning ("use of old-style cast");
 
   return expr;
Index: cp/parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/parse.y,v
retrieving revision 1.196
diff -u -p -r1.196 parse.y
--- parse.y	2000/09/12 06:45:59	1.196
+++ parse.y	2000/09/15 17:09:49
@@ -2289,7 +2289,7 @@ maybecomma:
 maybecomma_warn:
 	  /* empty */
 	| ','
-		{ if (pedantic && !in_system_header)
+		{ if (pedantic)
 		    pedwarn ("comma at end of enumerator list"); }
 	;
 
Index: f/lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/f/lex.c,v
retrieving revision 1.19
diff -u -p -r1.19 lex.c
--- lex.c	2000/06/21 20:11:14	1.19
+++ lex.c	2000/09/15 17:09:51
@@ -1151,8 +1151,7 @@ ffelex_hash_ (FILE *finput)
 	      /* Issue a warning message if we have been asked to do so.
 		 Ignoring unknown pragmas in system header file unless
 		 an explcit -Wunknown-pragmas has been given. */
-	      if (warn_unknown_pragmas > 1
-		  || (warn_unknown_pragmas && ! in_system_header))
+	      if (warn_unknown_pragmas > in_system_header)
 		warning ("ignoring pragma: %s", token_buffer);
 #endif /* 0 */
 	      goto skipline;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]