[llvm] r278909 - Restrict the use of the C++17 attribute to C++17 (at least as best we
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 17 09:44:22 PDT 2016
Chandler Carruth via llvm-commits <llvm-commits at lists.llvm.org> writes:
> 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.
Maybe we should just swap the order of attribute checks and prefer
clang::fallthrough if it's available? That one obviously doesn't warn
about being a C++17 extension.
> 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]]
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list