This is the mail archive of the
mailing list for the GCC project.
Re: [RFC] warning: initialization discards qualifiers from pointertarget type
Devang Patel wrote:
On Apr 18, 2005, at 6:29 PM, James E Wilson wrote:
I notice that these are pedwarns,
In that case, we can enable it only when -pedantic is used (like many
Consider this small modification to your testcase.
const char *a( void )
int main( void )
char *s = a();
s = 'c';
This will core dump when run on any system that write-protects read-only
data. The only warning that you will get from gcc is the one that you
are asking us to disable. This is the reason for the warning, as it is
necessary to detect unsafe code like this.
I don't believe this warning should depend on -pedantic, as it is doing
something useful. I think a special -Wno- option makes more sense.
I was going to ask why you need this change, but you already answered
that question. If I had a customer getting 55k+ warnings, I'd want to
add an option for them also.
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com