]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/wave/test/testwave/testwave_app.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / wave / test / testwave / testwave_app.cpp
index 78a9a9d9b1c2260ca6036e542372bc796eee311d..33e779c7b32ef573351419955841989ab15d9a68 100644 (file)
 #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"
@@ -167,7 +185,7 @@ testwave_app::got_expected_result(std::string const& filename,
                         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: "
@@ -373,6 +391,8 @@ testwave_app::testwave_app(po::variables_map const& vm)
 #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.")
     ;
 }
 
@@ -396,13 +416,17 @@ testwave_app::test_a_file(std::string filename)
     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;
@@ -712,7 +736,7 @@ testwave_app::extract_special_information(std::string const& filename,
                         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
@@ -758,7 +782,7 @@ testwave_app::extract_special_information(std::string const& filename,
                         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
@@ -1307,7 +1331,7 @@ testwave_app::add_predefined_macros(Context& ctx)
 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)
@@ -1342,6 +1366,13 @@ testwave_app::preprocess_file(std::string filename, std::string const& instr,
         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();