forked from boostorg/preprocessor
Added OPT macro to determine whether C++20's __VA_OPT__ is supported or not. Updated the undocumented variadic IS_EMPTY to use the functionality of __VA_OPT__ if it exists to provide perfect functionality for testing for emptiness.
This commit is contained in:
+1
-4
@@ -9,10 +9,7 @@
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
#
|
||||
# define BEGIN typedef int BOOST_PP_CAT(test_, __LINE__)[((
|
||||
# define END )==1) ? 1 : -1];
|
||||
# include <libs/preprocessor/test/test_macro.h>
|
||||
|
||||
#if defined(__clang__) && defined(__CUDACC__) && defined(__CUDA__)
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <iomanip>
|
||||
#include <string.h>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
#include <boost/preprocessor/variadic/opt.hpp>
|
||||
|
||||
static unsigned int indent = 4;
|
||||
static unsigned int width = 40;
|
||||
@@ -93,6 +94,8 @@ void print_macros()
|
||||
PRINT_MACRO(BOOST_PP_CONFIG_FLAGS());
|
||||
PRINT_MACRO(BOOST_PP_VARIADICS);
|
||||
PRINT_MACRO(BOOST_PP_VARIADICS_MSVC);
|
||||
PRINT_MACRO(BOOST_PP_VARIADICS_MSVC);
|
||||
PRINT_MACRO(BOOST_PP_VARIADIC_OPT());
|
||||
}
|
||||
|
||||
int main()
|
||||
|
||||
+14
-1
@@ -38,7 +38,20 @@
|
||||
|
||||
#if BOOST_PP_VARIADICS
|
||||
|
||||
#if BOOST_PP_VARIADICS_MSVC /* Testing the VC++ variadic version */
|
||||
# include <boost/preprocessor/variadic/opt.hpp>
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus > 201703L && BOOST_PP_VARIADIC_OPT()
|
||||
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN) == 0 END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN2) == 0 END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN3) == 0 END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN4) == 0 END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN5) == 0 END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN10) == 0 END
|
||||
|
||||
#elif BOOST_PP_VARIADICS_MSVC /* Testing the VC++ variadic version */
|
||||
|
||||
/* INCORRECT */
|
||||
|
||||
|
||||
@@ -15,9 +15,19 @@
|
||||
#if BOOST_PP_VARIADICS && (BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT()) && !BOOST_PP_VARIADICS_MSVC
|
||||
|
||||
#define FUNC_GEN8(x,y) (1,2,3)
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus > 201703L
|
||||
|
||||
# include <boost/preprocessor/variadic/opt.hpp>
|
||||
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == BOOST_PP_VARIADIC_OPT() END
|
||||
|
||||
#else
|
||||
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN8) == 0 END
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
BEGIN 1 == 0 END
|
||||
|
||||
@@ -16,8 +16,18 @@
|
||||
|
||||
#define FUNC_GEN9(x,y,z) anything
|
||||
|
||||
#if defined(__cplusplus) && __cplusplus > 201703L
|
||||
|
||||
# include <boost/preprocessor/variadic/opt.hpp>
|
||||
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == BOOST_PP_VARIADIC_OPT() END
|
||||
|
||||
#else
|
||||
|
||||
BEGIN BOOST_PP_IS_EMPTY(FUNC_GEN9) == 0 END
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
BEGIN 1 == 0 END
|
||||
|
||||
+2
-19
@@ -14,24 +14,7 @@
|
||||
# ifndef BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_H
|
||||
# define BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_H
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
# include <libs/preprocessor/test/test_macro.h>
|
||||
# include <libs/preprocessor/test/test_main.h>
|
||||
#
|
||||
# define BEGIN typedef int BOOST_PP_CAT(test_, __LINE__)[((
|
||||
# define END )==1) ? 1 : -1];
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#include <cstdio>
|
||||
#if !defined(_STLP_MSVC) || _STLP_MSVC >= 1300
|
||||
namespace std { }
|
||||
using namespace std;
|
||||
#endif
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
int main(void) {
|
||||
printf("pass " __TIME__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.com
|
||||
# *
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_MACRO_H
|
||||
# define BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_MACRO_H
|
||||
#
|
||||
# include <boost/preprocessor/cat.hpp>
|
||||
#
|
||||
# define BEGIN typedef int BOOST_PP_CAT(test_, __LINE__)[((
|
||||
# define END )==1) ? 1 : -1];
|
||||
#
|
||||
# endif
|
||||
@@ -0,0 +1,32 @@
|
||||
# /* Copyright (C) 2001
|
||||
# * Housemarque Oy
|
||||
# * http://www.housemarque.com
|
||||
# *
|
||||
# * Distributed under the Boost Software License, Version 1.0. (See
|
||||
# * accompanying file LICENSE_1_0.txt or copy at
|
||||
# * http://www.boost.org/LICENSE_1_0.txt)
|
||||
# */
|
||||
#
|
||||
# /* Revised by Paul Mensonides (2002) */
|
||||
#
|
||||
# /* See http://www.boost.org for most recent version. */
|
||||
#
|
||||
# ifndef BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_MAIN_H
|
||||
# define BOOST_LIBS_PREPROCESSOR_REGRESSION_TEST_MAIN_H
|
||||
#
|
||||
#if defined(__cplusplus)
|
||||
#include <cstdio>
|
||||
#if !defined(_STLP_MSVC) || _STLP_MSVC >= 1300
|
||||
namespace std { }
|
||||
using namespace std;
|
||||
#endif
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
int main(void) {
|
||||
printf("pass " __TIME__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
# endif
|
||||
Reference in New Issue
Block a user