This is the mail archive of the 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]
Other format: [Raw text]

Re: [RFC] warning: initialization discards qualifiers from pointertarget type

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, 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,

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