[PATCH] explicit GNU flags

Eli Friedman eli.friedman at gmail.com
Fri Aug 16 14:22:09 PDT 2013


On Fri, Aug 16, 2013 at 2:39 AM, Peter N Lewis <peter at stairways.com.au>wrote:

> This patch supersedes my previous patch and defines explicit flags for
> each of the eight remaining generic -gnu features.
>
> Flags are:
>
>         -gnu-alignof-expression
>         -gnu-case-range
>         -gnu-complex-integer
>         -gnu-conditional-omitted-operand
>         -gnu-empty-initializer
>         -gnu-label-as-value
>         -gnu-local-label
>         -gnu-statement-expression
>
> I would have preferred to do each as an independent patch, but because
> they all touch the "def GNU : DiagGroup" line they would conflict which
> each other unless applied in exactly the right order. They are all related
> in any event, simply adding explicit control over the features covered by
> -gnu.
>
> For conditional-omitted-operand, I changed the error message slightly,
> from:
>
>         use of GNU ?: expression extension, eliding middle term
>
> to
>
>         use of GNU ?: conditional expression extension, omitting middle
> operand
>
> to better match the GCC documentation of the feature and hence the flag
> name.
>
> gnu-label-as-value covers both errors "use of GNU address-of-label
> extension" and "use of GNU indirect-goto extension" as it would seem to me
> that one is useless without the other, so they are functionally the same
> feature.
>
> There does not seem to be any way to get the "use of GNU empty initializer
> extension" warning without also getting some other warning (such as "zero
> size arrays are an extension").
>
> There are test cases for each of the flags.
>
> I'd like to move on to some other similar patches now, so hopefully I can
> get either approval of this patch or some feedback or something.
>
>
diag::ext_gnu_local_label shouldn't exist; it's not something we need to
diagnose.

You can trigger ext_gnu_empty_initializer with "struct { int x; } x = {};"

It would be nice if you could avoid adding thirty invocations of clang to
the regression tests; we rely on them to run quickly.

-Eli
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130816/735d71e8/attachment.html>


More information about the cfe-commits mailing list