mirror of
https://github.com/boostorg/wave.git
synced 2026-02-23 16:12:11 +00:00
Fixed certain minor bugs.
[SVN r1940]
This commit is contained in:
@@ -98,7 +98,7 @@ public:
|
||||
this->top().set_status(true);
|
||||
}
|
||||
else if (get_status()) {
|
||||
// Entered (false) else block from true block
|
||||
// Entered (false) #else block from true block
|
||||
this->top().set_status(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <cstdlib>
|
||||
#include <cctype>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
@@ -140,12 +141,20 @@ bool add_macro_definition(ContextT &ctx, std::string macrostring,
|
||||
predef_macros_t;
|
||||
|
||||
using namespace boost::wave;
|
||||
using namespace std; // isspace is in std namespace for some systems
|
||||
|
||||
// skip leading whitespace
|
||||
std::string::iterator begin = macrostring.begin();
|
||||
std::string::iterator end = macrostring.end();
|
||||
|
||||
while(begin != end && isspace(*begin))
|
||||
++begin;
|
||||
|
||||
// parse the macr definition
|
||||
position_t act_pos("command line", 0);
|
||||
boost::spirit::tree_parse_info<lex_t> hit =
|
||||
predef_macros_t::parse_predefined_macro(
|
||||
lex_t(macrostring.begin(), macrostring.end(), position_t(), language),
|
||||
lex_t());
|
||||
lex_t(begin, end, position_t(), language), lex_t());
|
||||
|
||||
if (!hit.match || (!hit.full && T_EOF != token_id(*hit.stop))) {
|
||||
BOOST_WAVE_THROW(preprocess_exception, bad_macro_definition, macrostring,
|
||||
@@ -1300,6 +1309,7 @@ token_sequence_t toexpand;
|
||||
typename token_sequence_t::iterator begin2 = toexpand.begin();
|
||||
ctx.expand_whole_tokensequence(begin2, toexpand.end(), expanded);
|
||||
|
||||
// replace all remaining (== undefined) identifiers with a integer lliteral '0'
|
||||
typename token_sequence_t::iterator exp_end = expanded.end();
|
||||
for (typename token_sequence_t::iterator exp_it = expanded.begin();
|
||||
exp_it != exp_end; ++exp_it)
|
||||
@@ -1362,6 +1372,7 @@ token_sequence_t toexpand;
|
||||
typename token_sequence_t::iterator begin2 = toexpand.begin();
|
||||
ctx.expand_whole_tokensequence(begin2, toexpand.end(), expanded);
|
||||
|
||||
// replace all remaining (== undefined) identifiers with a integer lliteral '0'
|
||||
typename token_sequence_t::iterator exp_end = expanded.end();
|
||||
for (typename token_sequence_t::iterator exp_it = expanded.begin();
|
||||
exp_it != exp_end; ++exp_it)
|
||||
@@ -1539,7 +1550,7 @@ typename ref_transform_iterator_generator<
|
||||
>::type first = make_ref_transform_iterator(begin, get_value);
|
||||
|
||||
#if BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY != 0
|
||||
// preprocess the body of this #warning message
|
||||
// preprocess the body of this #error message
|
||||
token_sequence_t toexpand;
|
||||
|
||||
std::copy(first, make_ref_transform_iterator(end, get_value),
|
||||
@@ -1549,13 +1560,13 @@ token_sequence_t toexpand;
|
||||
ctx.expand_whole_tokensequence(begin2, toexpand.end(), expanded,
|
||||
false);
|
||||
#else
|
||||
// simply copy the body of this #warning message to the issued diagnostic
|
||||
// simply copy the body of this #error message to the issued diagnostic
|
||||
// message
|
||||
std::copy(first, make_ref_transform_iterator(end, get_value),
|
||||
std::inserter(expanded, expanded.end()));
|
||||
#endif
|
||||
|
||||
// throw the corresponding exception
|
||||
// report the corresponding error
|
||||
BOOST_WAVE_THROW(preprocess_exception, error_directive,
|
||||
boost::wave::util::impl::as_string(expanded), act_pos);
|
||||
}
|
||||
@@ -1600,7 +1611,7 @@ token_sequence_t toexpand;
|
||||
std::inserter(expanded, expanded.end()));
|
||||
#endif
|
||||
|
||||
// throw the corresponding exception
|
||||
// report the corresponding error
|
||||
BOOST_WAVE_THROW(preprocess_exception, warning_directive,
|
||||
boost::wave::util::impl::as_string(expanded), act_pos);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace util {
|
||||
|
||||
namespace on_exit {
|
||||
|
||||
// on destruction pop the first element of the argument list
|
||||
// on destruction pop the first element of the list given as the argument
|
||||
template <typename ContainerT>
|
||||
struct pop_front {
|
||||
|
||||
@@ -61,8 +61,8 @@ namespace on_exit {
|
||||
ContainerT &list;
|
||||
};
|
||||
|
||||
// append a given list to the argument list
|
||||
// on destruction pop the first element of the argument list
|
||||
// append a given list to the list given as argument
|
||||
// on destruction pop the first element of the list given as argument
|
||||
template <typename ContainerT>
|
||||
struct splice_pop_front {
|
||||
|
||||
@@ -109,7 +109,8 @@ namespace on_exit {
|
||||
//
|
||||
// macromap
|
||||
//
|
||||
// This class holds all currently defined macros
|
||||
// This class holds all currently defined macros and on demand expands
|
||||
// those macrodefinitions
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename ContextT>
|
||||
@@ -446,7 +447,7 @@ typename defined_macros_t::iterator it = current_scope->find(name.get_value());
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// is_defined(): returnes, whether a given macro is already defined
|
||||
// is_defined(): returns, whether a given macro is already defined
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename ContextT>
|
||||
@@ -1428,14 +1429,6 @@ token_t startof_argument_list = *next;
|
||||
return count_arguments;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// expand_macro(): expands a defined macro
|
||||
//
|
||||
// This functions tries to expand the macro, to which points the 'first'
|
||||
// iterator. The functions eats up more tokens, if the macro to expand is
|
||||
// a function-like macro.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace {
|
||||
|
||||
@@ -1773,6 +1766,15 @@ namespace impl {
|
||||
};
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// expand_macro(): expands a defined macro
|
||||
//
|
||||
// This functions tries to expand the macro, to which points the 'first'
|
||||
// iterator. The functions eats up more tokens, if the macro to expand is
|
||||
// a function-like macro.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename ContextT>
|
||||
template <typename IteratorT, typename ContainerT>
|
||||
inline bool
|
||||
@@ -2094,16 +2096,16 @@ macromap<ContextT>::resolve_operator_pragma(IteratorT &first,
|
||||
|
||||
if (T_STRINGLIT != token_id(*it_exp)) {
|
||||
// ill formed operator _Pragma
|
||||
BOOST_WAVE_THROW(preprocess_exception, ill_formed_pragma_option, "_Pragma",
|
||||
pragma_token.get_position());
|
||||
BOOST_WAVE_THROW(preprocess_exception, ill_formed_pragma_option,
|
||||
"_Pragma", pragma_token.get_position());
|
||||
}
|
||||
|
||||
if (pragma_cmd.size() > 0) {
|
||||
// there should be exactly one string literal (string literals are to
|
||||
// be concatenated at translation phase 6, but _Pragma operators are
|
||||
// to be executed at translation phase 4)
|
||||
BOOST_WAVE_THROW(preprocess_exception, ill_formed_pragma_option, "_Pragma",
|
||||
pragma_token.get_position());
|
||||
BOOST_WAVE_THROW(preprocess_exception, ill_formed_pragma_option,
|
||||
"_Pragma", pragma_token.get_position());
|
||||
}
|
||||
|
||||
// remove the '\"' and concat all given string literal-values
|
||||
@@ -2381,7 +2383,7 @@ namespace {
|
||||
//
|
||||
// #region [<identifier>]
|
||||
//
|
||||
// Where <identifier> is a simple name (non-qualified name) defining the
|
||||
// Where <identifier> is a possibly qualified name defining the
|
||||
// name of the region to open. This name is optional. If the name is
|
||||
// omitted a nameless region is opened. Macros defined inside a nameless
|
||||
// region may not be accessed from outside this region.
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Uncomment the following, to enable some MS specific language extensions:
|
||||
// Undefine the following, to enable some MS specific language extensions:
|
||||
// __int8, __int16, __int32, __int64, __based, __declspec, __cdecl,
|
||||
// __fastcall, __stdcall, __try, __except, __finally, __leave, __inline,
|
||||
// __asm
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
// BOOST_WAVE_VERSION & 0x00FF is the sub-minor version
|
||||
// BOOST_WAVE_VERSION & 0x0F00 is the minor version
|
||||
// BOOST_WAVE_VERSION & 0xF000 is the major version
|
||||
#define BOOST_WAVE_VERSION 0x1100
|
||||
#define BOOST_WAVE_VERSION 0x1101
|
||||
|
||||
// The following defines contain the same information as above
|
||||
#define BOOST_WAVE_VERSION_MAJOR 1
|
||||
#define BOOST_WAVE_VERSION_MINOR 1
|
||||
#define BOOST_WAVE_VERSION_SUBMINOR 0
|
||||
#define BOOST_WAVE_VERSION_SUBMINOR 1
|
||||
|
||||
#endif // !defined(WAVE_VERSION_H_9D79ABDB_AC54_4C0A_89B1_F70A2DCFE21E_INCLUDED)
|
||||
|
||||
Reference in New Issue
Block a user