r360625 - Make language option `GNUAsm` discoverable with `__has_extension` macro.
Volodymyr Sapsai via cfe-commits
cfe-commits at lists.llvm.org
Mon May 13 15:11:10 PDT 2019
Author: vsapsai
Date: Mon May 13 15:11:10 2019
New Revision: 360625
URL: http://llvm.org/viewvc/llvm-project?rev=360625&view=rev
Log:
Make language option `GNUAsm` discoverable with `__has_extension` macro.
This can be used for better support of `-fno-gnu-inline-asm` builds.
rdar://problem/49540880
Reviewers: aaron.ballman, rsmith
Reviewed By: aaron.ballman
Subscribers: eraman, jkorous, dexonsmith, craig.topper, cfe-commits
Differential Revision: https://reviews.llvm.org/D61619
Modified:
cfe/trunk/include/clang/Basic/Features.def
cfe/trunk/test/Parser/asm.c
cfe/trunk/test/Parser/no-gnu-inline-asm.c
Modified: cfe/trunk/include/clang/Basic/Features.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Features.def?rev=360625&r1=360624&r2=360625&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Features.def (original)
+++ cfe/trunk/include/clang/Basic/Features.def Mon May 13 15:11:10 2019
@@ -248,6 +248,7 @@ EXTENSION(cxx_variable_templates, LangOp
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
Modified: cfe/trunk/test/Parser/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/asm.c?rev=360625&r1=360624&r2=360625&view=diff
==============================================================================
--- cfe/trunk/test/Parser/asm.c (original)
+++ cfe/trunk/test/Parser/asm.c Mon May 13 15:11:10 2019
@@ -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" : : :);
Modified: cfe/trunk/test/Parser/no-gnu-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/no-gnu-inline-asm.c?rev=360625&r1=360624&r2=360625&view=diff
==============================================================================
--- cfe/trunk/test/Parser/no-gnu-inline-asm.c (original)
+++ cfe/trunk/test/Parser/no-gnu-inline-asm.c Mon May 13 15:11:10 2019
@@ -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
More information about the cfe-commits
mailing list