mirror of
https://github.com/boostorg/contract.git
synced 2026-02-27 04:52:22 +00:00
pp parsing for func return
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
# Copyright (C) 2008-2012 Lorenzo Caminiti
|
||||
# Copyright (C) 2008-2015 Lorenzo Caminiti
|
||||
# Distributed under the Boost Software License, Version 1.0
|
||||
# (see accompanying file LICENSE_1_0.txt or a copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
@@ -113,10 +113,11 @@ entries = [
|
||||
]
|
||||
|
||||
script = os.path.basename(sys.argv[0])
|
||||
root = sys.argv[0].replace('-generate.py', '', 1)
|
||||
for entry in entries:
|
||||
directory = entry['directory']
|
||||
keywords = entry['keywords']
|
||||
directory = os.path.join(root, entry['directory'])
|
||||
if not os.path.exists(directory): os.makedirs(directory)
|
||||
keywords = entry['keywords']
|
||||
for keyword in keywords:
|
||||
filename = keyword + ".hpp"
|
||||
path = os.path.join(directory, filename)
|
||||
@@ -128,7 +129,7 @@ for entry in entries:
|
||||
#define BOOST_CONTRACT_EXT_PP_KEYWORD_{1}_HPP_
|
||||
|
||||
// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
|
||||
// Instead, modify and run the related generation script "{0}".
|
||||
// Instead, modify and run related generation script "{0}".
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/keyword/utility/is.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/utility/remove.hpp>
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <boost/preprocessor/detail/check.hpp>
|
||||
|
||||
// PRIVATE //
|
||||
/* PRIVATE */
|
||||
|
||||
// Variadic so handle any arity.
|
||||
#define BOOST_CONTRACT_EXT_PP_HAS_PAREN_CHECK(...) \
|
||||
@@ -19,7 +19,7 @@
|
||||
#define BOOST_PP_CHECK_RESULT_BOOST_CONTRACT_EXT_PP_HAS_PAREN_CHECK \
|
||||
0, BOOST_PP_NIL
|
||||
|
||||
// PUBLIC //
|
||||
/* PUBLIC */
|
||||
|
||||
// Adapted from BOOST_PP_IS_UNARY but for variadic macros.
|
||||
#define BOOST_CONTRACT_EXT_PP_HAS_PAREN(tokens) \
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#ifndef BOOST_CONTRACT_EXT_PP_TRAITS_AUX_TYPE_HPP_
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_AUX_TYPE_HPP_
|
||||
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/auto.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/register.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/keyword/const.hpp>
|
||||
@@ -23,7 +24,7 @@
|
||||
#include <boost/contract/ext_/preprocessor/paren/has.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/paren/front.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/nil.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/traits/adt.hpp>
|
||||
#include <boost/contract/ext_/preprocessor/utility/nil.hpp>
|
||||
#include <boost/preprocessor/control/iif.hpp>
|
||||
#include <boost/preprocessor/control/while.hpp>
|
||||
#include <boost/preprocessor/tuple/elem.hpp>
|
||||
@@ -182,7 +183,7 @@
|
||||
#define BOOST_CONTRACT_EXT_PP_TRAITS_AUX_TYPE_PARSE(tokens) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_AUX_TYPE_PARSE_D(1, tokens)
|
||||
|
||||
// TOOD: Should all _SKIP macros be removed and replaced by PARASE macros
|
||||
// TODO: Should all _SKIP macros be removed and replaced by PARASE macros
|
||||
// that work on both sign and traits at the same time for efficiency and
|
||||
// consistency?
|
||||
|
||||
|
||||
4
include/boost/contract/ext_/preprocessor/traits/func/return.hpp
Executable file → Normal file
4
include/boost/contract/ext_/preprocessor/traits/func/return.hpp
Executable file → Normal file
@@ -48,7 +48,7 @@
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_RETURN_YES_(sign, traits) \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_RETURN_TYPE_(traits, \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_AUX_TYPE_PRASE(sign))
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_AUX_TYPE_PARSE(sign))
|
||||
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_RETURN_NO_(sign, traits) \
|
||||
(sign, BOOST_CONTRACT_EXT_PP_TRAITS_PUSH_BACK(traits, BOOST_PP_EMPTY))
|
||||
@@ -69,6 +69,8 @@
|
||||
// Expand to `result_type | void | auto | EMPTY()` (auto for unified function
|
||||
// syntax in which case for the result type trait use `..._UNIFIED_RETURN`).
|
||||
#define BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_RETURN(traits) \
|
||||
BOOST_CONTRACT_EXT_PP_TRAITS_ELEM( \
|
||||
BOOST_CONTRACT_EXT_PP_FUNC_TRAITS_AUX_RETURN_INDEX, traits)()
|
||||
|
||||
#endif // #include guard
|
||||
|
||||
|
||||
Reference in New Issue
Block a user