<p dir="ltr"><br>
On Aug 24, 2013 2:39 AM, "Peter N Lewis" <<a href="mailto:peter@stairways.com.au">peter@stairways.com.au</a>> wrote:<br>
><br>
> Ping.<br>
><br>
> Eli queried whether -Wgnu-zero-variadic-macro-argumentsand -Wgnu-token-pasting-comma should be a single flag (which is fine with me, but then what to call it) and questioned whether -Wgnu-line-zero-directive is correct as 'it isn't really a "line-zero" directive', which I didn't quite follow, but I'm happy to change it if anyone else has a better name.</p>

<p dir="ltr">Bes guess on an alternative name would be 'zero line directive' (a line directive that is zero, rather than a 'line zero' directive)</p>
<p dir="ltr">><br>
> Thanks,<br>
>    Peter.<br>
><br>
> On 21/08/2013, at 21:10 , Peter N Lewis <<a href="mailto:peter@stairways.com.au">peter@stairways.com.au</a>> wrote:<br>
><br>
> > Here is batch two of the specific gnu flags.  This patch adds the following flags:<br>
> ><br>
> > -Wgnu-zero-variadic-macro-arguments<br>
> > -Wgnu-token-pasting-comma<br>
> > -Wgnu-imaginary-constant<br>
> > -Wgnu-binary-literal<br>
> > -Wgnu-line-zero-directive<br>
> ><br>
> > I'm not overly convinced on the exact naming of the flags, but they were the best I could come up with. I'd be happy to hear any thoughts.<br>
> ><br>
> > The patch includes a test with four invocations, and another five disabled by default.<br>
> ><br>
> ><br>
> > Index: test/Lexer/gnu-flags.c<br>
> > ===================================================================<br>
> > --- test/Lexer/gnu-flags.c    (revision 0)<br>
> > +++ test/Lexer/gnu-flags.c    (revision 0)<br>
> > @@ -0,0 +1,58 @@<br>
> > +// RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE<br>
> > +// RUN: %clang_cc1 -fsyntax-only -verify %s -DALL -Wgnu<br>
> > +// RUN: %clang_cc1 -fsyntax-only -verify %s -DALL \<br>
> > +// RUN:   -Wgnu-zero-variadic-macro-arguments -Wgnu-token-pasting-comma \<br>
> > +// RUN:   -Wgnu-imaginary-constant -Wgnu-binary-literal -Wgnu-line-zero-directive<br>
> > +// RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wgnu \<br>
> > +// RUN:   -Wno-gnu-zero-variadic-macro-arguments -Wno-gnu-token-pasting-comma \<br>
> > +// RUN:   -Wno-gnu-imaginary-constant -Wno-gnu-binary-literal -Wno-gnu-line-zero-directive<br>
> > +// RUNNOT: %clang_cc1 -fsyntax-only -verify %s -DZEROARGS -Wgnu-zero-variadic-macro-arguments<br>
> > +// RUNNOT: %clang_cc1 -fsyntax-only -verify %s -DTOKENPASTING -Wgnu-token-pasting-comma<br>
> > +// RUNNOT: %clang_cc1 -fsyntax-only -verify %s -DIMAGINARYCONST -Wgnu-imaginary-constant<br>
> > +// RUNNOT: %clang_cc1 -fsyntax-only -verify %s -DBINARYLITERAL -Wgnu-binary-literal<br>
> > +// RUNNOT: %clang_cc1 -fsyntax-only -verify %s -DLINE0 -Wgnu-line-zero-directive<br>
> > +<br>
> > +#if NONE<br>
> > +// expected-no-diagnostics<br>
> > +#endif<br>
> > +<br>
> > +<br>
> > +#if ALL || ZEROARGS<br>
> > +// expected-warning@+11 {{must specify at least one argument for '...' parameter of variadic macro}}<br>
> > +// expected-note@+6 {{macro 'efoo' defined here}}<br>
> > +#endif<br>
> > +#if ALL || TOKENPASTING<br>
> > +// expected-warning@+3 {{token pasting of ',' and __VA_ARGS__ is a GNU extension}}<br>
> > +#endif<br>
> > +<br>
> > +#define efoo(format, args...) foo(format , ##args)<br>
> > +<br>
> > +void foo( const char* c )<br>
> > +{<br>
> > +  efoo("6");<br>
> > +}<br>
> > +<br>
> > +<br>
> > +#if ALL || IMAGINARYCONST<br>
> > +// expected-warning@+3 {{imaginary constants are a GNU extension}}<br>
> > +#endif<br>
> > +<br>
> > +float _Complex c = 1.if;<br>
> > +<br>
> > +<br>
> > +#if ALL || BINARYLITERAL<br>
> > +// expected-warning@+3 {{binary integer literals are a GNU extension}}<br>
> > +#endif<br>
> > +<br>
> > +int b = 0b0101;<br>
> > +<br>
> > +<br>
> > +// This case is handled differently because lit has a bug whereby #line 0 is reported to be on line 4294967295<br>
> > +// <a href="http://llvm.org/bugs/show_bug.cgi?id=16952">http://llvm.org/bugs/show_bug.cgi?id=16952</a><br>
> > +#if ALL || LINE0<br>
> > +#line 0 // expected-warning {{#line directive with zero argument is a GNU extension}}<br>
> > +#else<br>
> > +#line 0<br>
> > +#endif<br>
> > +<br>
> > +// WARNING: Do not add more tests after the #line 0 line!  Add them before the LINE0 test<br>
> > Index: include/clang/Basic/DiagnosticGroups.td<br>
> > ===================================================================<br>
> > --- include/clang/Basic/DiagnosticGroups.td   (revision 188870)<br>
> > +++ include/clang/Basic/DiagnosticGroups.td   (working copy)<br>
> > @@ -28,6 +28,7 @@<br>
> > def Availability : DiagGroup<"availability">;<br>
> > def Section : DiagGroup<"section">;<br>
> > def AutoImport : DiagGroup<"auto-import">;<br>
> > +def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">;<br>
> > def BitFieldConstantConversion : DiagGroup<"bitfield-constant-conversion">;<br>
> > def ConstantConversion :<br>
> >   DiagGroup<"constant-conversion", [ BitFieldConstantConversion ] >;<br>
> > @@ -152,6 +153,7 @@<br>
> > def DanglingElse: DiagGroup<"dangling-else">;<br>
> > def DanglingField : DiagGroup<"dangling-field">;<br>
> > def DistributedObjectModifiers : DiagGroup<"distributed-object-modifiers">;<br>
> > +def GNUImaginaryConstant : DiagGroup<"gnu-imaginary-constant">;<br>
> > def IgnoredQualifiers : DiagGroup<"ignored-qualifiers">;<br>
> > def : DiagGroup<"import">;<br>
> > def IncompatiblePointerTypesDiscardsQualifiers<br>
> > @@ -168,6 +170,7 @@<br>
> > def : DiagGroup<"inline">;<br>
> > def : DiagGroup<"invalid-pch">;<br>
> > def GNULabelsAsValue : DiagGroup<"gnu-label-as-value">;<br>
> > +def GNULineZeroDirective : DiagGroup<"gnu-line-zero-directive">;<br>
> > def LiteralRange : DiagGroup<"literal-range">;<br>
> > def LocalTypeTemplateArgs : DiagGroup<"local-type-template-args",<br>
> >                                       [CXX98CompatLocalTypeTemplateArgs]>;<br>
> > @@ -260,6 +263,7 @@<br>
> > def TautologicalOutOfRangeCompare : DiagGroup<"tautological-constant-out-of-range-compare">;<br>
> > def TautologicalCompare : DiagGroup<"tautological-compare",<br>
> >                                     [TautologicalOutOfRangeCompare]>;<br>
> > +def GNUTokenPastingComma : DiagGroup<"gnu-token-pasting-comma">;<br>
> > def HeaderHygiene : DiagGroup<"header-hygiene">;<br>
> > def DuplicateDeclSpecifier : DiagGroup<"duplicate-decl-specifier">;<br>
> > def CompareDistinctPointerType : DiagGroup<"compare-distinct-pointer-types">;<br>
> > @@ -368,6 +372,7 @@<br>
> > def VolatileRegisterVar : DiagGroup<"volatile-register-var">;<br>
> > def Visibility : DiagGroup<"visibility">;<br>
> > def ZeroLengthArray : DiagGroup<"zero-length-array">;<br>
> > +def GNUZeroVariadicMacroArguments : DiagGroup<"gnu-zero-variadic-macro-arguments">;<br>
> ><br>
> > // GCC calls -Wdeprecated-writable-strings -Wwrite-strings.<br>
> > def GCCWriteStrings : DiagGroup<"write-strings" , [DeprecatedWritableStr]>;<br>
> > @@ -534,14 +539,15 @@<br>
> > def C99 : DiagGroup<"c99-extensions">;<br>
> ><br>
> > // A warning group for warnings about GCC extensions.<br>
> > -def GNU : DiagGroup<"gnu", [GNUAlignofExpression, GNUCaseRange,<br>
> > -                            GNUComplexInteger,<br>
> > +def GNU : DiagGroup<"gnu", [GNUAlignofExpression, GNUBinaryLiteral,<br>
> > +                            GNUCaseRange, GNUComplexInteger,<br>
> >                             GNUConditionalOmittedOperand,<br>
> >                             GNUDesignator, GNUEmptyInitializer,<br>
> >                             VLAExtension,<br>
> > -                            GNULabelsAsValue,<br>
> > -                            GNUStatementExpression, GNUStaticFloatInit,<br>
> > -                            ZeroLengthArray]>;<br>
> > +                            GNUImaginaryConstant, GNULabelsAsValue,<br>
> > +                            GNULineZeroDirective, GNUStatementExpression,<br>
> > +                            GNUStaticFloatInit, GNUTokenPastingComma,<br>
> > +                            ZeroLengthArray, GNUZeroVariadicMacroArguments]>;<br>
> > // A warning group for warnings about code that clang accepts but gcc doesn't.<br>
> > def GccCompat : DiagGroup<"gcc-compat">;<br>
> ><br>
> > Index: include/clang/Basic/DiagnosticLexKinds.td<br>
> > ===================================================================<br>
> > --- include/clang/Basic/DiagnosticLexKinds.td (revision 188870)<br>
> > +++ include/clang/Basic/DiagnosticLexKinds.td (working copy)<br>
> > @@ -165,7 +165,7 @@<br>
> >   "Unicode character literals may not contain multiple characters">;<br>
> > def err_exponent_has_no_digits : Error<"exponent has no digits">;<br>
> > def ext_imaginary_constant : Extension<<br>
> > -  "imaginary constants are a GNU extension">, InGroup<GNU>;<br>
> > +  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;<br>
> > def err_hexconstant_requires_exponent : Error<<br>
> >   "hexadecimal floating constants require an exponent">;<br>
> > def err_hexconstant_requires_digits : Error<<br>
> > @@ -173,7 +173,7 @@<br>
> > def ext_hexconstant_invalid : Extension<<br>
> >   "hexadecimal floating constants are a C99 feature">, InGroup<C99>;<br>
> > def ext_binary_literal : Extension<<br>
> > -  "binary integer literals are a GNU extension">, InGroup<GNU>;<br>
> > +  "binary integer literals are a GNU extension">, InGroup<GNUBinaryLiteral>;<br>
> > def ext_binary_literal_cxx1y : Extension<<br>
> >   "binary integer literals are a C++1y extension">, InGroup<CXX1y>;<br>
> > def warn_cxx11_compat_binary_literal : Warning<<br>
> > @@ -320,7 +320,7 @@<br>
> >   InGroup<DiagGroup<"embedded-directive">>;<br>
> > def ext_missing_varargs_arg : Extension<<br>
> >   "must specify at least one argument for '...' parameter of variadic macro">,<br>
> > -  InGroup<GNU>;<br>
> > +  InGroup<GNUZeroVariadicMacroArguments>;<br>
> > def ext_empty_fnmacro_arg : Extension<<br>
> >   "empty macro arguments are a C99 feature">, InGroup<C99>;<br>
> > def warn_cxx98_compat_empty_fnmacro_arg : Warning<<br>
> > @@ -455,7 +455,7 @@<br>
> >   "'##' cannot appear at start of macro expansion">;<br>
> > def err_paste_at_end : Error<"'##' cannot appear at end of macro expansion">;<br>
> > def ext_paste_comma : Extension<<br>
> > -  "token pasting of ',' and __VA_ARGS__ is a GNU extension">, InGroup<GNU>;<br>
> > +  "token pasting of ',' and __VA_ARGS__ is a GNU extension">, InGroup<GNUTokenPastingComma>;<br>
> > def err_unterm_macro_invoc : Error<<br>
> >   "unterminated function-like macro invocation">;<br>
> > def err_too_many_args_in_macro_invoc : Error<<br>
> > @@ -480,7 +480,7 @@<br>
> >   "#line directive requires a positive integer argument">;<br>
> > def ext_pp_line_zero : Extension<<br>
> >   "#line directive with zero argument is a GNU extension">,<br>
> > -  InGroup<GNU>;<br>
> > +  InGroup<GNULineZeroDirective>;<br>
> > def err_pp_line_invalid_filename : Error<<br>
> >   "invalid filename for #line directive">;<br>
> > def warn_pp_line_decimal : Warning<<br>
> ><br>
> > <gnu-lex-flags.diff><br>
> ><br>
> > --<br>
> > Keyboard Maestro 6.1 now out - set web checkboxes & radio buttons, exit from loops, and more.<br>
> ><br>
> > Keyboard Maestro <<a href="http://www.keyboardmaestro.com/">http://www.keyboardmaestro.com/</a>> Macros for your Mac<br>
> > <<a href="http://www.stairways.com/">http://www.stairways.com/</a>>           <<a href="http://download.keyboardmaestro.com/">http://download.keyboardmaestro.com/</a>><br>
> ><br>
> > _______________________________________________<br>
> > cfe-commits mailing list<br>
> > <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
><br>
> --<br>
> Keyboard Maestro 6.2 now out - control Mail, reveal a file, format AppleScripts and more.<br>
><br>
> Keyboard Maestro <<a href="http://www.keyboardmaestro.com/">http://www.keyboardmaestro.com/</a>> Macros for your Mac<br>
> <<a href="http://www.stairways.com/">http://www.stairways.com/</a>>           <<a href="http://download.keyboardmaestro.com/">http://download.keyboardmaestro.com/</a>><br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</p>