[cfe-commits] [Patch] Warn about C90 doubly-qualified types in more situations
Eli Friedman
eli.friedman at gmail.com
Mon Apr 2 08:20:07 PDT 2012
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++.
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
__restrict.
Does this patch do the right thing for array types? At first glace,
it looks like it doesn't.
-Eli
More information about the cfe-commits
mailing list