[llvm] r278909 - Restrict the use of the C++17 attribute to C++17 (at least as best we

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 00:18:44 PDT 2016


Author: chandlerc
Date: Wed Aug 17 02:18:44 2016
New Revision: 278909

URL: http://llvm.org/viewvc/llvm-project?rev=278909&view=rev
Log:
Restrict the use of the C++17 attribute to C++17 (at least as best we
can given the current __cplusplus definitions).

Without this, Clang triggers TONS of warnings about using a C++17
extension. I tried using LLVM_EXTENSION to turn these off and it doesn't
work.

Suggestions on a better approach are welcome, but at least this makes
the build usable for me again.

Modified:
    llvm/trunk/include/llvm/Support/Compiler.h

Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=278909&r1=278908&r2=278909&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Wed Aug 17 02:18:44 2016
@@ -233,7 +233,7 @@
 #endif
 
 /// LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
-#if __has_cpp_attribute(fallthrough)
+#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
 #define LLVM_FALLTHROUGH [[fallthrough]]
 #elif __has_cpp_attribute(clang::fallthrough)
 #define LLVM_FALLTHROUGH [[clang::fallthrough]]




More information about the llvm-commits mailing list