gcc fails when "-Wall" "-Wno-long-double" parametres used together
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc |
Fix Released
|
Wishlist
|
|||
gcc-4.2 (Ubuntu) |
Invalid
|
Low
|
Unassigned |
Bug Description
Binary package hint: gcc-4.2
when i'm trying to compile simple C test:
main() {}
with follow flags:
gcc -c -g -Wall -Wno-long-double 1.c
I get follow error:
1.c:1: warning: return type defaults to ‘int’
1.c: In function ‘main’:
1.c:1: warning: control reaches end of non-void function
At top level:
cc1: error: unrecognized command line option "-Wno-long-double"
And it works if I use the flags separately:
$gcc -c -g -Wall 1.c
1.c:1: warning: return type defaults to ‘int’
1.c: In function ‘main’:
1.c:1: warning: control reaches end of non-void function
$ gcc -c -g -Wno-long-double 1.c
System configuration:
Ubuntu 8.04.1
Linux pasha-laptop 2.6.24-21-generic #1 SMP Mon Aug 25 17:32:09 UTC 2008 i686 GNU/Linux
Changed in gcc: | |
status: | Unknown → Confirmed |
Changed in gcc: | |
status: | Confirmed → Fix Released |
Changed in gcc: | |
importance: | Unknown → Wishlist |
[forwarded from http:// bugs.debian. org/367657]
Summary:
GCC should be more tolerant of is-not- a-recognised- warning
gcc -Wno-this-
as specified in detail below.
Discussion:
Occasionally, GCC introduces new warnings. For example, GCC 4 has compatible pointers.
introduced warnings about discrepancies in signedness of integers
pointed to by otherwise-
Furthermore, because GCC has traditionally had such good warnings, and
such good configurability of warnings, and because no-one looks at
warnings that don't cause build failures, many people (myself
included) use -Werror in nearly all of their projects.
However, when new warnings are introduced, there is a problem with the
configurability: Like any warning, whether or not you want it enabled
depends on your coding style and practices and on other rather
subjective details. This means that there can be no universally
correct default for a new warning; turning it on by default is
sometimes a reasonable value judgement on the part of the compiler
authors.
When a new warning is introduced and enabled by default, then the
author of a project whose coding style warrants disabling that warning
is faced with a difficult choice:
* they can set the build system to say -Wno-new-warning (for whatever
value of `new-warning' is relevant) so that it builds on new
compilers but so that users of older GCC's need to override the
build system to remove -Wno-new-warning (which the older GCC
doesn't understand);
* they can turn off -Werror, leaving themselves open to the massive
bugs which are often hidden by warnings which are ignored (perhaps
bugs which don't show up and aren't warned about on the developer's
system, because of the various type differences between systems);
* they can leave things as they are and require users of the new
compiler to override the build system.
* they can add complexity to the build system to try to autodetect
the available compiler options; this usually works but it makes the
build system more complex - note that in some projects this might
be the only reason why something like autoconf might be required.
None of these are the right answer.
I would like to propose a straightforward answer which can easily be
implemented in GCC and leaves everything correct. With this change,
it is much easier to make portable packages which still make good and
strict use of GCC's excellent warnings system.
Specification of the proposed new behaviour:
1. GCC should ignore unknown -Wno-* options if no other warnings are to
be issued. This is always correct since the only effect of such an
option would be to suppress warnings which might otherwise be
issued. If no warnings are to be issued at all then treating even
an unknown suppression as a no-op is clearly correct.
2. If some other warnings are to be issued, then it is necessary to
report on stderr if any unknown (and therefore unheeded)
suppressions were in force, in case the user intended for one of
the relevant suppressions to apply to the warning(s) in question.
This will alert the user to the lack of support for that
suppression in this gcc (ie, either to the user'...