<div dir="ltr">LGTM.<div><br></div><div>-Eli</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 30, 2013 at 12:35 AM, Peter N Lewis <span dir="ltr"><<a href="mailto:peter@stairways.com.au" target="_blank">peter@stairways.com.au</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 30/08/2013, at 10:12 , Eli Friedman <<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>> wrote:<br>

> On Thu, Aug 29, 2013 at 6:58 PM, Peter N Lewis <<a href="mailto:peter@stairways.com.au">peter@stairways.com.au</a>> wrote:<br>
> On 30/08/2013, at 6:34 , Eli Friedman <<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>> wrote:<br>
> > +// RUNNOT: %clang_cc1 -fsyntax-only -verify %s -DZEROARGS -Wgnu-zero-variadic-macro-arguments<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-zero-line-directive<br>
> ><br>
> > I haven't seen RUNNOT before; is that some sort of new syntax?<br>
><br>
> They are just disabled RUN statements - disabled by default to cut down on excessive invocations of the tests.  If there is a better syntax to indicate "you could run this test if you want to, but we wont run it every time for everyone", let me know.  I initially tried // DONTRUN: but that still runs (I guess the parser looks for RUN:).<br>

><br>
> Please don't make it looks like a RUN command if it isn't intended to run.  You can just make a list with a header like "additional tests" and have a list of unprefixed commands.<br>
<br>
</div></div>OK, changed.<br>
<div class="im"><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>
</div>@@ -0,0 +1,56 @@<br>
<div class="im">+// 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 \<br>
+// RUN:   -Wgnu-imaginary-constant -Wgnu-binary-literal -Wgnu-zero-line-directive<br>
+// RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wgnu \<br>
+// RUN:   -Wno-gnu-zero-variadic-macro-arguments \<br>
+// RUN:   -Wno-gnu-imaginary-constant -Wno-gnu-binary-literal -Wno-gnu-zero-line-directive<br>
</div>+// Additional disabled tests:<br>
+// %clang_cc1 -fsyntax-only -verify %s -DZEROARGS -Wgnu-zero-variadic-macro-arguments<br>
+// %clang_cc1 -fsyntax-only -verify %s -DIMAGINARYCONST -Wgnu-imaginary-constant<br>
+// %clang_cc1 -fsyntax-only -verify %s -DBINARYLITERAL -Wgnu-binary-literal<br>
+// %clang_cc1 -fsyntax-only -verify %s -DLINE0 -Wgnu-zero-line-directive<br>
<div><div class="h5">+<br>
+#if NONE<br>
+// expected-no-diagnostics<br>
+#endif<br>
+<br>
+<br>
+#if ALL || ZEROARGS<br>
+// expected-warning@+9 {{must specify at least one argument for '...' parameter of variadic macro}}<br>
+// expected-note@+4 {{macro 'efoo' defined here}}<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" target="_blank">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>
</div></div>--- include/clang/Basic/DiagnosticGroups.td     (revision 189654)<br>
<div><div class="h5">+++ 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>
@@ -369,6 +371,8 @@<br>
 def VolatileRegisterVar : DiagGroup<"volatile-register-var">;<br>
 def Visibility : DiagGroup<"visibility">;<br>
 def ZeroLengthArray : DiagGroup<"zero-length-array">;<br>
+def GNUZeroLineDirective : DiagGroup<"gnu-zero-line-directive">;<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>
@@ -535,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>
+                            GNUImaginaryConstant, GNULabelsAsValue,<br>
                             GNUStatementExpression, GNUStaticFloatInit,<br>
-                            ZeroLengthArray]>;<br>
+                            ZeroLengthArray,<br>
+                            GNUZeroLineDirective, 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>
</div></div>--- include/clang/Basic/DiagnosticLexKinds.td   (revision 189654)<br>
<div class="HOEnZb"><div class="h5">+++ include/clang/Basic/DiagnosticLexKinds.td   (working copy)<br>
@@ -167,7 +167,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>
@@ -175,7 +175,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>
@@ -322,7 +322,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>
@@ -457,7 +457,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<GNUZeroVariadicMacroArguments>;<br>
 def err_unterm_macro_invoc : Error<<br>
   "unterminated function-like macro invocation">;<br>
 def err_too_many_args_in_macro_invoc : Error<<br>
@@ -482,7 +482,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<GNUZeroLineDirective>;<br>
 def err_pp_line_invalid_filename : Error<<br>
   "invalid filename for #line directive">;<br>
 def warn_pp_line_decimal : Warning<<br>
<br>
<br>
</div></div><br><br>
<br>
<br></blockquote></div><br></div>