This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/51677] New: don't suggest giving main() __attribute__((const))
- From: "b.r.longbons at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 25 Dec 2011 06:06:10 +0000
- Subject: [Bug c/51677] New: don't suggest giving main() __attribute__((const))
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51677
Bug #: 51677
Summary: don't suggest giving main() __attribute__((const))
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: b.r.longbons@gmail.com
With -O -Wsuggest-attribute=const, the following line will generate a warning:
int main() {}
This behavior is bad for 2 reasons:
1. Having an empty main() is quite useful for testing, as it allows linking to
succeed.
2. __attribute__((const)) is only meaningful when you can call the function.
Tested: 4.6.{0..2}, trunk r182496