[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 6 16:13:20 PDT 2019
vsapsai created this revision.
vsapsai added reviewers: aaron.ballman, rsmith.
Herald added subscribers: dexonsmith, jkorous, eraman.
This can be used for better support of `-fno-gnu-inline-asm` builds.
rdar://problem/49540880
https://reviews.llvm.org/D61619
Files:
clang/include/clang/Basic/Features.def
clang/test/Parser/asm.c
clang/test/Parser/no-gnu-inline-asm.c
Index: clang/test/Parser/no-gnu-inline-asm.c
===================================================================
--- clang/test/Parser/no-gnu-inline-asm.c
+++ clang/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: clang/test/Parser/asm.c
===================================================================
--- clang/test/Parser/asm.c
+++ clang/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" : : :);
Index: clang/include/clang/Basic/Features.def
===================================================================
--- clang/include/clang/Basic/Features.def
+++ clang/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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61619.198363.patch
Type: text/x-patch
Size: 1402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190506/15406c5b/attachment-0001.bin>
More information about the cfe-commits
mailing list