This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Ansi violation ?


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]