[RFC] warning: initialization discards qualifiers from pointer target type
Devang Patel
dpatel@apple.com
Tue Apr 19 03:35:00 GMT 2005
On Apr 18, 2005, at 6:29 PM, James E Wilson wrote:
> Devang Patel wrote:
>> warning: initialization discards qualifiers from pointer
>> target type
>> This warning can not be disabled using -Wno-cast-qual
>> (or any other warning flags). Is it intentional ?
>
> It looks like we have been doing it this way since at least
> gcc-1.42. The same code is there, with no way to disable it, though
> the wording of the message is a little different. I didn't try
> looking back any farther than that. This seems rather unlikely to
> be an accident.
>
> Though of course, this doesn't mean that we can't have an option to
> control it. -Wno-cast-qual doesn't seem like the right choice, as
> there is no user cast here. Maybe something like -Wno-discard-
> qual, where -Wdiscard-qual is the default.
>
> I notice that these are pedwarns,
In that case, we can enable it only when -pedantic is used (like many
pedwarns) ?
> not a warning as in the -Wcast-qual case, which means that the ISO
> C standard requires a diagnostic here. For this reason, it may not
> be wise to add an option to disable the warnings. You may lose
> portability to other compilers.
> --
> Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
-
Devang
More information about the Gcc
mailing list