Add a __nowarn__ keyword

Kaveh R. GHAZI ghazi@caip.rutgers.edu
Wed Aug 8 22:41:00 GMT 2007


On Wed, 8 Aug 2007, DJ Delorie wrote:

> "Kaveh R. GHAZI" <ghazi@caip.rutgers.edu> writes:
> > 	extern __inline void *CONST_CAST(const void *cv)
> > 	{
> > 	  return (void *)cv;
> > 	}
> > 	//#pragma GCC diagnostic error "-Wcast-qual"
>
> We don't really support changing the diagnostics *after* you start
> defining functions.  If that happens to work at all, it's only by
> coincidence, especially with file-at-a-time optimizations and tree
> inlining.
>
> Push/pop functionality would have to be implemented along with a
> scheme to actually track per-function diagnostic settings, which we
> don't have.  Then we start getting into the "can I disable warnings
> for this statement?" type requests.
>
> The current design is intended to provide, for example, project-wide
> defaults and policy settings, which work with things like -Wall
> -Werror to tailor the global defaults to project-specfic needs, or
> file-specific exceptions to them.
>
> So, always put those pragmas before any function definitions.

If you're saying that, by design, your pragma interface only allows a
once-per-file setting that must come before all function definitions, then
it isn't suited to do what I want.  I need something that allows
per-statement warning silence, then reset to whatever was before, and then
do that as many times as necessary.

In light of that, I request that either the __nowarn__ patch be accepted,
or the original union-hack patch be accepted.  I actually prefer the
union-hack without the nowarn because I'd rather not introduce a new
feature (with the inherent support issues and/or bugs) unless absolutely
necessary.  But I need one or the other.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			ghazi@caip.rutgers.edu



More information about the Gcc-patches mailing list