Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r56312 - in trunk: boost/wave boost/wave/util libs/wave libs/wave/doc libs/wave/test/testwave libs/wave/test/testwave/testfiles tools/wave
From: hartmut.kaiser_at_[hidden]
Date: 2009-09-19 15:57:11


Author: hkaiser
Date: 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
New Revision: 56312
URL: http://svn.boost.org/trac/boost/changeset/56312

Log:
Wave: more work on pragma once pp hooks, added test case
Added:
   trunk/libs/wave/test/testwave/testfiles/t_2_019.cpp (contents, props changed)
   trunk/libs/wave/test/testwave/testfiles/t_2_019_001.hpp (contents, props changed)
   trunk/libs/wave/test/testwave/testfiles/t_2_019_002.hpp (contents, props changed)
   trunk/libs/wave/test/testwave/testfiles/t_2_019_003.hpp (contents, props changed)
Text files modified:
   trunk/boost/wave/cpp_context.hpp | 11 +++
   trunk/boost/wave/preprocessing_hooks.hpp | 41 +++++++++++++---
   trunk/boost/wave/util/cpp_include_paths.hpp | 2
   trunk/boost/wave/util/cpp_iterator.hpp | 17 ++++--
   trunk/boost/wave/util/interpret_pragma.hpp | 12 ++--
   trunk/libs/wave/ChangeLog | 7 +-
   trunk/libs/wave/doc/class_reference_ctxpolicy.html | 100 ++++++++++++++++++++++++++-------------
   trunk/libs/wave/test/testwave/collect_hooks_information.hpp | 83 +++++++++++++++++++++++++++++++++
   trunk/libs/wave/test/testwave/testfiles/t_2_009.cpp | 1
   trunk/libs/wave/test/testwave/testfiles/t_9_016.cpp | 1
   trunk/libs/wave/test/testwave/testfiles/test.cfg | 1
   trunk/tools/wave/trace_macro_expansion.hpp | 23 +++-----
   12 files changed, 224 insertions(+), 75 deletions(-)

Modified: trunk/boost/wave/cpp_context.hpp
==============================================================================
--- trunk/boost/wave/cpp_context.hpp (original)
+++ trunk/boost/wave/cpp_context.hpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -403,11 +403,18 @@
     bool has_pragma_once(std::string const &filename_)
         { return includes.has_pragma_once(filename_); }
     bool add_pragma_once_header(std::string const &filename_,
- std::string const& guard_name = "__BOOST_WAVE_PRAGMA_ONCE__")
+ std::string const& guard_name)
     {
- get_hooks().detected_pragma_once(derived(), filename_, guard_name);
+ get_hooks().detected_include_guard(derived(), filename_, guard_name);
         return includes.add_pragma_once_header(filename_, guard_name);
     }
+ bool add_pragma_once_header(token_type const &pragma_,
+ std::string const &filename_)
+ {
+ get_hooks().detected_pragma_once(derived(), pragma_, filename_);
+ return includes.add_pragma_once_header(filename_,
+ "__BOOST_WAVE_PRAGMA_ONCE__");
+ }
 #endif
 
 #if BOOST_WAVE_SERIALIZATION != 0

Modified: trunk/boost/wave/preprocessing_hooks.hpp
==============================================================================
--- trunk/boost/wave/preprocessing_hooks.hpp (original)
+++ trunk/boost/wave/preprocessing_hooks.hpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -264,13 +264,13 @@
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
     ///////////////////////////////////////////////////////////////////////////
     //
- // The function 'detected_pragma_once' is called whenever either a
+ // The function 'detected_include_guard' is called whenever either a
     // include file is about to be added to the list of #pragma once headers.
     // That means this header file will not be opened and parsed again even
     // if it is specified in a later #include directive.
- // This function is called either as the result of a detected directive
- // #pragma once, or as the result of a detected include guard scheme.
- //
+ // This function is called as the result of a detected include guard
+ // scheme.
+ //
     // The implemented heuristics for include guards detects two forms of
     // include guards:
     //
@@ -298,16 +298,41 @@
     // processed file or a absolute path depending on the paths given as the
     // include search paths).
     //
- // The parameter include_guard is either "__BOOST_WAVE_PRAGMA_ONCE__" (if
- // a #pragma once has been detected) or contains the name of the detected
- // include guard.
+ // The parameter contains the name of the detected include guard.
     //
     ///////////////////////////////////////////////////////////////////////////
     template <typename ContextT>
     void
- detected_pragma_once(ContextT const& ctx, std::string const& filename,
+ detected_include_guard(ContextT const& ctx, std::string const& filename,
         std::string const& include_guard)
     {}
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'detected_pragma_once' is called whenever either a
+ // include file is about to be added to the list of #pragma once headers.
+ // That means this header file will not be opened and parsed again even
+ // if it is specified in a later #include directive.
+ // This function is called as the result of a detected directive
+ // #pragma once.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter pragma_token refers to the token "#pragma" triggering
+ // this preprocessing hook.
+ //
+ // The parameter 'filename' contains the file system path of the
+ // opened file (this is relative to the directory of the currently
+ // processed file or a absolute path depending on the paths given as the
+ // include search paths).
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename ContextT, typename TokenT>
+ void
+ detected_pragma_once(ContextT const& ctx, TokenT const& pragma_token,
+ std::string const& filename)
+ {}
 #endif
 
     ///////////////////////////////////////////////////////////////////////////

Modified: trunk/boost/wave/util/cpp_include_paths.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_include_paths.hpp (original)
+++ trunk/boost/wave/util/cpp_include_paths.hpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -440,7 +440,7 @@
     using namespace boost::serialization;
     std::string path_str;
     ar & make_nvp("filepath", path_str);
- p = boost::filesystem::path(path_str, boost::filesystem::native);
+ p = wave::util::create_path(path_str);
 }
 
 // split non-intrusive serialization function member into separate

Modified: trunk/boost/wave/util/cpp_iterator.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_iterator.hpp (original)
+++ trunk/boost/wave/util/cpp_iterator.hpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -427,7 +427,9 @@
 
     // restore the actual current file and directory
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- ctx.set_current_filename(iter_ctx->real_filename.c_str());
+ fs::path rfp(wave::util::create_path(iter_ctx->real_filename.c_str()));
+ std::string real_filename(rfp.string());
+ ctx.set_current_filename(real_filename.c_str());
 #endif
         ctx.set_current_directory(iter_ctx->real_filename.c_str());
 
@@ -1523,18 +1525,17 @@
     }
 
 // test, if this file is known through a #pragma once directive
+ std::string native_path_str(wave::util::native_file_string(native_path));
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- if (!ctx.has_pragma_once(wave::util::native_file_string(native_path)))
+ if (!ctx.has_pragma_once(native_path.string()))
 #endif
     {
     // the new include file determines the actual current directory
- ctx.set_current_directory(
- wave::util::native_file_string(native_path).c_str());
+ ctx.set_current_directory(native_path_str.c_str());
 
     // preprocess the opened file
     boost::shared_ptr<base_iteration_context_type> new_iter_ctx (
- new iteration_context_type(ctx,
- wave::util::native_file_string(native_path).c_str(),
+ new iteration_context_type(ctx, native_path_str.c_str(),
             act_pos, boost::wave::enable_prefer_pp_numbers(ctx.get_language())));
 
     // call the include policy trace function
@@ -1559,7 +1560,9 @@
 
         act_pos.set_file(iter_ctx->filename); // initialize file position
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
- ctx.set_current_filename(iter_ctx->real_filename.c_str());
+ fs::path rfp(wave::util::create_path(iter_ctx->real_filename.c_str()));
+ std::string real_filename(rfp.string());
+ ctx.set_current_filename(real_filename.c_str());
 #endif
 
         act_pos.set_line(iter_ctx->line);

Modified: trunk/boost/wave/util/interpret_pragma.hpp
==============================================================================
--- trunk/boost/wave/util/interpret_pragma.hpp (original)
+++ trunk/boost/wave/util/interpret_pragma.hpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -58,7 +58,7 @@
 {
     typedef typename ContextT::token_type token_type;
     typedef typename token_type::string_type string_type;
-
+
     using namespace cpplexer;
     if (T_IDENTIFIER == token_id(*it)) {
     // check for pragma wave ...
@@ -111,7 +111,7 @@
                     act_token.get_position());
                 return false;
             }
-
+
         // remove the falsely matched surrounding parenthesis's
             if (values.size() >= 2) {
                 BOOST_ASSERT(T_LEFTPAREN == values.front() && T_RIGHTPAREN == values.back());
@@ -119,7 +119,7 @@
                 typename ContainerT::reverse_iterator rit = values.rbegin();
                 values.erase((++rit).base());
             }
-
+
         // decode the option (call the context_policy hook)
             if (!ctx.get_hooks().interpret_pragma(
                   ctx.derived(), pending, option, values, act_token))
@@ -143,7 +143,7 @@
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
         else if ((*it).get_value() == "once") {
         // #pragma once
- return ctx.add_pragma_once_header(ctx.get_current_filename());
+ return ctx.add_pragma_once_header(act_token, ctx.get_current_filename());
         }
 #endif
 #if BOOST_WAVE_SUPPORT_PRAGMA_MESSAGE != 0
@@ -151,7 +151,7 @@
         // #pragma message(...) or #pragma message ...
             using namespace boost::spirit::classic;
             ContainerT values;
-
+
             if (!parse (++it, end,
                             ( ( ch_p(T_LEFTPAREN)
>> lexeme_d[
@@ -173,7 +173,7 @@
                     act_token.get_position());
                 return false;
             }
-
+
         // remove the falsely matched closing parenthesis/newline
             if (values.size() > 0) {
                 BOOST_ASSERT(T_RIGHTPAREN == values.back() || T_NEWLINE == values.back());

Modified: trunk/libs/wave/ChangeLog
==============================================================================
--- trunk/libs/wave/ChangeLog (original)
+++ trunk/libs/wave/ChangeLog 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -35,9 +35,10 @@
   (default is cout).
 - Fixed compilation problems caused by recent changes to the multi_pass iterator
   from Spirit V2.1.
-- Added a new preprocessing hook detected_pragma_once() which is getting called
- whenever either a #pragma once has been detected or if the include guard
- heuristics detected an include guard for a particular include file.
+- Added a new preprocessing hooks detected_pragma_once() and
+ detected_include_guard() which are getting called whenever either a #pragma
+ once has been detected or if the include guard heuristics detected an
+ include guard for a particular include file.
 - Added a new command line option to the wave driver tool: --listguards/-g
   allowing to trace all include files which are either contain a #pragma once
   or contain include guards.

Modified: trunk/libs/wave/doc/class_reference_ctxpolicy.html
==============================================================================
--- trunk/libs/wave/doc/class_reference_ctxpolicy.html (original)
+++ trunk/libs/wave/doc/class_reference_ctxpolicy.html 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -4,6 +4,11 @@
 <title>The Context Policy</title>
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 <link href="theme/style.css" rel="stylesheet" type="text/css">
+<style type="text/css">
+.style1 {
+ background-color: #EEEEEE;
+}
+</style>
 </head>
 <body>
 <table background="theme/bkd2.gif" border="0" cellspacing="2" width="100%">
@@ -56,23 +61,33 @@
         <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ExceptionT&gt;<br> void throw_exception(ContextT <span class="keyword">const</span> &amp;ctx, <br> ExceptionT <span class="keyword">const</span>&amp; e);<br><br> <span class="comment">// test, whether a given token may be skipped</span><br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">bool</span> may_skip_whitespace (ContextT <span class="keyword">const</span>&amp; ctx,<br> TokenT &amp;token, <span class="keyword">bool</span> &amp;skipped_newline);<br>
         <span class="comment">// Conditional compilation</span><span class="keyword">
         template</span> &lt;<br> <span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <br> <span class="keyword">typename</span> ContainerT<br> &gt;<br> <span class="keyword">bool</span> evaluated_conditional_expression(<br> ContextT <span class="keyword">const</span> &amp;ctx, TokenT <span class="keyword">const</span>&amp; directive, <br> ContainerT <span class="keyword">const</span>&amp; expression, <span class="keyword">bool</span> expression_value);<br>
- <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">void</span> skipped_token(ContextT <span class="keyword">const</span> &amp;ctx, <br> TokenT <span class="keyword">const</span>&amp; token);<br><br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> TokenT <span class="keyword">const</span>&amp; generated_token(ContextT <span class="keyword">const</span> &amp;ctx, <br> TokenT <span class="keyword">const</span>&amp; token);<br><br> <span class="comment">// macro expansion tracing</span><span class="keyword">
+ <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">void</span> skipped_token(ContextT <span class="keyword">const</span> &amp;ctx, <br> TokenT <span class="keyword">const</span>&amp; token);<br><br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> TokenT <span class="keyword">const</span>&amp; generated_token(ContextT <span class="keyword">const</span> &amp;ctx, <br> TokenT <span class="keyword">const</span>&amp; token);<br><br> <span class="comment">// macro expansion tracing</span><span class="keyword">
         template</span> &lt;<span class="keyword">
- typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT,<br> <span class="keyword">typename</span> IteratorT<br> &gt;<br> <span class="keyword">bool</span> expanding_function_like_macro(<br> ContextT <span class="keyword">const</span> &amp;ctx, TokenT <span class="keyword">const</span> &amp;macrodef, <br> <span class="keyword">std::vector</span>&lt;TokenT&gt; <span class="keyword">const</span> &amp;formal_args, <br> ContainerT <span class="keyword">const</span> &amp;definition, TokenT <span class="keyword">const</span> &amp;macrocall, <br> <span class="keyword">std::vector</span>&lt;ContainerT&gt; <span class="keyword">const</span> &amp;arguments,<br> IteratorT <span class="keyword">const</span> &amp;seqstart, Iterator <span class="keyword">const</span> &amp;seqend);<br> <br>
    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> expanding_object_like_macro(<br> ContextT <span class="keyword">const</span> &amp;ctx, TokenT <span class="keyword">const</span> &amp;macro, <br> ContainerT <span class="keyword">const</span> &amp;definition, TokenT <span class="keyword">const</span> &amp;macrocall);<br> <br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> expanded_macro(ContextT <span class="keyword">const</span> &amp;ctx, <br> ContainerT <span class="keyword">const</span> &amp;result);<br> <br>
   <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> rescanned_macro(ContextT <span class="keyword">const</span> &amp;ctx, <br> ContainerT <span class="keyword">const</span> &amp;result);<br><br> <span class="comment">// include file tracing functions</span>
- <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">bool</span> found_include_directive(ContextT <span class="keyword">const</span> &amp;ctx, <br> std::string <span class="keyword">const</span> &amp;filename, <span class="keyword">bool</span> include_next);<br><br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void </span>opened_include_file(ContextT <span class="keyword">const</span> &amp;ctx, <br> std::string <span class="keyword">const</span> &amp;relname, std::string <span class="keyword">const</span>&amp; absname,<br> <span class="keyword">bool</span> is_system_include); <br><br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt
;<br> <span class="keyword">void</span> returning_from_include_file(ContextT <span class="keyword">const</span> &amp;ctx);<br><br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void</span> detected_pragma_once(ContextT <span class="keyword">const</span> &amp;ctx,
+ typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT,<br> <span class="keyword">typename</span> IteratorT<br> &gt;<br> <span class="keyword">bool</span> expanding_function_like_macro(<br> ContextT <span class="keyword">const</span> &amp;ctx, TokenT <span class="keyword">const</span> &amp;macrodef, <br> <span class="keyword">std::vector</span>&lt;TokenT&gt; <span class="keyword">const</span> &amp;formal_args, <br> ContainerT <span class="keyword">const</span> &amp;definition, TokenT <span class="keyword">const</span> &amp;macrocall, <br> <span class="keyword">std::vector</span>&lt;ContainerT&gt; <span class="keyword">const</span> &amp;arguments,<br> IteratorT <span class="keyword">const</span> &amp;seqstart, Iterator <span class="keyword">const</span> &amp;seqend);<br> <br>
    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> expanding_object_like_macro(<br> ContextT <span class="keyword">const</span> &amp;ctx, TokenT <span class="keyword">const</span> &amp;macro, <br> ContainerT <span class="keyword">const</span> &amp;definition, TokenT <span class="keyword">const</span> &amp;macrocall);<br> <br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> expanded_macro(ContextT <span class="keyword">const</span> &amp;ctx, <br> ContainerT <span class="keyword">const</span> &amp;result);<br> <br>
   <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> rescanned_macro(ContextT <span class="keyword">const</span> &amp;ctx, <br> ContainerT <span class="keyword">const</span> &amp;result);<br><br>
+ <span class="comment">// include file tracing functions</span>
+ <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">bool</span> found_include_directive(ContextT <span class="keyword">const</span> &amp;ctx, <br> std::string <span class="keyword">const</span> &amp;filename, <span class="keyword">bool</span> include_next);<br>
+ <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void </span>opened_include_file(ContextT <span class="keyword">const</span> &amp;ctx, <br> std::string <span class="keyword">const</span> &amp;relname, std::string <span class="keyword">const</span>&amp; absname,<br> <span class="keyword">bool</span> is_system_include); <br>
+ <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void</span> returning_from_include_file(ContextT <span class="keyword">const</span> &amp;ctx);<br>
+ <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void</span> detected_include_guard(ContextT <span class="keyword">const</span> &amp;ctx,
             std::string <span class="keyword">const</span>&amp; filename,
- std::string <span class="keyword">const</span>&amp; include_guard);<br><br> <span class="comment">// interpretation of #pragma's of the form </span>
+ std::string <span class="keyword">const</span>&amp; include_guard);<br>
+ <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">void</span> detected_pragma_once(ContextT <span class="keyword">const</span> &amp;ctx,
+ TokenT <span class="keyword">const</span>&amp; pragma_token,
+ std::string <span class="keyword">const</span>&amp; filename);<br><br>
+ <span class="comment">// interpretation of #pragma's of the form </span>
         <span class="comment">// 'wave option[(value)]'</span>
- <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> interpret_pragma(ContextT <span class="keyword">const</span> &amp;ctx, ContainerT &amp;pending, <br> <span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &amp;option, <br> ContainerT <span class="keyword">const</span> &amp;values, <br> <span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &amp;pragma_token);<br><br> <span class="comment">// macro definition hooks</span>
+ <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> interpret_pragma(ContextT <span class="keyword">const</span> &amp;ctx, ContainerT &amp;pending, <br> <span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &amp;option, <br> ContainerT <span class="keyword">const</span> &amp;values, <br> <span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &amp;pragma_token);<br><br>
+ <span class="comment">// macro definition hooks</span>
         <span class="keyword">template</span> &lt;<br> <span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">
             typename</span> ParametersT, <span class="keyword">typename</span> DefinitionT<br> &gt;<br> <span class="keyword">void</span> defined_macro(ContextT <span class="keyword">const</span> &amp;ctx, TokenT <span class="keyword">const</span> &amp;name, <span class="keyword">
- bool</span> is_functionlike, ParametersT <span class="keyword">const</span> &amp;parameters, <br> DefinitionT <span class="keyword">const</span> &amp;definition, <span class="keyword">bool</span> is_predefined);<br><br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">void</span> undefined_macro(ContextT <span class="keyword">const</span> &amp;ctx, <br> TokenT<span class="keyword"> const</span> &amp;name);<br><br> <span class="comment">// #error and #warning directive hooks</span>
+ bool</span> is_functionlike, ParametersT <span class="keyword">const</span> &amp;parameters, <br> DefinitionT <span class="keyword">const</span> &amp;definition, <span class="keyword">bool</span> is_predefined);<br><br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">void</span> undefined_macro(ContextT <span class="keyword">const</span> &amp;ctx, <br> TokenT<span class="keyword"> const</span> &amp;name);<br><br>
+ <span class="comment">// #error and #warning directive hooks</span>
         <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> found_warning_directive(ContextT <span class="keyword">const</span> &amp;ctx, <br> ContainerT <span class="keyword">const</span> &amp;message);<br><br> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> found_error_directive(ContextT <span class="keyword">const</span> &amp;ctx, <br> ContainerT <span class="keyword">const</span> &amp;message);<br><br> <span class="comment">// #line directive hook</span>
         <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> found_line_directive(ContextT <span class="keyword">const</span> &amp;ctx, <br> ContainerT <span class="keyword">const</span> &amp;arguments, <span class="keyword">unsigned int</span> line,<br> std::string <span class="keyword">const</span>&amp; filename);<br> };<br><br>}}} <span class="comment">// namespace boost::wave::context_policies</span></pre>
 <h2><a name="member_functions"></a>Member functions</h2>
 <h3>General hook functions </h3>
 <p><a name="found_directive"></a><strong>found_directive</strong></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">bool</span> found_directive(ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const </span>&amp;directive);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">bool</span> found_directive(ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const </span>&amp;directive);
 </pre>
 <blockquote>
   <p>The function <tt>found_directive</tt> is called, whenever the preprocessor has detected one of the preprocessing directives (<span class="preprocessor">#define</span>, <span class="preprocessor">#undef</span>, <span class="preprocessor">#if</span>, <span class="preprocessor">#idef</span>, <span class="preprocessor">#ifndef</span>, <span class="preprocessor">#elif</span>, <span class="preprocessor">#endif</span>, <span class="preprocessor">#error</span>, <span class="preprocessor">#include</span>, <span class="preprocessor">#pragma</span> or <span class="preprocessor">#warning</span>) .</p>
@@ -85,14 +100,14 @@
     value is <tt>false</tt>, the directive is processed in the normal manner. </p>
 </blockquote>
 <p><a name="throw_exception"></a><strong>throw_exception</strong></p>
-<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ExceptionT&gt;<br> void throw_exception(ContextT <span class="keyword">const</span> &amp;ctx, <br> ExceptionT <span class="keyword">const</span>&amp; e);</pre>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ExceptionT&gt;<br> void throw_exception(ContextT <span class="keyword">const</span> &amp;ctx, <br> ExceptionT <span class="keyword">const</span>&amp; e);</pre>
 <blockquote>
   <p>he function&nbsp;<tt>throw_exception</tt> is called, whenever a preprocessing exception occurs .</p>
   <p>The <tt>ctx</tt> parameter provides a reference to the <tt>context_type</tt> used during instantiation of the preprocessing iterators by the user.&nbsp; </p>
   <p>The parameter&nbsp;<tt>e</tt> is the exception object containing detailed error information. </p>
 </blockquote>
 <p><a name="may_skip_whitespace" id="may_skip"></a><strong>may_skipwhitespace</strong></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">bool</span> may_skip_whitespace(ContextT <span class="keyword">const</span>&amp; ctx, TokenT &amp;token, <br> <span class="keyword">bool</span>&amp; skipped_newline);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">bool</span> may_skip_whitespace(ContextT <span class="keyword">const</span>&amp; ctx, TokenT &amp;token, <br> <span class="keyword">bool</span>&amp; skipped_newline);
 </pre>
 <blockquote>
   <p>The function <tt>may_skipwhitespace</tt> will be called by the library, whenever a token is about to be returned to the calling application. </p>
@@ -106,7 +121,8 @@
 </blockquote>
 <h3>Conditional compilation hook functions </h3>
 <p><a name="evaluated_conditional_expression"></a><strong>evaluated_conditional_expression</strong></p>
-<pre><span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT&gt;<br><span class="keyword"> bool</span> evaluated_conditional_expression(ContextT <span class="keyword">const</span>&amp; ctx, <br> TokenT <span class="keyword">const</span>&amp; directive, ContainerT <span class="keyword">const</span>&amp; expression, <span class="keyword"><br> bool</span> expression_value);<br>
+<pre><span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT&gt;
+<span class="keyword"> bool</span> evaluated_conditional_expression(ContextT <span class="keyword">const</span>&amp; ctx, <br> TokenT <span class="keyword">const</span>&amp; directive, ContainerT <span class="keyword">const</span>&amp; expression, <span class="keyword"><br> bool</span> expression_value);
 </pre>
 <blockquote>
   <p>The function <tt>evaluated_conditional_expression</tt> is called, whenever the preprocessor has encountered a <span class="preprocessor">#if</span>, <span class="preprocessor">#elif</span>, <span class="preprocessor">#ifdef</span> or <span class="preprocessor">#ifndef</span> directive. This hook gets passed the non-expanded conditional
@@ -126,7 +142,7 @@
   </p>
 </blockquote>
 <p><a name="skipped_token"></a><strong>skipped_token</strong></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">void</span> skipped_token(ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const</span>&amp; token);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> <span class="keyword">void</span> skipped_token(ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const</span>&amp; token);
 </pre>
 <blockquote>
   <p>The function <tt>skipped_token</tt> is called, whenever a token is about to be skipped due to a false preprocessor condition (code fragments to be
@@ -136,7 +152,7 @@
   <p>The parameter <tt>token</tt> refers to the token to be skipped.</p>
 </blockquote>
 <p><a name="generated_token"></a><strong>generated_token</strong></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> TokenT <span class="keyword">const</span>&amp; generated_token(ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const</span>&amp; token);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT&gt;<br> TokenT <span class="keyword">const</span>&amp; generated_token(ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const</span>&amp; token);
 </pre>
 <blockquote>
   <p>The function <tt>generated_token</tt> is called, whenever a token is about to be returned from the library.</p>
@@ -150,7 +166,7 @@
 </blockquote>
 <h3>Macro expansion tracking functions</h3>
 <p><a name="expanding_function_like_macro"></a><b>expanding_function_like_macro</b></p>
-<pre><span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> expanding_function_like_macro(<br> ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const</span> &amp;macrodef, <br> <span class="keyword">std::vector</span>&lt;TokenT&gt; <span class="keyword">const</span> &amp;formal_args, <br> ContainerT <span class="keyword">const</span> &amp;definition, TokenT <span class="keyword">const</span> &amp;macrocall, <br> <span class="keyword">std::vector</span>&lt;ContainerT&gt; <span class="keyword">const</span> &amp;arguments,<br> IteratorT <span class="keyword">const</span> &amp;seqstart, Iterator <span class="keyword">const</span> &amp;seqend);</pre>
+<pre><span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> expanding_function_like_macro(<br> ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const</span> &amp;macrodef, <br> <span class="keyword">std::vector</span>&lt;TokenT&gt; <span class="keyword">const</span> &amp;formal_args, <br> ContainerT <span class="keyword">const</span> &amp;definition, TokenT <span class="keyword">const</span> &amp;macrocall, <br> <span class="keyword">std::vector</span>&lt;ContainerT&gt; <span class="keyword">const</span> &amp;arguments,<br> IteratorT <span class="keyword">const</span> &amp;seqstart, Iterator <span class="keyword">const</span> &amp;seqend);</pre>
 <blockquote>
   <p>The function <tt>expanding_function_like_macro</tt> is called, whenever a
     function-like macro is to be expanded, i.e. <i>before</i> the actual expansion
@@ -183,7 +199,7 @@
   </p>
 </blockquote>
 <p><a name="expanding_object_like_macro"></a><b>expanding_object_like_macro</b></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> expanding_object_like_macro(<br> ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const</span> &amp;macro, <br> ContainerT <span class="keyword">const</span> &amp;definition, TokenT <span class="keyword">const</span> &amp;macrocall);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">bool</span> expanding_object_like_macro(<br> ContextT <span class="keyword">const</span>&amp; ctx, TokenT <span class="keyword">const</span> &amp;macro, <br> ContainerT <span class="keyword">const</span> &amp;definition, TokenT <span class="keyword">const</span> &amp;macrocall);
 </pre>
 <blockquote>
   <p>The function <tt>expanding_object_like_macro</tt> is called, whenever a object-like
@@ -203,7 +219,7 @@
   </p>
 </blockquote>
 <p><a name="expanded_macro"></a><b>expanded_macro</b></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> expanded_macro(ContextT <span class="keyword">const</span>&amp; ctx, ContainerT <span class="keyword">const</span> &amp;result);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> expanded_macro(ContextT <span class="keyword">const</span>&amp; ctx, ContainerT <span class="keyword">const</span> &amp;result);
 </pre>
 <blockquote>
   <p>The function <tt>expanded_macro</tt> is called whenever the expansion of
@@ -215,7 +231,7 @@
     so far. This is a standard STL container containing the generated token sequence.</p>
 </blockquote>
 <p><a name="rescanned_macro"></a><b>rescanned_macro</b></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> rescanned_macro(ContextT <span class="keyword">const</span>&amp; ctx, ContainerT <span class="keyword">const</span> &amp;result);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> rescanned_macro(ContextT <span class="keyword">const</span>&amp; ctx, ContainerT <span class="keyword">const</span> &amp;result);
 </pre>
 <blockquote>
   <p>The function <tt>rescanned_macro</tt> is called whenever the rescanning
@@ -228,7 +244,7 @@
 </blockquote>
 <h3>Include file tracing functions</h3>
 <p><a name="opened_include_file" id="found_include_directive"></a><strong>found_include_directive</strong></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">bool</span> found_include_directive(ContextT <span class="keyword">const</span>&amp; ctx, <br> std::string <span class="keyword">const</span> &amp;filename, <span class="keyword">bool</span> include_next);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">bool</span> found_include_directive(ContextT <span class="keyword">const</span>&amp; ctx, <br> std::string <span class="keyword">const</span> &amp;filename, <span class="keyword">bool</span> include_next);
 </pre>
 <blockquote>
   <p>The function <tt>found_include_directive</tt> is called whenever whenever a #include directive was located..</p>
@@ -248,7 +264,7 @@
   </p>
 </blockquote>
 <p><a name="opened_include_file" id="opened_include_file"></a><strong>opened_include_file</strong></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void</span> opened_include_file(ContextT <span class="keyword">const</span>&amp; ctx, <br> std::string <span class="keyword">const</span> &amp;rel_filename, std::string <span class="keyword">const</span> &amp;abs_filename, <br> <span class="keyword">bool</span> is_system_include);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void</span> opened_include_file(ContextT <span class="keyword">const</span>&amp; ctx, <br> std::string <span class="keyword">const</span> &amp;rel_filename, std::string <span class="keyword">const</span> &amp;abs_filename, <br> <span class="keyword">bool</span> is_system_include);
 </pre>
 <blockquote>
   <p>The function <tt>opened_include_file</tt> is called whenever a file referred
@@ -265,7 +281,7 @@
     as a result of a <tt>#include&nbsp;&lt;...&gt;</tt> directive.</p>
 </blockquote>
 <p><a name="returning_from_include_file" id="returning_from_include_file"></a><strong>returning_from_include_file</strong></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void</span> returning_from_include_file(ContextT <span class="keyword">const</span>&amp; ctx);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void</span> returning_from_include_file(ContextT <span class="keyword">const</span>&amp; ctx);
 </pre>
 <blockquote>
   <p>The function <tt>returning_from_include_file</tt> is called whenever an
@@ -273,27 +289,42 @@
   <p>The <tt>ctx</tt> parameter provides a reference to the <tt>context_type</tt> used during instantiation of the preprocessing iterators by the user.
     Note, this parameter was added for the Boost V1.35.0 release. </p>
 </blockquote>
-<p><a name="detected_pragma_once" id="A1">detected_pragma_once</a></p>
-<pre> <span class="keyword"> template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void</span> detected_pragma_once(ContextT <span class="keyword">const</span>&amp; ctx,
+<p><a name="detected_include_guard" id="detected_include_guard"></a><strong>detected_include_guard</strong></p>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT&gt;<br> <span class="keyword">void</span> detected_include_guard(ContextT <span class="keyword">const</span>&amp; ctx,
         std::string <span class="keyword">const</span>&amp; filename,
- std::string <span class="keyword">const</span>&amp; include_guard);<br>
+ std::string <span class="keyword">const</span>&amp; include_guard);
 </pre>
 <blockquote>
- <p>The function <tt>detected_pragma_once</tt> is called whenever either a
- include file is about to be added to the list of #pragma once headers. That
- means this header file will not be opened and parsed again even if it is
- specified in a later #include directive. This function is called either as the
- result of a detected directive #pragma once, or as the result of a detected
- include guard scheme. </p>
+ <p>The function <tt>detected_include_guard</tt> is called whenever a<span lang="de">n</span>
+ include file is about to be added to the list of #pragma once headers as the
+ result of a detected include guard scheme. That means this header file will
+ not be opened and parsed again even if it is specified in a later
+ <span class="preprocessor">#include</span> directive.&nbsp; </p>
   <p>The <tt>ctx</tt> parameter provides a reference to the <tt>context_type</tt>
   used during instantiation of the preprocessing iterators by the user. </p>
         <p>The parameter <tt>filename</tt> contains the file system path of the opened file
         (this is relative to the directory of the currently processed file or a
         absolute path depending on the paths given as the include search paths).</p>
- <p>The parameter <tt>include_guard</tt> is either <span class="string">
- &quot;__BOOST_WAVE_PRAGMA_ONCE__&quot;</span> (if a
- <span class="preprocessor">#pragma once</span> has been detected) or
- contains the name of the detected include guard.<br> </p>
+ <p>The parameter <tt>include_guard</tt> contains the name of the detected include guard.<br> </p>
+</blockquote>
+<p><a name="detected_pragma_once" id="detected_pragma_once"></a><strong>detected_pragma_once</strong></p>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename </span>TokenT&gt;<br> <span class="keyword">void</span> detected_<span lang="de">p<span class="style1">ragma<span lang="en-us">_</span>once</span></span>(ContextT <span class="keyword">const</span>&amp; ctx,
+<span lang="de"> TokenT <span class="keyword">const</span>&amp; pragma_token,</span>
+ std::string <span class="keyword">const</span>&amp; filename);</pre>
+<blockquote>
+ <p>The function <tt>detected_pragma_once</tt> is called whenever either a<span lang="de">n</span>
+ include file is about to be added to the list of #pragma once headers as the
+ result of a detected <span lang="de"><span class="preprocessor">#pragma once</span>
+ directive</span>. That means this header file will not be opened and parsed
+ again even if it is specified in a later <span class="preprocessor">#include</span>
+ directive. </p>
+ <p>The <tt>ctx</tt> parameter provides a reference to the <tt>context_type</tt>
+ used during instantiation of the preprocessing iterators by the user. </p>
+ <p><span lang="de">The parameter pragma_token refers to the token &quot;#pragma&quot;
+ triggering this preprocessing hook.</span></p>
+ <p>The parameter <tt>filename</tt> contains the file system path of the opened file
+ (this is relative to the directory of the currently processed file or a
+ absolute path depending on the paths given as the include search paths).</p>
 </blockquote>
 <h3>Interpretation of #pragma's</h3>
 <p><strong><a name="interpret_pragma"></a>interpret_pragma</strong></p>
@@ -370,7 +401,7 @@
     exception of the type <code>error_directive</code> (normal execution continues), if the return value is <tt>true</tt> the execution continues as if no <span class="preprocessor">#error</span> directive has been found and the overall directive is replaced by a single newline. </p>
 </blockquote>
 <p><strong><a name="found_line_directive" id="found_line_directive"></a>found_line_drective</strong></p>
-<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> found_line_drective(ContextT <span class="keyword">const</span>&amp; ctx, <br> ContainerT <span class="keyword">const</span> &amp;arguments, <span class="keyword">unsigned int</span> line,<br> std::string <span class="keyword">const</span>&amp; filename);<br>
+<pre> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT&gt;<br> <span class="keyword">void</span> found_line_drective(ContextT <span class="keyword">const</span>&amp; ctx, <br> ContainerT <span class="keyword">const</span> &amp;arguments, <span class="keyword">unsigned int</span> line,<br> std::string <span class="keyword">const</span>&amp; filename);
 </pre>
 <blockquote>
   <p>The function <tt>found_line_directive </tt> is called whenever a <span class="preprocessor">#line </span>directive has been encountered. Note, this function was added for the Boost V1.35.0 release. </p>
@@ -397,7 +428,8 @@
   1.0. (See accompanying file LICENSE_1_0.txt or copy at
   http://www.boost.org/LICENSE_1_0.txt) </font> </p>
 <p class="copyright"><span class="updated">Last updated:
- <!-- #BeginDate format:fcAm1m -->Thursday, September 17, 2009 12:36<!-- #EndDate -->
+ <!-- #BeginDate format:fcAm1m -->Thursday, September 1<span lang="de">8</span>, 2009
+<span lang="de">09</span>:<span lang="de">10</span><!-- #EndDate -->
   </span></p>
 </body>
 </html>

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 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -671,6 +671,89 @@
         return this->base_type::throw_exception(ctx, e);
     }
 
+#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'detected_include_guard' is called whenever either a
+ // include file is about to be added to the list of #pragma once headers.
+ // That means this header file will not be opened and parsed again even
+ // if it is specified in a later #include directive.
+ // This function is called as the result of a detected include guard
+ // scheme.
+ //
+ // The implemented heuristics for include guards detects two forms of
+ // include guards:
+ //
+ // #ifndef INCLUDE_GUARD_MACRO
+ // #define INCLUDE_GUARD_MACRO
+ // ...
+ // #endif
+ //
+ // or
+ //
+ // if !defined(INCLUDE_GUARD_MACRO)
+ // #define INCLUDE_GUARD_MACRO
+ // ...
+ // #endif
+ //
+ // note, that the parenthesis are optional (i.e. !defined INCLUDE_GUARD_MACRO
+ // will work as well). The code allows for any whitespace, newline and single
+ // '#' tokens before the #if/#ifndef and after the final #endif.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'filename' contains the file system path of the
+ // opened file (this is relative to the directory of the currently
+ // processed file or a absolute path depending on the paths given as the
+ // include search paths).
+ //
+ // The parameter contains the name of the detected include guard.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename ContextT>
+ void
+ detected_include_guard(ContextT const& ctx, std::string const& filename,
+ std::string const& include_guard)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "19: " << filename << ": " << include_guard << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'detected_pragma_once' is called whenever either a
+ // include file is about to be added to the list of #pragma once headers.
+ // That means this header file will not be opened and parsed again even
+ // if it is specified in a later #include directive.
+ // This function is called as the result of a detected directive
+ // #pragma once.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter pragma_token refers to the token "#pragma" triggering
+ // this preprocessing hook.
+ //
+ // The parameter 'filename' contains the file system path of the
+ // opened file (this is relative to the directory of the currently
+ // processed file or a absolute path depending on the paths given as the
+ // include search paths).
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename ContextT, typename TokenT>
+ void
+ detected_pragma_once(ContextT const& ctx, TokenT const& pragma_token,
+ std::string const& filename)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "20: " << repr(pragma_token.get_position()) << ": "
+ << pragma_token.get_value() << ": " << filename << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ }
+#endif
+
 private:
     std::string& hooks_trace;
 };

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 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -47,6 +47,7 @@
 //H 10: t_2_009.cpp(15): #if
 //H 11: t_2_009.cpp(15): #if !defined(FILE_002_009_CPP) : 0
 //H 06:
+//H 19: $B(t_2_009.cpp): FILE_002_009_CPP
 //H 10: t_2_009.cpp(29): #include
 //H 01: t_2_009.cpp(19): USER_HEADER
 //H 02: "t_2_009.cpp"

Added: trunk/libs/wave/test/testwave/testfiles/t_2_019.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_019.cpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -0,0 +1,61 @@
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+ http://www.boost.org/
+
+ Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
+ Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+// Check if #pragma once, include guard detection, and related hooks work as
+// expected
+
+#include "t_2_019_001.hpp" // #pragma once
+#include "t_2_019_002.hpp" // include guard style 1
+#include "t_2_019_003.hpp" // include guard style 2
+
+// repeat inclusion, should do nothing
+#include "t_2_019_001.hpp"
+#include "t_2_019_002.hpp"
+#include "t_2_019_003.hpp"
+
+//R #line 11 "t_2_019_001.hpp"
+//R t_2_019_001
+//R #line 16 "t_2_019_002.hpp"
+//R t_2_019_002
+//R #line 16 "t_2_019_003.hpp"
+//R t_2_019_003
+
+//H 10: t_2_019.cpp(13): #include "t_2_019_001.hpp"
+//H 04: "t_2_019_001.hpp"
+//H 05: $B(t_2_019_001.hpp) ($B(t_2_019_001.hpp))
+//H 10: t_2_019_001.hpp(10): #pragma
+//H 20: t_2_019_001.hpp(10): #pragma: $B(t_2_019_001.hpp)
+//H 06:
+//H 10: t_2_019.cpp(14): #include "t_2_019_002.hpp"
+//H 04: "t_2_019_002.hpp"
+//H 05: $B(t_2_019_002.hpp) ($B(t_2_019_002.hpp))
+//H 10: t_2_019_002.hpp(12): #if
+//H 11: t_2_019_002.hpp(12): #if !defined(T_2_019_002): 1
+//H 10: t_2_019_002.hpp(14): #define
+//H 08: t_2_019_002.hpp(14): T_2_019_002=
+//H 10: t_2_019_002.hpp(18): #endif
+//H 06:
+//H 19: $B(t_2_019_002.hpp): T_2_019_002
+//H 10: t_2_019.cpp(15): #include "t_2_019_003.hpp"
+//H 04: "t_2_019_003.hpp"
+//H 05: $B(t_2_019_003.hpp) ($B(t_2_019_003.hpp))
+//H 10: t_2_019_003.hpp(12): #ifndef
+//H 11: t_2_019_003.hpp(12): #ifndef T_2_019_003: 0
+//H 10: t_2_019_003.hpp(14): #define
+//H 08: t_2_019_003.hpp(14): T_2_019_003=
+//H 10: t_2_019_003.hpp(18): #endif
+//H 06:
+//H 19: $B(t_2_019_003.hpp): T_2_019_003
+//H 10: t_2_019.cpp(18): #include "t_2_019_001.hpp"
+//H 04: "t_2_019_001.hpp"
+//H 10: t_2_019.cpp(19): #include "t_2_019_002.hpp"
+//H 04: "t_2_019_002.hpp"
+//H 10: t_2_019.cpp(20): #include "t_2_019_003.hpp"
+//H 04: "t_2_019_003.hpp"
+

Added: trunk/libs/wave/test/testwave/testfiles/t_2_019_001.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_019_001.hpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -0,0 +1,11 @@
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+ http://www.boost.org/
+
+ Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
+ Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#pragma once
+t_2_019_001

Added: trunk/libs/wave/test/testwave/testfiles/t_2_019_002.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_019_002.hpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+ http://www.boost.org/
+
+ Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
+ Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#
+
+#if !defined(T_2_019_002)
+# // more comments here
+#define T_2_019_002
+
+t_2_019_002
+
+#endif
+# // and here
+

Added: trunk/libs/wave/test/testwave/testfiles/t_2_019_003.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/wave/test/testwave/testfiles/t_2_019_003.hpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -0,0 +1,20 @@
+/*=============================================================================
+ Boost.Wave: A Standard compliant C++ preprocessor library
+ http://www.boost.org/
+
+ Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
+ Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+#
+
+#ifndef T_2_019_003
+# // more comments here
+#define T_2_019_003
+
+t_2_019_003
+
+#endif
+# // and here
+

Modified: trunk/libs/wave/test/testwave/testfiles/t_9_016.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/t_9_016.cpp (original)
+++ trunk/libs/wave/test/testwave/testfiles/t_9_016.cpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -34,6 +34,7 @@
 //H 03: #
 //H 10: t_9_016.cpp(19): #endif
 //H 06:
+//H 19: $B(t_9_016.cpp): inclusion
 //H 10: t_9_016.cpp(13): # include "t_9_016.hpp"
 //H 04: "t_9_016.hpp"
 //H 05: $B(t_9_016.hpp) ($B(t_9_016.hpp))

Modified: trunk/libs/wave/test/testwave/testfiles/test.cfg
==============================================================================
--- trunk/libs/wave/test/testwave/testfiles/test.cfg (original)
+++ trunk/libs/wave/test/testwave/testfiles/test.cfg 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -71,6 +71,7 @@
 t_2_016.cpp
 t_2_017.cpp
 t_2_018.cpp
+t_2_019.cpp
 
 #
 # t_3: Predefined macros

Modified: trunk/tools/wave/trace_macro_expansion.hpp
==============================================================================
--- trunk/tools/wave/trace_macro_expansion.hpp (original)
+++ trunk/tools/wave/trace_macro_expansion.hpp 2009-09-19 15:57:09 EDT (Sat, 19 Sep 2009)
@@ -576,13 +576,13 @@
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
     ///////////////////////////////////////////////////////////////////////////
     //
- // The function 'detected_pragma_once' is called, whenever either a
+ // The function 'detected_include_guard' is called whenever either a
     // include file is about to be added to the list of #pragma once headers.
     // That means this header file will not be opened and parsed again even
     // if it is specified in a later #include directive.
- // This function is called either as the result of a detected directive
- // #pragma once, or as the result of a detected include guard scheme.
- //
+ // This function is called as the result of a detected include guard
+ // scheme.
+ //
     // The implemented heuristics for include guards detects two forms of
     // include guards:
     //
@@ -610,22 +610,17 @@
     // processed file or a absolute path depending on the paths given as the
     // include search paths).
     //
- // The parameter include_guard is either "__BOOST_WAVE_PRAGMA_ONCE__" (if
- // a #pragma once has been detected) or contains the name of the detected
- // include guard.
+ // The parameter contains the name of the detected include guard.
     //
     ///////////////////////////////////////////////////////////////////////////
     template <typename ContextT>
     void
- detected_pragma_once(ContextT const& ctx, std::string const& filename,
+ detected_include_guard(ContextT const& ctx, std::string const& filename,
         std::string const& include_guard)
- {
+ {
         if (enabled_guard_tracing()) {
- if (include_guard == "__BOOST_WAVE_PRAGMA_ONCE__")
- guardstrm << "#pragma once:" << std::endl;
- else
- guardstrm << include_guard << ":" << std::endl;
- guardstrm << " " << filename << std::endl;
+ guardstrm << include_guard << ":" << std::endl
+ << " " << filename << std::endl;
         }
     }
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk