From f9d04a96b57ad5f68259b978983289043ae22716 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 4 Apr 2014 15:05:10 +0200 Subject: [PATCH] Features: Add cxx_variadic_macros. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 2 ++ Source/cmMakefile.cxx | 1 + Tests/CompileFeatures/cxx_variadic_macros.cpp | 12 ++++++++++++ 4 files changed, 20 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_variadic_macros.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index 55521d9b9..7b94560d4 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -167,6 +167,11 @@ The features known to this version of CMake are: .. _N2765: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf +``cxx_variadic_macros`` + Variadic macros, as defined in N1653_. + + .. _N1653: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm + ``cxx_variadic_templates`` Variadic templates, as defined in N2242_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index a3b43390b..df34b7a17 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -60,4 +60,6 @@ set(_cmake_feature_test_cxx_rvalue_references "${GNU43_CXX11}") set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}") # TODO: Should be supported since GNU 3.4? set(_cmake_feature_test_cxx_extern_templates "${_oldestSupported} && __cplusplus >= 201103L") +# TODO: Should be supported forever? +set(_cmake_feature_test_cxx_variadic_macros "${_oldestSupported} && __cplusplus >= 201103L") set(_oldestSupported) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 65f9594b7..a5a76c8ab 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -73,6 +73,7 @@ F(cxx_uniform_initialization) \ F(cxx_unrestricted_unions) \ F(cxx_user_literals) \ + F(cxx_variadic_macros) \ F(cxx_variadic_templates) class cmMakefile::Internals diff --git a/Tests/CompileFeatures/cxx_variadic_macros.cpp b/Tests/CompileFeatures/cxx_variadic_macros.cpp new file mode 100644 index 000000000..4d007a536 --- /dev/null +++ b/Tests/CompileFeatures/cxx_variadic_macros.cpp @@ -0,0 +1,12 @@ + +int someFunc(int, char, int) +{ + return 0; +} + +#define FUNC_WRAPPER(...) someFunc(__VA_ARGS__) + +void otherFunc() +{ + FUNC_WRAPPER(42, 'a', 7); +}