[Bug middle-end/51677] don't suggest giving main() __attribute__((const))

2019-01-24 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51677

--- Comment #5 from Eric Gallager  ---
(In reply to Eric Gallager from comment #4)
> (In reply to Martin Sebor from comment #3)
> > It should be easy to white-list the main function in the
> > -Wsuggest-attribute= checker.  At the same time, I'm not sure it's necessary
> > or that the problem is unique to main.  The reasons noted in comment #0
> > apply to other functions as well.  Defining empty functions is useful for a
> > variety of reasons (e.g., default no-op handlers or, in C++, default no-op
> > implementations of virtual functions).  Similarly, without perfect data flow
> > analysis across the whole program it's impossible to tell whether an extern
> > function is ever called.  Why should main be treated differently from those?
> 
> Because it's an easy first step that doesn't require doing all of those
> extra data flow analyses

Also main() is already treated specially for -Wmain

[Bug middle-end/51677] don't suggest giving main() __attribute__((const))

2018-04-25 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51677

--- Comment #4 from Eric Gallager  ---
(In reply to Martin Sebor from comment #3)
> It should be easy to white-list the main function in the
> -Wsuggest-attribute= checker.  At the same time, I'm not sure it's necessary
> or that the problem is unique to main.  The reasons noted in comment #0
> apply to other functions as well.  Defining empty functions is useful for a
> variety of reasons (e.g., default no-op handlers or, in C++, default no-op
> implementations of virtual functions).  Similarly, without perfect data flow
> analysis across the whole program it's impossible to tell whether an extern
> function is ever called.  Why should main be treated differently from those?

Because it's an easy first step that doesn't require doing all of those extra
data flow analyses

[Bug middle-end/51677] don't suggest giving main() __attribute__((const))

2018-01-25 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51677

--- Comment #3 from Martin Sebor  ---
It should be easy to white-list the main function in the -Wsuggest-attribute=
checker.  At the same time, I'm not sure it's necessary or that the problem is
unique to main.  The reasons noted in comment #0 apply to other functions as
well.  Defining empty functions is useful for a variety of reasons (e.g.,
default no-op handlers or, in C++, default no-op implementations of virtual
functions).  Similarly, without perfect data flow analysis across the whole
program it's impossible to tell whether an extern function is ever called.  Why
should main be treated differently from those?

[Bug middle-end/51677] don't suggest giving main() __attribute__((const))

2018-01-23 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51677

Eric Gallager  changed:

   What|Removed |Added

   Keywords||diagnostic
 CC||egallager at gcc dot gnu.org,
   ||msebor at gcc dot gnu.org

--- Comment #2 from Eric Gallager  ---
This makes it impossible to test if -Wsuggest-attribute=const works with my
usual autoconf macros for checking warning flag functionality, btw. CC-ing
Martin Sebor since he recently fixed another bug with -Wsuggest-attribute=const
for me.

[Bug middle-end/51677] don't suggest giving main() __attribute__((const))

2011-12-29 Thread pinskia at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51677

Andrew Pinski pinskia at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2011-12-30
  Component|c   |middle-end
 Ever Confirmed|0   |1
   Severity|normal  |minor

--- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org 2011-12-30 
06:34:55 UTC ---
Confirmed.