$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: hartmut.kaiser_at_[hidden]
Date: 2008-03-15 21:39:59
Author: hkaiser
Date: 2008-03-15 21:39:59 EDT (Sat, 15 Mar 2008)
New Revision: 43646
URL: http://svn.boost.org/trac/boost/changeset/43646
Log:
Wave: Fixed whitespace insertion error, fixed test cases.
Text files modified: 
   trunk/boost/wave/util/insert_whitespace_detection.hpp       |    14 ++++++++++--                            
   trunk/libs/wave/test/testwave/collect_hooks_information.hpp |     6 ++--                                    
   trunk/libs/wave/test/testwave/testfiles/t_2_009.cpp         |     2                                         
   trunk/libs/wave/test/testwave/testfiles/t_9_003.cpp         |    13 ++++++++++-                             
   trunk/libs/wave/test/testwave/testwave.cpp                  |     6 +++-                                    
   trunk/libs/wave/test/testwave/testwave_app.cpp              |    44 ++++++++++++++++++++------------------- 
   6 files changed, 53 insertions(+), 32 deletions(-)
Modified: trunk/boost/wave/util/insert_whitespace_detection.hpp
==============================================================================
--- trunk/boost/wave/util/insert_whitespace_detection.hpp	(original)
+++ trunk/boost/wave/util/insert_whitespace_detection.hpp	2008-03-15 21:39:59 EDT (Sat, 15 Mar 2008)
@@ -388,10 +388,18 @@
             break;
 
         case T_GREATER:
-            if (T_MINUS == prev)
-                return true;    // prevent ->
-            // fall through
+            if (T_MINUS == prev || T_GREATER == prev)
+                return true;    // prevent -> or >>
+            if (!impl::handle_parens(prev))
+                return false;
+            if (T_QUESTION_MARK == prev && T_QUESTION_MARK == beforeprev)
+                return true;
+            break;
+
         case T_LESS:
+            if (T_LESS == prev)
+                return true;    // prevent <<
+            // fall through
         case T_CHARLIT:
         case T_NOT:
         case T_NOTEQUAL:
Modified: trunk/libs/wave/test/testwave/collect_hooks_information.hpp
==============================================================================
--- trunk/libs/wave/test/testwave/collect_hooks_information.hpp	(original)
+++ trunk/libs/wave/test/testwave/collect_hooks_information.hpp	2008-03-15 21:39:59 EDT (Sat, 15 Mar 2008)
@@ -47,10 +47,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 template <typename String>
-inline std::string repr(boost::wave::util::file_position<String> const& pos)
+inline String repr(boost::wave::util::file_position<String> const& pos)
 {
-    return handle_filepath(pos.get_file()) + String("(") +
-        boost::lexical_cast<String>(pos.get_line()) + ")";
+    std::string linenum = boost::lexical_cast<std::string>(pos.get_line());
+    return handle_filepath(pos.get_file()) + String("(") + linenum.c_str() + ")";
 }
 
 ///////////////////////////////////////////////////////////////////////////////
Modified: trunk/libs/wave/test/testwave/testfiles/t_2_009.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_2_009.cpp	(original)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_009.cpp	2008-03-15 21:39:59 EDT (Sat, 15 Mar 2008)
@@ -43,7 +43,7 @@
 //H 02: <t_2_009.cpp>
 //H 03: <t_2_009.cpp>
 //H 04: <t_2_009.cpp>
-//H 05: ./t_2_009.cpp (C:/CVS/wave/libs/wave/test/testwave/testfiles/t_2_009.cpp)
+//H 05: $B(t_2_009.cpp) ($B(t_2_009.cpp))
 //H 10: t_2_009.cpp(15): #if
 //H 11: t_2_009.cpp(15): #if !defined(FILE_002_009_CPP)    : 0
 //H 06: 
Modified: trunk/libs/wave/test/testwave/testfiles/t_9_003.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_003.cpp	(original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_003.cpp	2008-03-15 21:39:59 EDT (Sat, 15 Mar 2008)
@@ -16,8 +16,10 @@
 #define PLUS() +
 #define MINUS() -
 #define DOT() .
+#define GREATER() >
+#define LESS() <
 
-//R #line 21 "t_9_003.cpp"
+//R #line 23 "t_9_003.cpp"
 X()2                          //R 1 2 
 STRINGIZE( X()2 )             //R "12" 
 //R 
@@ -37,13 +39,20 @@
 STRINGIZE( DOT()DOT()DOT() )  //R "..." 
 
 // the following are regressions reported by Stefan Seefeld
+//R #line 43 "t_9_003.cpp"
+GREATER()GREATER()            //R > > 
+STRINGIZE( GREATER()GREATER() ) //R ">>" 
+//R
+LESS()LESS()                  //R < < 
+STRINGIZE( LESS()LESS() )     //R "<<" 
+
 #define COMMA() ,
 #define AND() &
 #define CHAR() char
 #define STAR() *
 
 // Make sure no whitespace gets inserted in between the operator symbols
-//R #line 47 "t_9_003.cpp"
+//R #line 56 "t_9_003.cpp"
 void foo(char&, char)               //R void foo(char&, char) 
 void foo(char *)                    //R void foo(char *) 
 void foo(char *&)                   //R void foo(char *&) 
Modified: trunk/libs/wave/test/testwave/testwave.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testwave.cpp	(original)
+++ trunk/libs/wave/test/testwave/testwave.cpp	2008-03-15 21:39:59 EDT (Sat, 15 Mar 2008)
@@ -61,11 +61,13 @@
             ("copyright,c", "print out the copyright statement")
             ("config-file", po::value<std::vector<std::string> >()->composing(), 
                 "specify a config file (alternatively: @arg)")
+            ("hooks", po::value<bool>()->default_value(true), 
+                "test preprocessing hooks")
             ("debug,d", po::value<int>(), "set the debug level (0...9)")
         ;
 
     // Hidden options, will be used in in config file analysis to allow to
-    // recognise positional arguments, will not be shown to the user.
+    // recognize positional arguments, will not be shown to the user.
         po::options_description desc_hidden("Hidden options");
         desc_hidden.add_options()
             ("input", po::value<std::vector<std::string> >()->composing(), 
@@ -174,7 +176,7 @@
                     for (std::vector<std::string>::const_iterator iit = infiles.begin(); 
                          iit != iend; ++iit)
                     {
-                    // correct the file name (prepend the cfg file path)
+                    // correct the file name (pre-pend the config file path)
                         fs::path cfgpath = fs::complete(
                             fs::path(*cit, fs::native), fs::current_path());
                         fs::path filepath = 
Modified: trunk/libs/wave/test/testwave/testwave_app.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testwave_app.cpp	(original)
+++ trunk/libs/wave/test/testwave/testwave_app.cpp	2008-03-15 21:39:59 EDT (Sat, 15 Mar 2008)
@@ -97,6 +97,24 @@
         result = result + name.c_str();
         return true;
     }
+
+    template <typename T>
+    inline T const&
+    variables_map_as(po::variable_value const& v, T*)
+    {
+#if (__GNUC__ == 3 && (__GNUC_MINOR__ == 2 || __GNUC_MINOR__ == 3)) || \
+    BOOST_WORKAROUND(__MWERKS__, < 0x3200)
+// gcc 3.2.x and  3.3.x choke on vm[...].as<...>()
+// CW 8.3 has problems with the v.as<T>() below
+        T const* r = boost::any_cast<T>(&v.value());
+        if (!r)
+            boost::throw_exception(boost::bad_any_cast());
+        return *r;
+#else
+        return v.as<T>();
+#endif
+    }
+
 }
 
 ///////////////////////////////////////////////////////////////////////////
@@ -274,6 +292,10 @@
     if (!read_file(filename, instr)) 
         return false;     // error was reported already
 
+    bool test_hooks = true;
+    if (global_vm.count("hooks"))
+        test_hooks = variables_map_as(global_vm["hooks"], (bool *)NULL);
+    
 // extract expected output, preprocess the data and compare results
     std::string expected, expected_hooks;
     if (extract_expected_output(filename, instr, expected, expected_hooks)) {
@@ -325,7 +347,7 @@
             }
             else {
             // preprocessing succeeded, check hook information, if appropriate
-                if (!expected_hooks.empty() &&
+                if (test_hooks && !expected_hooks.empty() &&
                     !got_expected_result(filename, hooks, expected_hooks)) 
                 {
                     if (debuglevel > 2) {
@@ -746,26 +768,6 @@
     return true;
 }
 
-namespace {
-
-    template <typename T>
-    inline T const&
-    variables_map_as(po::variable_value const& v, T*)
-    {
-#if (__GNUC__ == 3 && (__GNUC_MINOR__ == 2 || __GNUC_MINOR__ == 3)) || \
-    BOOST_WORKAROUND(__MWERKS__, < 0x3200)
-// gcc 3.2.x and  3.3.x choke on vm[...].as<...>()
-// CW 8.3 has problems with the v.as<T>() below
-        T const* r = boost::any_cast<T>(&v.value());
-        if (!r)
-            boost::throw_exception(boost::bad_any_cast());
-        return *r;
-#else
-        return v.as<T>();
-#endif
-    }
-}
-
 template <typename Context>
 bool 
 testwave_app::initialise_options(Context& ctx, po::variables_map const& vm,