tested access on msvc, gcc, clang, and wave

This commit is contained in:
Lorenzo Caminiti
2014-10-19 23:35:46 -07:00
parent 61b4bd3065
commit 2a28645032
6 changed files with 65 additions and 40 deletions

View File

@@ -0,0 +1,41 @@
// WARNING: FILE AUTOMATICALLY GENERATED, DO NOT MODIFY IT!
// Instead, modify and run the related generation script "generate.py".
#ifndef BOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_HPP_
#define BOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_HPP_
#include <boost/contract/ext_/preprocessor/keyword/utility/is.hpp>
#include <boost/preprocessor/cat.hpp>
// PRIVATE //
// NOTE: These are not local macros, do NOT #undefine them ('x' used to avoid
// concatenating to reserved symbols).
// The following macro must expand to a unary token (e.g., `(1)`).
#define BOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_ISxinvariant (1)
#define invariantxBOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_IS (1)
// The following macro must expand to nothing.
#define BOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_REMOVExinvariant
#define invariantxBOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_REMOVE
// PUBLIC //
#define BOOST_CONTRACT_EXT_PP_KEYWORD_IS_INVARIANT_FRONT(tokens) \
BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_FRONT(tokens, \
BOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_ISx)
#define BOOST_CONTRACT_EXT_PP_KEYWORD_IS_INVARIANT_BACK(token) \
BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_BACK(token, \
xBOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_IS)
// Precondition: tokens start with keyword to remove (see `..._IS_INVARIANT_FRONT`).
#define BOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_REMOVE_FRONT(tokens) \
BOOST_PP_CAT(BOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_REMOVEx, tokens)
// Precondition: token ends with keyword to remove (see `..._IS_INVARIANT_BACK`).
#define BOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_REMOVE_BACK(token) \
BOOST_PP_CAT(token, xBOOST_CONTRACT_EXT_PP_KEYWORD_INVARIANT_REMOVE)
#endif // #include guard

View File

@@ -1,10 +1,4 @@
// Copyright (C) 2008-2012 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)
// Home at http://sourceforge.net/projects/contractpp
#ifndef BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_HPP_
#define BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_HPP_
@@ -20,9 +14,9 @@
// PUBLIC //
// `checking_prefix ## tokens` expand to unary (e.g., `(1)`) iff `tokens` start
// with keyword to check.
#define BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS( \
// Precondition: A macro `<checking_prefix><keyword-to-check>` must be #defined
// to expand to unary (e.g., `(1)`).
#define BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_FRONT( \
tokens, checking_prefix) \
BOOST_PP_IIF(BOOST_CONTRACT_EXT_PP_HAS_PAREN(tokens), \
0 BOOST_PP_TUPLE_EAT(2) \
@@ -30,5 +24,15 @@
BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_ \
)(checking_prefix, tokens)
// Precondition: A macro `<keyword-to-check><checking_postfix>` must be #defined
// to expand to unary (e.g., `(1)`).
// WARNING: This check only works if `token` is a single token, it will always
// expand to 0 with no errors if token is multiple tokens
// (e.g., `const *this`). Also, this check will expand to 0 with no error if
// `token` starts with a non-alphanumeric symbol (e.g., `*this`).
#define BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_BACK( \
token, checking_postfix) \
BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_IS_(token, checking_postfix)
#endif // #include guard

View File

@@ -1,31 +0,0 @@
// Copyright (C) 2008-2012 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)
// Home at http://sourceforge.net/projects/contractpp
#ifndef BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_REM_HPP_
#define BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_REM_HPP_
#include <boost/preprocessor/cat.hpp>
// PRIVATE //
// Adapted from BOOST_PP_EXPAND.
#define BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_REMOVE_EXPAND_I_(tokens) \
tokens
#define BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_REM_EXPAND_(tokens) \
BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_REMOVE_EXPAND_I_(tokens)
// PUBLIC //
// `removing_prefix ## <keyword-to-remove>` must expand to nothing, else 0.
// Precondition: Tokens start with keyword to remove (see KEYWORD_UTILITY_IS).
// IMPLEMENTATION: Below without EXPAND doesn't expand on MSVC.
#define BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_REM(tokens, removing_prefix) \
BOOST_CONTRACT_EXT_PP_KEYWORD_UTILITY_REM_EXPAND_( \
BOOST_PP_CAT(removing_prefix, tokens))
#endif // #include guard