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]
Other format: [Raw text]

Re: [warnings] attribs.c


> Wint-to-pointer-cast-*, Wpointer-to-int-cast-*.

Ok, but they weren't on my list.

> OPT_ missing.

Fixed.

> Should avoid warning twice when both options are on.

Oops, used a stale diff.

+	  if (params == 0 && warn_format_security)
+	    warning (OPT_Wformat_security, "format not a string literal and no format arguments");
+	  else if (params == 0 && warn_format_nonliteral)
+	    warning (OPT_Wformat_nonliteral, "format not a string literal and no format arguments");
+	  else
+	    warning (OPT_Wformat_nonliteral,
+		     "format not a string literal, argument types not checked");

Daniel's idea has merit, but the logic is almost as ugly as repeating
the string.  With two strings, at least we have the option of
adjusting the warning according to which option triggered it.

Or we could just issue two warnings (first and third above) if both
options are given, and omit the 'else'.

> > @@ -659,8 +659,8 @@ decode_options (unsigned int argc, const
> >        /* The c_decode_option function and decode_option hook set
> >  	 this to `2' if -Wall is used, so we can avoid giving out
> >  	 lots of errors for people who don't realize what -Wall does.  */
> > -      if (warn_uninitialized == 1)
> > -	warning (0, "-Wuninitialized is not supported without -O");
> > +      warning (OPT_Wuninitialized,
> > +	       "-Wuninitialized is not supported without -O");
> 
> This appears to change the logic if warn_uninitialized == 2.  Either the 
> logic should be preserved or if the comment is wrong it should be 
> corrected.

Oops, unsaved buffer.  Probably should add a testcase for that one,
eh?  ;-)

       if (warn_uninitialized == 1)
-	warning (0, "-Wuninitialized is not supported without -O");
+	warning (OPT_Wuninitialized,
+		 "-Wuninitialized is not supported without -O");


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