[PATCH] D61619: Make language option `GNUAsm` discoverable with `__has_extension` macro.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 13 15:09:57 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rC360625: Make language option `GNUAsm` discoverable with `__has_extension` macro. (authored by vsapsai, committed by ).
Herald added a project: clang.

Changed prior to commit:
  https://reviews.llvm.org/D61619?vs=198363&id=199339#toc

Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61619/new/

https://reviews.llvm.org/D61619

Files:
  include/clang/Basic/Features.def
  test/Parser/asm.c
  test/Parser/no-gnu-inline-asm.c


Index: include/clang/Basic/Features.def
===================================================================
--- include/clang/Basic/Features.def
+++ include/clang/Basic/Features.def
@@ -248,6 +248,7 @@
 EXTENSION(overloadable_unmarked, true)
 EXTENSION(pragma_clang_attribute_namespaces, true)
 EXTENSION(pragma_clang_attribute_external_declaration, true)
+EXTENSION(gnu_asm, LangOpts.GNUAsm)
 
 #undef EXTENSION
 #undef FEATURE
Index: test/Parser/no-gnu-inline-asm.c
===================================================================
--- test/Parser/no-gnu-inline-asm.c
+++ test/Parser/no-gnu-inline-asm.c
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 %s -triple i686-apple-darwin -verify -fsyntax-only -fno-gnu-inline-asm
 
+#if __has_extension(gnu_asm)
+#error Expected extension 'gnu_asm' to be disabled
+#endif
+
 asm ("INST r1, 0"); // expected-error {{GNU-style inline assembly is disabled}}
 
 void foo() __asm("__foo_func"); // AsmLabel is OK
Index: test/Parser/asm.c
===================================================================
--- test/Parser/asm.c
+++ test/Parser/asm.c
@@ -1,5 +1,9 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
+#if !__has_extension(gnu_asm)
+#error Extension 'gnu_asm' should be available by default
+#endif
+
 void f1() {
   // PR7673: Some versions of GCC support an empty clobbers section.
   asm ("ret" : : :);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61619.199339.patch
Type: text/x-patch
Size: 1348 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190513/557631a6/attachment.bin>


More information about the cfe-commits mailing list