diff --git a/doc/headers/variadic/opt.html b/doc/headers/variadic/opt.html index d65d592..586f63e 100644 --- a/doc/headers/variadic/opt.html +++ b/doc/headers/variadic/opt.html @@ -10,7 +10,7 @@
#include <boost/preprocessor/facilities/check_empty.hpp> -# if BOOST_PP_VARIADIC_OPT() +# if BOOST_PP_VARIADIC_HAS_OPT() #define DATA #define OBJECT OBJECT2 diff --git a/doc/ref/variadic_opt.html b/doc/ref/variadic_opt.html index 7057cbc..c2ce540 100644 --- a/doc/ref/variadic_opt.html +++ b/doc/ref/variadic_opt.html @@ -1,15 +1,15 @@ -BOOST_PP_VARIADIC_OPT +BOOST_PP_VARIADIC_HAS_OPT -The BOOST_PP_VARIADIC_OPT macro +The BOOST_PP_VARIADIC_HAS_OPT macro determines whether or not the C++20 __VA_OPT__ construct is supported for the compiler's preprocessor being used. Expands to 1 if the __VA_OPT__ construct is supported, otherwise expands to 0.Usage
-BOOST_PP_VARIADIC_OPT()
+BOOST_PP_VARIADIC_HAS_OPT()
Arguments
@@ -36,7 +36,7 @@ Expands to 1 if the __VA_OPT__ construct is supported, otherwise expands to 0.
See Also#include <boost/preprocessor/variadic/opt.hpp>
-#if BOOST_PP_VARIADIC_OPT() +#if BOOST_PP_VARIADIC_HAS_OPT() // Preprocessor code which uses __VA_OPT__ #else // Preprocessor code which does not use __VA_OPT__ @@ -47,7 +47,7 @@ or within a macro definition
#include <boost/preprocessor/control/iif.hpp> #include <boost/preprocessor/variadic/opt.hpp>diff --git a/doc/syntax.html b/doc/syntax.html index 68dd9f6..3254dea 100644 --- a/doc/syntax.html +++ b/doc/syntax.html @@ -284,7 +284,7 @@
-#define USE_OPT(...) BOOST_PP_IIF(BOOST_PP_VARIADIC_OPT(),MACRO_USING_OPT,MACRO_NOT_USING_OPT)(__VA_ARGS__) +#define USE_OPT(...) BOOST_PP_IIF(BOOST_PP_VARIADIC_HAS_OPT(),MACRO_USING_OPT,MACRO_NOT_USING_OPT)(__VA_ARGS__) #define MACRO_USING_OPT(...) __VA_OPT__( preprocessor tokens ) anything #define MACRO_NOT_USING_OPT(...) anything
BOOST_PP_VALUE
BOOST_PP_VARIADIC_ELEM -
BOOST_PP_VARIADIC_OPT +
BOOST_PP_VARIADIC_HAS_OPT
BOOST_PP_VARIADIC_SIZE
BOOST_PP_VARIADIC_TO_ARRAY
BOOST_PP_VARIADIC_TO_LIST diff --git a/doc/topics/emptiness.html b/doc/topics/emptiness.html index 518da0d..d1494e3 100644 --- a/doc/topics/emptiness.html +++ b/doc/topics/emptiness.html @@ -98,7 +98,7 @@ not publicly appeared. This library uses that code to test for __VA_OPT__ as a necessary prelude for creating a variadic macro which is 100% reliable in testing for emptiness.
The Boost Preprocessor macro for testing whether the __VA_OPT__ construct is supported during - compilation is called BOOST_PP_VARIADIC_OPT, which is a function-like macro taking no parameters + compilation is called BOOST_PP_VARIADIC_HAS_OPT, which is a function-like macro taking no parameters and returning 1 if the __VA_OPT__ construct is supported and 0 if it is not. The macro only returns 1 when variadic macros are supported, when the compiler is at the C++20 level, and when the __VA_OPT__ construct can be used according to the C++20 standard. In particular @@ -109,13 +109,13 @@ can produce a warning, or even an error, when it even sees a macro using the __VA_OPT__ construct at a level below C++20, even though it supports it, if other compiler options requiring strict adherence to the level of the C++ standard being used are passed on the - command line. So taking a conservative approach the BOOST_PP_VARIADIC_OPT macros requires + command line. So taking a conservative approach the BOOST_PP_VARIADIC_HAS_OPT macros requires compilation at the C++20 level, along with variadic macro support, along with the testing code expanding to 1, in order to specify that __VA_OPT__ is supported.
The actual Boost Preprocessor library for testing for emptiness in C++20 mode is called BOOST_PP_CHECK_EMPTY. The macro is a variadic macro with a single variadic parameter. The - macro only exists if our previous macro for testing for __VA_OPT__ called BOOST_PP_VARIADIC_OPT - expands to 1 when invoked as BOOST_PP_VARIADIC_OPT(). If BOOST_PP_VARIADIC_OPT() expands to 0 + macro only exists if our previous macro for testing for __VA_OPT__ called BOOST_PP_VARIADIC_HAS_OPT + expands to 1 when invoked as BOOST_PP_VARIADIC_HAS_OPT(). If BOOST_PP_VARIADIC_HAS_OPT() expands to 0 the BOOST_PP_CHECK_EMPTY macro does not exist at all in this library. The input to the macro can be any variadic data. If the data passed to the macro is empty, or if the data passed to the macro is not empty but when the data itself is expanded it is empty, the macro returns @@ -135,7 +135,7 @@
diff --git a/doc/topics/variadic_macros.html b/doc/topics/variadic_macros.html index 5ecbd18..54005a4 100644 --- a/doc/topics/variadic_macros.html +++ b/doc/topics/variadic_macros.html @@ -151,7 +151,7 @@ This library offers support for this new C++20 construct by automatically detecting whether this new construct is supported by the compiler's preprocessor when using the library. The library macro which detects - support for the __VA_OPT__ construct is called BOOST_PP_VARIADIC_OPT. + support for the __VA_OPT__ construct is called BOOST_PP_VARIADIC_HAS_OPT. This is a function-like macro which takes no parameters and returns 1 if the compiler is working in C++20 mode and supports the __VA_OPT__ construct, while otherwise it returns 0. diff --git a/include/boost/preprocessor/facilities/check_empty.hpp b/include/boost/preprocessor/facilities/check_empty.hpp index 4ffe169..6d3d548 100644 --- a/include/boost/preprocessor/facilities/check_empty.hpp +++ b/include/boost/preprocessor/facilities/check_empty.hpp @@ -12,8 +12,8 @@ # ifndef BOOST_PREPROCESSOR_FACILITIES_CHECK_EMPTY_HPP # define BOOST_PREPROCESSOR_FACILITIES_CHECK_EMPTY_HPP # include-# if BOOST_PP_VARIADIC_OPT() +# if BOOST_PP_VARIADIC_HAS_OPT() # include # define BOOST_PP_CHECK_EMPTY(...) BOOST_PP_IS_EMPTY_OPT(__VA_ARGS__) -# endif /* BOOST_PP_VARIADIC_OPT() */ +# endif /* BOOST_PP_VARIADIC_HAS_OPT() */ # endif /* BOOST_PREPROCESSOR_FACILITIES_CHECK_EMPTY_HPP */ diff --git a/include/boost/preprocessor/facilities/is_empty_variadic.hpp b/include/boost/preprocessor/facilities/is_empty_variadic.hpp index 4beb3c9..55175cd 100644 --- a/include/boost/preprocessor/facilities/is_empty_variadic.hpp +++ b/include/boost/preprocessor/facilities/is_empty_variadic.hpp @@ -42,7 +42,7 @@ #define BOOST_PP_IS_EMPTY(...) \ BOOST_PP_DETAIL_IS_EMPTY_IIF \ ( \ - BOOST_PP_VARIADIC_OPT() \ + BOOST_PP_VARIADIC_HAS_OPT() \ ) \ ( \ BOOST_PP_IS_EMPTY_OPT, \ @@ -57,7 +57,7 @@ BOOST_PP_IS_EMPTY_FUNCTION2(__VA_ARGS__) \ /**/ #define BOOST_PP_IS_EMPTY_OPT(...) \ - BOOST_PP_VARIADIC_OPT_ELEM0(BOOST_PP_IS_EMPTY_FUNCTION(__VA_ARGS__),) \ + BOOST_PP_VARIADIC_HAS_OPT_ELEM0(BOOST_PP_IS_EMPTY_FUNCTION(__VA_ARGS__),) \ /**/ # else #define BOOST_PP_IS_EMPTY(...) \ diff --git a/include/boost/preprocessor/variadic/detail/opt.hpp b/include/boost/preprocessor/variadic/detail/opt.hpp index e5798ee..a8c629f 100644 --- a/include/boost/preprocessor/variadic/detail/opt.hpp +++ b/include/boost/preprocessor/variadic/detail/opt.hpp @@ -16,14 +16,14 @@ # # if BOOST_PP_VARIADICS && defined(__cplusplus) && __cplusplus > 201703L # -# define BOOST_PP_VARIADIC_OPT_FUNCTION(...) \ +# define BOOST_PP_VARIADIC_HAS_OPT_FUNCTION(...) \ __VA_OPT__(,) , 1, 0 \ /**/ # -# define BOOST_PP_VARIADIC_OPT_ELEM0(e0, ...) BOOST_PP_VARIADIC_OPT_ELEM_0(e0,__VA_ARGS__) -# define BOOST_PP_VARIADIC_OPT_ELEM2(e0, ...) BOOST_PP_VARIADIC_OPT_ELEM_2(e0,__VA_ARGS__) -# define BOOST_PP_VARIADIC_OPT_ELEM_0(e0, ...) e0 -# define BOOST_PP_VARIADIC_OPT_ELEM_2(e0, e1, e2, ...) e2 +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM0(e0, ...) BOOST_PP_VARIADIC_HAS_OPT_ELEM_0(e0,__VA_ARGS__) +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM2(e0, ...) BOOST_PP_VARIADIC_HAS_OPT_ELEM_2(e0,__VA_ARGS__) +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM_0(e0, ...) e0 +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM_2(e0, e1, e2, ...) e2 # # endif # diff --git a/include/boost/preprocessor/variadic/opt.hpp b/include/boost/preprocessor/variadic/opt.hpp index 09d37c4..0690ef5 100644 --- a/include/boost/preprocessor/variadic/opt.hpp +++ b/include/boost/preprocessor/variadic/opt.hpp @@ -14,15 +14,15 @@ # # include # -# /* BOOST_PP_VARIADIC_OPT */ +# /* BOOST_PP_VARIADIC_HAS_OPT */ # # if BOOST_PP_VARIADICS && defined(__cplusplus) && __cplusplus > 201703L # include -# define BOOST_PP_VARIADIC_OPT() \ - BOOST_PP_VARIADIC_OPT_ELEM2(BOOST_PP_VARIADIC_OPT_FUNCTION(?),) \ +# define BOOST_PP_VARIADIC_HAS_OPT() \ + BOOST_PP_VARIADIC_HAS_OPT_ELEM2(BOOST_PP_VARIADIC_HAS_OPT_FUNCTION(?),) \ /**/ # else -# define BOOST_PP_VARIADIC_OPT() 0 +# define BOOST_PP_VARIADIC_HAS_OPT() 0 # endif # # endif diff --git a/test/checkempty.cxx b/test/checkempty.cxx index 04ce245..ef32da1 100644 --- a/test/checkempty.cxx +++ b/test/checkempty.cxx @@ -12,7 +12,7 @@ # include # include -# if BOOST_PP_VARIADIC_OPT() +# if BOOST_PP_VARIADIC_HAS_OPT() # include diff --git a/test/config_info.cpp b/test/config_info.cpp index 23de991..10c3ab4 100644 --- a/test/config_info.cpp +++ b/test/config_info.cpp @@ -94,7 +94,7 @@ void print_macros() PRINT_MACRO(BOOST_PP_CONFIG_FLAGS()); PRINT_MACRO(BOOST_PP_VARIADICS); PRINT_MACRO(BOOST_PP_VARIADICS_MSVC); - PRINT_MACRO(BOOST_PP_VARIADIC_OPT()); + PRINT_MACRO(BOOST_PP_VARIADIC_HAS_OPT()); } int main() diff --git a/test/isempty.cxx b/test/isempty.cxx index 5fc8838..6f50a7f 100644 --- a/test/isempty.cxx +++ b/test/isempty.cxx @@ -40,7 +40,7 @@ # include -#if defined(__cplusplus) && __cplusplus > 201703L && BOOST_PP_VARIADIC_OPT() +#if defined(__cplusplus) && __cplusplus > 201703L && BOOST_PP_VARIADIC_HAS_OPT() BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END diff --git a/test/isempty_variadic_standard_failure.cxx b/test/isempty_variadic_standard_failure.cxx index 557014f..b68f032 100644 --- a/test/isempty_variadic_standard_failure.cxx +++ b/test/isempty_variadic_standard_failure.cxx @@ -20,7 +20,7 @@ # include -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == BOOST_PP_VARIADIC_OPT() END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == BOOST_PP_VARIADIC_HAS_OPT() END #else diff --git a/test/isempty_variadic_standard_failure2.cxx b/test/isempty_variadic_standard_failure2.cxx index c28bcd0..110a35e 100644 --- a/test/isempty_variadic_standard_failure2.cxx +++ b/test/isempty_variadic_standard_failure2.cxx @@ -20,7 +20,7 @@ # include -BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == BOOST_PP_VARIADIC_OPT() END +BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == BOOST_PP_VARIADIC_HAS_OPT() END #else