Eli,

I have updated the patch. Now I use language-extension-token parameter to
suppress the warning "extension used".

Is it fine now? Alternatively, I can introduce more fine-grained warning
asm-token with higher priority than ext_token_used.
So far, ext_token_used complains about the following tokens (see
lib/Basic/IdentifierTable.cpp):

  else if (LangOpts.GNUKeywords && (Flags & KEYGNU)) AddResult = 1;
  else if (LangOpts.MicrosoftExt && (Flags & KEYMS)) AddResult = 1;
  else if (LangOpts.Borland && (Flags & KEYBORLAND)) AddResult = 1;

So, it's GNU, Microsoft and Borland extensions.

On Tue, Oct 4, 2011 at 3:33 PM, Ivan Krasin <[email protected]> wrote:

> like, in my particular case, this warning complains about asm directive,
> which is not a part of ANSI C (-pedantic)
>
>
> On Tue, Oct 4, 2011 at 3:32 PM, Ivan Krasin <[email protected]> wrote:
>
>>
>>
>> On Tue, Oct 4, 2011 at 3:24 PM, Eli Friedman <[email protected]>wrote:
>>
>>> On Tue, Oct 4, 2011 at 11:13 AM, Ivan Krasin <[email protected]>
>>> wrote:
>>> > Hi llvm team!
>>> >
>>> > This patch adds support of -Wno-extension-used to make it possible to
>>> > suppress the warning:
>>> >
>>> > lala.c:1:21: warning: extension used [-pedantic]
>>> > double lala(double) asm("llvm.log.f64");
>>> >
>>> > r140770 has started to promote this warning to error if -Werror is
>>> > specified (which is absolutely correct).
>>> > We have a test that checks some llvm intrinsics and it's not Clangy to
>>> > drop -Werror just because one particular warning is expected.
>>> > I have added the option to suppress this warning and has removed it
>>> > from the test for warnings w/o suppression options.
>>> >
>>> > OK to commit?
>>>
>>> We really ought to clarify what exactly this is warning about and name
>>> the warning group in a more intuitive way.  -Wno-extension-used
>>> doesn't give the user any idea what warning it is actually
>>> suppressing.  I'm drawing a blank as to what exactly to call it,
>>> though.
>>>
>> Hi Eli,
>>
>> It suppresses any language extension used in the program source. I have no
>> preference on how the flag should be named and I have chosen
>> "extension-used" just to fit to the existing warning message:
>>  "warning: extension used [-pedantic]"
>>
>> Probably, a better name would be language-extension or
>> language-extension-used. In this case -Wno-language-extension would give a
>> good idea of what warning does it suppress.
>> Are you fine with any of the options above? Do you have a better idea?
>>
>>
>>> -Eli
>>>
>>
>>
>
Index: test/Misc/warning-flags.c
===================================================================
--- test/Misc/warning-flags.c	(revision 141189)
+++ test/Misc/warning-flags.c	(working copy)
@@ -17,7 +17,7 @@
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (301):
+CHECK: Warnings without flags (300):
 CHECK-NEXT:   backslash_newline_space
 CHECK-NEXT:   charize_microsoft_ext
 CHECK-NEXT:   ext_anon_param_requires_type_specifier
@@ -85,7 +85,6 @@
 CHECK-NEXT:   ext_subscript_non_lvalue
 CHECK-NEXT:   ext_template_arg_extra_parens
 CHECK-NEXT:   ext_thread_before
-CHECK-NEXT:   ext_token_used
 CHECK-NEXT:   ext_top_level_semi
 CHECK-NEXT:   ext_typecheck_addrof_void
 CHECK-NEXT:   ext_typecheck_cast_nonscalar
Index: include/clang/Basic/DiagnosticLexKinds.td
===================================================================
--- include/clang/Basic/DiagnosticLexKinds.td	(revision 141189)
+++ include/clang/Basic/DiagnosticLexKinds.td	(working copy)
@@ -43,7 +43,8 @@
 def ext_dollar_in_identifier : Extension<"'$' in identifier">;
 def charize_microsoft_ext : Extension<"@# is a microsoft extension">;
 
-def ext_token_used : Extension<"extension used">;
+def ext_token_used : Extension<"extension used">,
+  InGroup<DiagGroup<"language-extension-token">>;
 
 def warn_unterminated_string : ExtWarn<"missing terminating '\"' character">;
 def warn_unterminated_char : ExtWarn<"missing terminating ' character">;
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp	(revision 141189)
+++ lib/Driver/Tools.cpp	(working copy)
@@ -2625,6 +2625,7 @@
         .Case("initializer-overrides", true)
         .Case("invalid-noreturn", true)
         .Case("invalid-token-paste", true)
+        .Case("language-extension-token", true)
         .Case("literal-conversion", true)
         .Case("literal-range", true)
         .Case("local-type-template-args", true)
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to