Hartmut Kaiser wrote: > > However, it seems to be confused by the preprocessor library. > > Since the > > includes sometime have the form: > > > > #include BOOST_PP_ITERATE() > > > > the 'bcp' tool does not find them. For example, > > "boost/preprocessor/iteration/detail/iter directory is needed by > > boost/function.hpp but is not included. > > Is it overkill to use Wave for this? It would solve the > mentioned problem by correctly preprocessing the inspected sources.
Here is the (main) code, which uses Wave to output the file names of all successfully opened include files (this needs some filtering to avoid double output of the same file): #include "wave/cpp_context.hpp" using namespace std; struct trace_include_files { void opened_include_file(string const &filename, size_t include_depth) { // print indented filename for (size_t i = 0; i < include_depth; ++i) cout << " "; cout << filename << endl; } }; // open the file to inspect ifstream instream(filename); string instring; instream.unsetf(ios::skipws); instring = string( istreambuf_iterator<char>(instream.rdbuf()), istreambuf_iterator<char>()); typedef wave::context< std::string::iterator, wave::cpplexer::lex_token<>, wave::iteration_context_policies::load_file_to_string, trace_include_files > context_t; // construct the wave::context object context_t ctx (instring.begin(), instring.end(), filename); context_t::iterator_t first = ctx.begin(); context_t::iterator_t last = ctx.end(); // iterate over the generated pp tokens while (first != last) ++first; // ignore the generated tokens I've left off the initializing of the include search pathes ... Pretty neat, huh? Regards Hartmut _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost