This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Ansi violation ?
- To: llewelly at edevnull dot com
- Subject: Re: Ansi violation ?
- From: Marc Olzheim <marcolz at stack dot nl>
- Date: Tue, 5 Sep 2000 19:58:57 +0200
- Cc: Marc Olzheim <marcolz at stack dot nl>, bug-gcc at gnu dot org
- References: <20000904171049.A75313@stack.nl> <m1n1hmhkmp.fsf@edevnull.com>
> Marc Olzheim <marcolz@stack.nl> writes:
>
> > Version:
> > gcc 2.95.2 on FreeBSD 4.1
> >
> > For 2.7.2.3 it works ok.
> >
> > commandline:
> > gcc -c -o const.o -Wcast-qual -ansi const.c
>
> >From http://gcc.gnu.org/onlinedocs/gcc_2.html#SEC9
>
> -Wcast-qual
> Warn whenever a pointer is cast so as to remove a type
> qualifier from the target type. For example, warn if a const
> char * is cast to an ordinary char *.
>
> If you remove the flag -Wcast-qual, the warning disappears.
*Duh*
I _want_ to see warnings about (wrong) casts, but I do not want gcc to warn
when it should not...
I compile all my sources with:
-Wall -W -Wpointer-arith -Wshadow -pipe -Wbad-function-cast -Wcast-qual
-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
-Wwrite-strings -Werror -pedantic-errors -ansi -trigraphs -fsigned-char
and it's always worked for me. I'm not about to adapt my warning levels
just because of some bug in gcc-2.95.2...
I admit that it's a disgusting "feature" and that there are other ways
to work around it, but this simply breaks the ANSI compatibility of gcc.
Marc