[Bug c++/51115] New: "-Wstrict-prototypes" is rejected for C++ (ok) but accepted for Ada (meaningless)
Keith.S.Thompson at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Nov 13 02:09:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51115
Bug #: 51115
Summary: "-Wstrict-prototypes" is rejected for C++ (ok) but
accepted for Ada (meaningless)
Classification: Unclassified
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: trivial
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: Keith.S.Thompson@gmail.com
Created attachment 25811
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25811
Demo script
When the "-Wstrict-prototypes" option is used when compiling C++, the following
warning appears:
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for
Ada/C/ObjC but not for C++
The warning option doesn't make sense for C++, since the language doesn't
permit old-style non-prototype function declarations, but it makes even less
sense for Ada. Further experiment shows that the option is quietly accepted
when compiling Ada.
Suggested solution:
1. Make the Ada front end complain about "-Wstrict-prototypes" (unless there's
a general policy of having it quietly accept options that don't make sense).
2. Drop "Ada/" from the cc1plus warning message.
The attached sh script demonstrates the problem. The output on my system is:
% gcc --version
gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% gnatmake --version
GNATMAKE 4.4.5
Copyright (C) 1995-2008, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
% uname -a
Linux kvetch 2.6.38-12-generic #51-Ubuntu SMP Wed Sep 28 14:25:20 UTC 2011 i686
i686 i386 GNU/Linux
=== C ===
% gcc -c -Wstrict-prototypes foo.c
=== C++ ===
% g++ -c -Wstrict-prototypes foo.cpp
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for
Ada/C/ObjC but not for C++
% gcc -c -Wstrict-prototypes foo.cpp
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for
Ada/C/ObjC but not for C++
=== Objective-C
% gcc -c -Wstrict-prototypes foo.m
=== Ada ===
% gnatmake foo.adb -cargs -Wstrict-prototypes
gcc-4.4 -c -Wstrict-prototypes foo.adb
gnatbind -x foo.ali
gnatlink foo.ali
More information about the Gcc-bugs
mailing list