2 // Copyright (C) 2009-2012 Lorenzo Caminiti
3 // Distributed under the Boost Software License, Version 1.0
4 // (see accompanying file LICENSE_1_0.txt or a copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 // Home at http://www.boost.org/libs/local_function
8 #ifndef BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_RETURN_COUNT_HPP_
9 #define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_RETURN_COUNT_HPP_
11 #include <boost/local_function/aux_/preprocessor/traits/decl_/set_error.hpp>
12 #include <boost/local_function/aux_/preprocessor/traits/decl_returns.hpp>
13 #include <boost/preprocessor/control/iif.hpp>
14 #include <boost/preprocessor/facilities/empty.hpp>
15 #include <boost/preprocessor/tuple/eat.hpp>
16 #include <boost/preprocessor/comparison/greater.hpp>
17 #include <boost/preprocessor/list/size.hpp>
21 #define BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_VALIDATE_RETURN_COUNT( \
23 BOOST_PP_IIF(BOOST_PP_GREATER(BOOST_PP_LIST_SIZE( \
24 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_RETURNS(decl_traits)), 1), \
25 BOOST_LOCAL_FUNCTION_AUX_PP_DECL_TRAITS_SET_ERROR \
26 , /* else do nothing (keeping previous error, if any) */ \
27 decl_traits BOOST_PP_TUPLE_EAT(2) \
28 )(decl_traits, /* trailing `EMPTY` because error might not be present */ \
29 ERROR_cannot_specify_more_than_one_return_type BOOST_PP_EMPTY)
31 #endif // #include guard