This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: gcc -Wunreachable-code option
- From: Ian Lance Taylor <iant at google dot com>
- To: Vijayaraghavan Murali <vijayaraghavan2k5 at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 25 May 2011 06:21:52 -0700
- Subject: Re: gcc -Wunreachable-code option
- References: <31698329.post@talk.nabble.com>
Vijayaraghavan Murali <vijayaraghavan2k5@gmail.com> writes:
> I'm trying to make gcc generate warnings for detecting unreachable code
> in a program using -Wunreachable-code. But it simply doesn't seem to
> work, even for a simple program such as:
> int main() { return 1; return 0; }
>
> I don't find -Wunreachable-code in man gcc, but it doesn't complain if I
> pass the option to it.
>
> I must be clearly missing something trivial here and would appreciate
> any help. I'm using gcc 4.5.2 and installed gcc-opt, if it matters.
The -Wunreachable-code has been removed, because it was unstable: it
relied on the optimizer, and so different versions of gcc would warn
about different code. The compiler still accepts and ignores the
command line option so that existing Makefiles are not broken. In some
future release the option will be removed entirely.
Ian