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: warning message control: parameter patch


> 1. Assign non-zero values to all those zeros.  I think the best thing
>    to do is use the OPT_* constants from options.h since that pulls in
>    all the logic we need to coordinate the namespaces and such between
>    languages.

Which way is preferred for this example?

The first is cleaner and lets us delete a lot of global variables, and
perhaps control warnings in more interesting ways in the future, but
the second offers a slight performance benefit.  In some cases where
the if *only* tests the warn_* flag, the first gets rid of the if
completely, although the overhead of testing arbitrarily defined
options (and perhaps searching a list of directives in the future) is
certainly more than a simple if.

Old:
  if (warn_aggregate_return && AGGREGATE_TYPE_P (TREE_TYPE (exp)))
    warning (0, "function call has aggregate value");

New 1:
  if (AGGREGATE_TYPE_P (TREE_TYPE (exp)))
    warning (OPT_Waggregate_return, "function call has aggregate value");

New 2:
  if (warn_aggregate_return && AGGREGATE_TYPE_P (TREE_TYPE (exp)))
    warning (OPT_Waggregate_return, "function call has aggregate value");


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