[PATCH]: Fix problematic -Wcast-qual cases using new CONST_CAST macro

DJ Delorie dj@redhat.com
Mon Aug 6 18:11:00 GMT 2007


> It would do, if it was finished.  I don't know where that stands.
> Perhaps DJ could give us an update.

It got bogged down in arguments about how expression-specific warning
settings would work, and inlined functions with different warning
sets.  Then it got into statement-specific warning changesets and
deltas.  We never got around to implementing any of the compromises.

Currently, you can wrap a function with the pragmas and sometimes it
works the way you want, especially if you disable whole-file
optimizations and tree inlining ;-)

Thus, we only allow (I don't know if it's enforced) the pragmas before
the first function definition.

I think technically we can keep track of the changes efficiently, if
we have "change point" data structures that have the warning number,
new action, and a pointer to the previous change point.  That's 12
bytes per #pragma, with a little more work when you actually print a
message (to follow the chain back to find the most recent change for
that warning, or to the beginning, where we use the master table).

That also allows us to push/pop by just starting a new chain at some
previous change point.  Scoping would do the same thing.  No need for
forward pointers, just the back pointers.

The hard part is mapping a "where" in the code with a "where" in the
change point chain.



More information about the Gcc-patches mailing list