[cfe-commits] [Patch] Warn about C90 doubly-qualified types in more situations
Tim.Northover at arm.com
Mon Apr 2 09:28:58 PDT 2012
On Monday 02 Apr 2012 16:20:07 Eli Friedman wrote:
> On Mon, Apr 2, 2012 at 7:01 AM, Tim Northover <Tim.Northover at arm.com> wrote:
> > Hi,
> > C90 annoyingly requires a diagnostic to be produced for any type that
> > ends up with two copies of the same type-qualifier. This warning is
> > already produced for cases which can be detected during parsing, but
> > when it happens via a typedef Sema needs to be involved.
> > I believe this patch implements the correct note, though I was uncertain
> > how best to test for C90 only compilation: is !C99 && !C++ & !ObjC
> > correct?
> You don't need to check for Objective-C explicitly; it usually just
> follows the rules for the corresponding C version. Otherwise, the
> check is correct: you just need to check for not-C99 and not-C++.
Thanks. That's worth knowing.
> I don't see the point of the check for restrict; it isn't possible to
> write "restrict" in C89 mode, and the standard doesn't constrain
I did dither about that, happy to remove the diagnostic in that case.
> Err, nevermind about array types; I expect that this does the right
> thing for such types.
Phew! I was scratching my head trying to work out whether the patch,
understanding of the standard or both were wrong.
I've attached an updated patch with your feedback (and some specific array
tests I was fiddling with, just in case).
Could you commit it if it's OK?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2916 bytes
Desc: not available
More information about the cfe-commits