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]

C++: ignore -Wstrict-prototypes, not -Wno-strict-prototypes


The C++ front end currently ignores -W(no-)missing-prototypes and
complains about -W(no-)strict-prototypes.  Both these warning
categories are always on in C++.  Therefore, I think C++ should ignore
the positive form of both these options, and complain about the negative
form of both.

Patch bootstrapped on i386-linux; silences ~20 warnings while building
libgcc.

zw

cp:
	* decl2.c: Remove warn_missing_prototypes global.  Object to
	-Wno-strict-prototypes and -Wno-missing-prototypes.  Silently
	ignore -Wstrict-prototypes and -Wmissing-prototypes.  Both
	these warning categories are always on in C++.

===================================================================
Index: cp/decl2.c
--- cp/decl2.c	2000/06/14 05:30:04	1.368
+++ cp/decl2.c	2000/06/20 22:50:37
@@ -264,10 +264,6 @@ int warn_cast_qual;
 
 int warn_pointer_arith = 1;
 
-/* Nonzero means warn for any function def without prototype decl.  */
-
-int warn_missing_prototypes;
-
 /* Nonzero means warn about multiple (redundant) decls for the same single
    variable or function.  */
 
@@ -743,7 +739,15 @@ lang_decode_option (argc, argv)
       else if (!strcmp (p, "pointer-arith"))
 	warn_pointer_arith = setting;
       else if (!strcmp (p, "missing-prototypes"))
-	warn_missing_prototypes = setting;
+	{
+	  if (setting == 0)
+	    warning ("-Wno-missing-prototypes is not supported in C++");
+	}
+      else if (!strcmp (p, "strict-prototypes"))
+	{
+	  if (setting == 0)
+	    warning ("-Wno-strict-prototypes is not supported in C++");
+	}
       else if (!strcmp (p, "redundant-decls"))
 	warn_redundant_decls = setting;
       else if (!strcmp (p, "missing-braces"))

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