This is the mail archive of the gcc@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]

mixing warning flags


How to convert this code?  There is no single OPT_* that reflects when
the first warning is emitted.

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

One option is:

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

but a little re-wording might be useful for when you get both
warnings.  Alternately:

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

or pedantically:

	  if (params == 0 && warn_format_security)
	    warning (OPT_Wformat_security,
		     "format not a string literal and no format arguments");
	  els 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");


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