#include <boost/wave/cpplexer/cpp_lex_token.hpp> // token type
#include <boost/wave/cpplexer/cpp_lex_iterator.hpp> // lexer type
+///////////////////////////////////////////////////////////////////////////////
+// Include lexer specifics, import lexer names
+#if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION == 0
+#include <boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp>
+#endif
+
+///////////////////////////////////////////////////////////////////////////////
+// Include the grammar definitions, if these shouldn't be compiled separately
+// (ATTENTION: _very_ large compilation times!)
+#if BOOST_WAVE_SEPARATE_GRAMMAR_INSTANTIATION == 0
+#include <boost/wave/grammars/cpp_intlit_grammar.hpp>
+#include <boost/wave/grammars/cpp_chlit_grammar.hpp>
+#include <boost/wave/grammars/cpp_grammar.hpp>
+#include <boost/wave/grammars/cpp_expression_grammar.hpp>
+#include <boost/wave/grammars/cpp_predef_macros_grammar.hpp>
+#include <boost/wave/grammars/cpp_defined_grammar.hpp>
+#endif
+
// test application related headers
#include "cmd_line_utils.hpp"
#include "testwave_app.hpp"
std::string source = expected.substr(pos1+3, p-pos1-3);
std::string result, error, hooks;
bool pp_result = preprocess_file(filename, source,
- result, error, hooks, true);
+ result, error, hooks, "", true);
if (!pp_result) {
std::cerr
<< "testwave: preprocessing error in $E directive: "
#if BOOST_WAVE_SUPPORT_CPP0X != 0
("c++11", "enable C++11 mode (implies --variadics and --long_long)")
#endif
+ ("warning,W", po::value<std::vector<std::string> >()->composing(),
+ "Warning settings.")
;
}
if (global_vm.count("hooks"))
test_hooks = variables_map_as(global_vm["hooks"], (bool *)NULL);
+ std::string expected_cfg_macro;
+ extract_special_information(filename, instr, 'D', expected_cfg_macro);
+
// extract expected output, preprocess the data and compare results
std::string expected, expected_hooks;
if (extract_expected_output(filename, instr, expected, expected_hooks)) {
bool retval = true; // assume success
bool printed_result = false;
std::string result, error, hooks;
- bool pp_result = preprocess_file(filename, instr, result, error, hooks);
+ bool pp_result = preprocess_file(filename, instr, result, error, hooks,
+ expected_cfg_macro);
if (pp_result || !result.empty()) {
// did we expect an error?
std::string expected_error;
std::string source = value.substr(4, p-4);
std::string result, error, hooks;
bool pp_result = preprocess_file(filename, source,
- result, error, hooks, true);
+ result, error, hooks, "", true);
if (!pp_result) {
std::cerr
<< "testwave: preprocessing error in '" << flag
std::string source = value.substr(4, p-4);
std::string result, error, hooks;
bool pp_result = preprocess_file(filename, source,
- result, error, hooks, true);
+ result, error, hooks, "", true);
if (!pp_result) {
std::cerr
<< "testwave: preprocessing error in '" << flag
bool
testwave_app::preprocess_file(std::string filename, std::string const& instr,
std::string& result, std::string& error, std::string& hooks,
- bool single_line)
+ std::string const& expected_cfg_macro, bool single_line)
{
// create the wave::context object and initialize it from the file to
// preprocess (may contain options inside of special comments)
if (!add_predefined_macros(ctx))
return false;
+ if (!expected_cfg_macro.empty() &&
+ !ctx.is_defined_macro(expected_cfg_macro))
+ {
+ // skip this test as it is for a disabled configuration
+ return false;
+ }
+
// preprocess the input, loop over all generated tokens collecting the
// generated text
context_type::iterator_type it = ctx.begin();