return_count.hpp 1.4 KB

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