From e16723d6e720ccc18a7433fdb4edfed2ccc6b40c Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Tue, 10 Mar 2009 01:19:08 +0000 Subject: [PATCH] Wave: now compiles even with BOOST_FILESYSTEM_NO_DEPRECATED defined [SVN r51677] --- ChangeLog | 7 +- build/Jamfile.v2 | 2 +- include/boost/wave/util/cpp_include_paths.hpp | 45 +++++----- include/boost/wave/util/cpp_iterator.hpp | 19 ++-- include/boost/wave/util/cpp_macromap.hpp | 13 +-- .../boost/wave/util/unput_queue_iterator.hpp | 4 +- src/cpplexer/re2clex/cpp.re | 2 +- src/cpplexer/re2clex/strict_cpp.re | 2 +- test/build/Jamfile.v2 | 4 +- test/testwave/testfiles/test.cfg | 2 +- test/testwave/testwave.cpp | 28 +++--- test/testwave/testwave_app.cpp | 24 ++--- tool/cpp.cpp | 88 ++++++++++--------- tool/cpp_version.hpp | 4 +- tool/trace_macro_expansion.hpp | 10 +-- 15 files changed, 140 insertions(+), 114 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1adbd79..715c659 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,7 @@ Boost.Wave: A Standard compliant C++ preprocessor library http://www.boost.org/ -Copyright (c) 2001-2008 Hartmut Kaiser. Distributed under the Boost +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) ------------------------------------------------------------------------------- @@ -22,6 +22,11 @@ TODO (known issues): CHANGELOG +Boost V1.39.0 +- V2.0.1 +- Fixed Wave to compile with BOOST_FILESYSTEM_NO_DEPRECATED defined (i.e. the + library doesn't use the depracated filesystem interface anymore). + Boost V1.37.0 - Updated examples to reflect the recent changes in the used multi_pass iterator. diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index c3e0561..366270a 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -4,7 +4,7 @@ # # http://www.boost.org/ # -# Copyright (c) 2001-2008 Hartmut Kaiser. Distributed under the Boost +# 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) diff --git a/include/boost/wave/util/cpp_include_paths.hpp b/include/boost/wave/util/cpp_include_paths.hpp index 23a7c6b..5dda83d 100644 --- a/include/boost/wave/util/cpp_include_paths.hpp +++ b/include/boost/wave/util/cpp_include_paths.hpp @@ -16,6 +16,7 @@ #include #include +#include #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 #include @@ -148,8 +149,8 @@ private: public: include_paths() : was_sys_include_path(false), - current_dir(boost::filesystem::initial_path()), - current_rel_dir(boost::filesystem::initial_path()) + current_dir(initial_path()), + current_rel_dir(initial_path()) {} bool add_include_path(char const *path_, bool is_system = false) @@ -271,7 +272,7 @@ bool include_paths::add_include_path ( { namespace fs = boost::filesystem; if (path_) { - fs::path newpath = fs::complete(fs::path(path_, fs::native), current_dir); + fs::path newpath = fs::complete(create_path(path_), current_dir); if (!fs::exists(newpath) || !fs::is_directory(newpath)) { // the given path does not form a name of a valid file system directory @@ -307,9 +308,9 @@ bool include_paths::find_include_file (std::string &s, std::string &dir, // with the directory in the search path after the one where the current // file was found. - fs::path file_path (current_file, fs::native); + fs::path file_path (create_path(current_file)); for (/**/; it != include_paths_end; ++it) { - fs::path currpath ((*it).first.string(), fs::native); + fs::path currpath (create_path((*it).first.string())); if (std::equal(currpath.begin(), currpath.end(), file_path.begin())) { ++it; // start searching with the next directory @@ -320,21 +321,21 @@ bool include_paths::find_include_file (std::string &s, std::string &dir, #endif for (/**/; it != include_paths_end; ++it) { - fs::path currpath (s, fs::native); + fs::path currpath (create_path(s)); if (!currpath.has_root_directory()) { - currpath = fs::path((*it).first.string(), fs::native); - currpath /= fs::path(s, fs::native); // append filename + currpath = create_path((*it).first.string()); + currpath /= create_path(s); // append filename } if (fs::exists(currpath)) { - fs::path dirpath (s, fs::native); + fs::path dirpath (create_path(s)); if (!dirpath.has_root_directory()) { - dirpath = fs::path((*it).second, fs::native); - dirpath /= fs::path(s, fs::native); + dirpath = create_path((*it).second); + dirpath /= create_path(s); } dir = dirpath.string(); - s = currpath.normalize().string(); // found the required file + s = normalize(currpath).string(); // found the required file return true; } } @@ -354,23 +355,23 @@ include_paths::find_include_file (std::string &s, std::string &dir, if (!is_system) { if (!was_sys_include_path) { // set_sys_include_delimiter() not called // first have a look at the current directory - fs::path currpath (s, fs::native); + fs::path currpath (create_path(s)); if (!currpath.has_root_directory()) { - currpath = fs::path(current_dir.string(), fs::native); - currpath /= fs::path(s, fs::native); + currpath = create_path(current_dir.string()); + currpath /= create_path(s); } if (fs::exists(currpath) && 0 == current_file) { // if 0 != current_path (#include_next handling) it can't be // the file in the current directory - fs::path dirpath (s, fs::native); + fs::path dirpath (create_path(s)); if (!dirpath.has_root_directory()) { - dirpath = fs::path(current_rel_dir.string(), fs::native); - dirpath /= fs::path(s, fs::native); + dirpath = create_path(current_rel_dir.string()); + dirpath /= create_path(s); } dir = dirpath.string(); - s = currpath.normalize().string(); // found in local directory + s = normalize(currpath).string(); // found in local directory return true; } @@ -402,15 +403,15 @@ void include_paths::set_current_directory(char const *path_) { namespace fs = boost::filesystem; - fs::path filepath (path_, fs::native); + fs::path filepath (create_path(path_)); fs::path filename = fs::complete(filepath, current_dir); if (fs::exists(filename) && fs::is_directory(filename)) { current_dir = filename; current_rel_dir = filepath; } else { - current_dir = filename.branch_path(); - current_rel_dir = filepath.branch_path(); + current_dir = branch_path(filename); + current_rel_dir = branch_path(filepath); } } diff --git a/include/boost/wave/util/cpp_iterator.hpp b/include/boost/wave/util/cpp_iterator.hpp index a1af881..f80b9a0 100644 --- a/include/boost/wave/util/cpp_iterator.hpp +++ b/include/boost/wave/util/cpp_iterator.hpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -755,11 +756,11 @@ typename ContextT::position_type pos = act_token.get_position(); // unput the complete #line directive in reverse order std::string file("\""); - boost::filesystem::path filename(act_pos.get_file().c_str(), - boost::filesystem::native); + boost::filesystem::path filename( + wave::util::create_path(act_pos.get_file().c_str())); - using boost::wave::util::impl::escape_lit; - file += escape_lit(filename.native_file_string()) + "\""; + using wave::util::impl::escape_lit; + file += escape_lit(wave::util::native_file_string(filename)) + "\""; // 21 is the max required size for a 64 bit integer represented as a // string @@ -1513,7 +1514,7 @@ char const *current_name = 0; // never try to match current file name return false; } -fs::path native_path(file_path, fs::native); +fs::path native_path(wave::util::create_path(file_path)); if (!fs::exists(native_path)) { BOOST_WAVE_THROW_CTX(ctx, preprocess_exception, bad_include_file, @@ -1523,15 +1524,17 @@ fs::path native_path(file_path, fs::native); // test, if this file is known through a #pragma once directive #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0 - if (!ctx.has_pragma_once(native_path.native_file_string())) + if (!ctx.has_pragma_once(wave::util::native_file_string(native_path))) #endif { // the new include file determines the actual current directory - ctx.set_current_directory(native_path.native_file_string().c_str()); + ctx.set_current_directory( + wave::util::native_file_string(native_path).c_str()); // preprocess the opened file boost::shared_ptr new_iter_ctx ( - new iteration_context_type(ctx, native_path.native_file_string().c_str(), + new iteration_context_type(ctx, + wave::util::native_file_string(native_path).c_str(), act_pos, boost::wave::enable_prefer_pp_numbers(ctx.get_language()))); // call the include policy trace function diff --git a/include/boost/wave/util/cpp_macromap.hpp b/include/boost/wave/util/cpp_macromap.hpp index 2bf5c43..59c709c 100644 --- a/include/boost/wave/util/cpp_macromap.hpp +++ b/include/boost/wave/util/cpp_macromap.hpp @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -1414,10 +1415,10 @@ string_type const &value = curr_token.get_value(); namespace fs = boost::filesystem; std::string file("\""); - fs::path filename(main_pos.get_file().c_str(), fs::native); + fs::path filename(wave::util::create_path(main_pos.get_file().c_str())); using boost::wave::util::impl::escape_lit; - file += escape_lit(filename.native_file_string()) + "\""; + file += escape_lit(wave::util::native_file_string(filename)) + "\""; expanded.push_back(token_type(T_STRINGLIT, file.c_str(), curr_token.get_position())); return true; @@ -1846,21 +1847,21 @@ position_type pos(""); // predefine the __BASE_FILE__ macro which contains the main file name namespace fs = boost::filesystem; if (string_type(fname) != "") { - fs::path filename(fname, fs::native); + fs::path filename(create_path(fname)); using boost::wave::util::impl::escape_lit; predefine_macro(current_scope, "__BASE_FILE__", token_type(T_STRINGLIT, string_type("\"") + - escape_lit(filename.native_file_string()).c_str() + "\"", pos)); + escape_lit(native_file_string(filename)).c_str() + "\"", pos)); base_name = fname; } else if (!base_name.empty()) { - fs::path filename(base_name.c_str(), fs::native); + fs::path filename(create_path(base_name.c_str())); using boost::wave::util::impl::escape_lit; predefine_macro(current_scope, "__BASE_FILE__", token_type(T_STRINGLIT, string_type("\"") + - escape_lit(filename.native_file_string()).c_str() + "\"", pos)); + escape_lit(native_file_string(filename)).c_str() + "\"", pos)); } // now add the dynamic macros diff --git a/include/boost/wave/util/unput_queue_iterator.hpp b/include/boost/wave/util/unput_queue_iterator.hpp index af08bd1..606e5b3 100644 --- a/include/boost/wave/util/unput_queue_iterator.hpp +++ b/include/boost/wave/util/unput_queue_iterator.hpp @@ -219,12 +219,12 @@ public: // objects are equal and the base iterators are equal as well OtherDerivedT const &rhs = static_cast(x); return - (unput_queue.empty() && rhs.unput_queue.empty() || + ((unput_queue.empty() && rhs.unput_queue.empty()) || (&unput_queue == &rhs.unput_queue && unput_queue.begin() == rhs.unput_queue.begin() ) ) && - get_base_iterator() == rhs.get_base_iterator(); + (get_base_iterator() == rhs.get_base_iterator()); } private: diff --git a/src/cpplexer/re2clex/cpp.re b/src/cpplexer/re2clex/cpp.re index 958b79d..2ae1ba8 100644 --- a/src/cpplexer/re2clex/cpp.re +++ b/src/cpplexer/re2clex/cpp.re @@ -2,7 +2,7 @@ Boost.Wave: A Standard compliant C++ preprocessor library Copyright (c) 2001 Daniel C. Nuffer - Copyright (c) 2001-2008 Hartmut Kaiser. + 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) diff --git a/src/cpplexer/re2clex/strict_cpp.re b/src/cpplexer/re2clex/strict_cpp.re index 75b906a..7cdb3fe 100644 --- a/src/cpplexer/re2clex/strict_cpp.re +++ b/src/cpplexer/re2clex/strict_cpp.re @@ -2,7 +2,7 @@ Boost.Wave: A Standard compliant C++ preprocessor library Copyright (c) 2001 Daniel C. Nuffer - Copyright (c) 2001-2008 Hartmut Kaiser. + 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) diff --git a/test/build/Jamfile.v2 b/test/build/Jamfile.v2 index b033960..eabfeca 100644 --- a/test/build/Jamfile.v2 +++ b/test/build/Jamfile.v2 @@ -4,7 +4,7 @@ # # http://www.boost.org/ # -# Copyright (c) 2001-2008 Hartmut Kaiser. Distributed under the Boost +# 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) @@ -104,7 +104,7 @@ test-suite wave # requirements multi debug - static # Linking to DLL tested by testwave_dll + static # Linking to DLL tested by testwave_dll msvc-8.0:_SCL_SECURE_NO_DEPRECATE msvc-8.0:_CRT_SECURE_NO_DEPRECATE # BOOST_LIB_DIAGNOSTIC=1 diff --git a/test/testwave/testfiles/test.cfg b/test/testwave/testfiles/test.cfg index de6c9b4..26191ef 100644 --- a/test/testwave/testfiles/test.cfg +++ b/test/testwave/testfiles/test.cfg @@ -2,7 +2,7 @@ # Boost.Wave: A Standard compliant C++ preprocessor library # http://www.boost.org/ # -# Copyright (c) 2003-2008 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2003-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) # diff --git a/test/testwave/testwave.cpp b/test/testwave/testwave.cpp index 164b339..8f9ed4d 100644 --- a/test/testwave/testwave.cpp +++ b/test/testwave/testwave.cpp @@ -14,6 +14,7 @@ // include boost #include +#include #include #include @@ -178,29 +179,33 @@ main(int argc, char *argv[]) { // correct the file name (pre-pend the config file path) fs::path cfgpath = fs::complete( - fs::path(*cit, fs::native), fs::current_path()); + boost::wave::util::create_path(*cit), + boost::wave::util::current_path()); fs::path filepath = - cfgpath.branch_path() / fs::path(*iit, fs::native); + boost::wave::util::branch_path(cfgpath) / + boost::wave::util::create_path(*iit); if (9 == app.get_debuglevel()) { std::cerr << std::string(79, '-') << std::endl; std::cerr << "executing test: " - << filepath.native_file_string() + << boost::wave::util::native_file_string(filepath) << std::endl; } // execute this unit test case - if (!app.test_a_file(filepath.native_file_string())) { + if (!app.test_a_file( + boost::wave::util::native_file_string(filepath))) + { if (9 == app.get_debuglevel()) { std::cerr << "failed to execute test: " - << filepath.native_file_string() + << boost::wave::util::native_file_string(filepath) << std::endl; } ++error_count; } else if (9 == app.get_debuglevel()) { std::cerr << "succeeded to execute test: " - << filepath.native_file_string() + << boost::wave::util::native_file_string(filepath) << std::endl; } ++input_count; @@ -231,26 +236,27 @@ main(int argc, char *argv[]) for (std::vector::const_iterator arg = arguments.begin(); arg != arg_end; ++arg) { - fs::path filepath((*arg).value[0], fs::native); + fs::path filepath(boost::wave::util::create_path((*arg).value[0])); if (9 == app.get_debuglevel()) { std::cerr << std::string(79, '-') << std::endl; std::cerr << "executing test: " - << filepath.native_file_string() + << boost::wave::util::native_file_string(filepath) << std::endl; } - if (!app.test_a_file(filepath.native_file_string())) { + if (!app.test_a_file(boost::wave::util::native_file_string(filepath))) + { if (9 == app.get_debuglevel()) { std::cerr << "failed to execute test: " - << filepath.native_file_string() + << boost::wave::util::native_file_string(filepath) << std::endl; } ++error_count; } else if (9 == app.get_debuglevel()) { std::cerr << "succeeded to execute test: " - << filepath.native_file_string() + << boost::wave::util::native_file_string(filepath) << std::endl; } diff --git a/test/testwave/testwave_app.cpp b/test/testwave/testwave_app.cpp index 07b72df..070b8b4 100644 --- a/test/testwave/testwave_app.cpp +++ b/test/testwave/testwave_app.cpp @@ -66,9 +66,9 @@ namespace { using boost::wave::util::impl::unescape_lit; String unesc_name = unescape_lit(name.substr(1, name.size()-2)); - fs::path p (unesc_name.c_str(), fs::native); + fs::path p (boost::wave::util::create_path(unesc_name.c_str())); - name = String("\"") + p.leaf().c_str() + String("\""); + name = String("\"") + boost::wave::util::leaf(p).c_str() + String("\""); return name; } @@ -180,7 +180,8 @@ testwave_app::got_expected_result(std::string const& filename, { fs::path fullpath ( fs::complete( - fs::path(filename, fs::native), fs::current_path()) + boost::wave::util::create_path(filename), + boost::wave::util::current_path()) ); if ('(' == expected[pos1+2]) { @@ -193,16 +194,17 @@ testwave_app::got_expected_result(std::string const& filename, return false; } std::string base = expected.substr(pos1+3, p-pos1-3); - fullpath = fullpath.branch_path() / - fs::path(base, fs::native); + fullpath = boost::wave::util::branch_path(fullpath) / + boost::wave::util::create_path(base); full_result += expected.substr(pos, pos1-pos); if ('P' == expected[pos1+1]) { - full_result += - escape_lit(fullpath.normalize().native_file_string()); + full_result += escape_lit( + boost::wave::util::native_file_string( + boost::wave::util::normalize(fullpath))); } else { - full_result += - escape_lit(fullpath.normalize().string()); + full_result += escape_lit( + boost::wave::util::normalize(fullpath).string()); } pos1 = expected.find_first_of ("$", pos = pos1 + 4 + base.size()); @@ -211,8 +213,8 @@ testwave_app::got_expected_result(std::string const& filename, // the $P is used on its own full_result += expected.substr(pos, pos1-pos); if ('P' == expected[pos1+1]) { - full_result += - escape_lit(fullpath.native_file_string()); + full_result += escape_lit( + boost::wave::util::native_file_string(fullpath)); } else { full_result += diff --git a/tool/cpp.cpp b/tool/cpp.cpp index 14b523c..222177f 100644 --- a/tool/cpp.cpp +++ b/tool/cpp.cpp @@ -78,7 +78,6 @@ typedef boost::archive::text_oarchive oarchive; // Import required names using namespace boost::spirit::classic; -using std::string; using std::pair; using std::vector; using std::getline; @@ -113,11 +112,11 @@ using std::istreambuf_iterator; /////////////////////////////////////////////////////////////////////////////// // print the current version -string get_version() +std::string get_version() { - string version (context_type::get_version_string()); + std::string version (context_type::get_version_string()); version = version.substr(1, version.size()-2); // strip quotes - version += string(" (" CPP_VERSION_DATE_STR ")"); // add date + version += std::string(" (" CPP_VERSION_DATE_STR ")"); // add date return version; } @@ -139,7 +138,7 @@ int print_copyright() "Wave: A Standard conformant C++ preprocessor based on the Boost.Wave library", "http://www.boost.org/", "", - "Copyright (c) 2001-2008 Hartmut Kaiser, Distributed under the Boost", + "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)", 0 @@ -176,13 +175,13 @@ namespace cmd_line_utils { // Additional command line parser which interprets '@something' as an // option "config-file" with the value "something". - inline pair - at_option_parser(string const&s) + inline pair + at_option_parser(std::string const&s) { if ('@' == s[0]) - return std::make_pair(string("config-file"), s.substr(1)); + return std::make_pair(std::string("config-file"), s.substr(1)); else - return pair(); + return pair(); } // class, which keeps include file information read from the command line @@ -190,13 +189,13 @@ namespace cmd_line_utils { public: include_paths() : seen_separator(false) {} - vector paths; // stores user paths - vector syspaths; // stores system paths + vector paths; // stores user paths + vector syspaths; // stores system paths bool seen_separator; // command line contains a '-I-' option // Function which validates additional tokens from command line. static void - validate(boost::any &v, vector const &tokens) + validate(boost::any &v, vector const &tokens) { if (v.empty()) v = boost::any(include_paths()); @@ -205,7 +204,7 @@ namespace cmd_line_utils { BOOST_ASSERT(p); // Assume only one path per '-I' occurrence. - string const& t = po::validators::get_single_string(tokens); + std::string const& t = po::validators::get_single_string(tokens); if (t == "-") { // found -I- option, so switch behaviour p->seen_separator = true; @@ -223,7 +222,7 @@ namespace cmd_line_utils { // Read all options from a given config file, parse and add them to the // given variables_map - bool read_config_file_options(string const &filename, + bool read_config_file_options(std::string const &filename, po::options_description const &desc, po::variables_map &vm, bool may_fail = false) { @@ -238,20 +237,20 @@ namespace cmd_line_utils { return false; } - vector options; - string line; + vector options; + std::string line; while (std::getline(ifs, line)) { // skip empty lines - string::size_type pos = line.find_first_not_of(" \t"); - if (pos == string::npos) + std::string::size_type pos = line.find_first_not_of(" \t"); + if (pos == std::string::npos) continue; // skip comment lines if ('#' != line[pos]) { // strip leading and trailing whitespace - string::size_type endpos = line.find_last_not_of(" \t"); - BOOST_ASSERT(endpos != string::npos); + std::string::size_type endpos = line.find_last_not_of(" \t"); + BOOST_ASSERT(endpos != std::string::npos); options.push_back(line.substr(pos, endpos-pos+1)); } } @@ -454,9 +453,10 @@ namespace { #if BOOST_WAVE_SERIALIZATION != 0 try { if (vm.count("state") > 0) { - fs::path state_file (vm["state"].as(), fs::native); + fs::path state_file ( + boost::wave::util::create_path(vm["state"].as())); if (state_file == "-") - state_file = fs::path("wave.state", fs::native); + state_file = boost::wave::util::create_path("wave.state"); std::ios::openmode mode = std::ios::in; @@ -498,9 +498,10 @@ namespace { #if BOOST_WAVE_SERIALIZATION != 0 try { if (vm.count("state") > 0) { - fs::path state_file (vm["state"].as(), fs::native); + fs::path state_file (boost::wave::util::create_path( + vm["state"].as())); if (state_file == "-") - state_file = fs::path("wave.state", fs::native); + state_file = boost::wave::util::create_path("wave.state"); std::ios::openmode mode = std::ios::out; @@ -535,11 +536,11 @@ namespace { { // open file for macro names listing std::ofstream macronames_out; - fs::path macronames_file (filename, fs::native); + fs::path macronames_file (boost::wave::util::create_path(filename)); if (macronames_file != "-") { macronames_file = fs::complete(macronames_file); - fs::create_directories(macronames_file.branch_path()); + fs::create_directories(boost::wave::util::branch_path(macronames_file)); macronames_out.open(macronames_file.string().c_str()); if (!macronames_out.is_open()) { cerr << "wave: could not open file for macro name listing: " @@ -640,10 +641,11 @@ int error_count = 0; if (vm.count("traceto")) { // try to open the file, where to put the trace output - fs::path trace_file (vm["traceto"].as(), fs::native); + fs::path trace_file (boost::wave::util::create_path( + vm["traceto"].as())); if (trace_file != "-") { - fs::create_directories(trace_file.branch_path()); + fs::create_directories(boost::wave::util::branch_path(trace_file)); traceout.open(trace_file.string().c_str()); if (!traceout.is_open()) { cerr << "wave: could not open trace file: " << trace_file @@ -663,10 +665,11 @@ int error_count = 0; // Open the stream where to output the list of included file names if (vm.count("listincludes")) { // try to open the file, where to put the include list - fs::path includes_file(vm["listincludes"].as(), fs::native); + fs::path includes_file(boost::wave::util::create_path( + vm["listincludes"].as())); if (includes_file != "-") { - fs::create_directories(includes_file.branch_path()); + fs::create_directories(boost::wave::util::branch_path(includes_file)); includelistout.open(includes_file.string().c_str()); if (!includelistout.is_open()) { cerr << "wave: could not open include list file: " @@ -880,7 +883,8 @@ int error_count = 0; // open the output file if (vm.count("output")) { // try to open the file, where to put the preprocessed output - fs::path out_file (vm["output"].as(), fs::native); + fs::path out_file (boost::wave::util::create_path( + vm["output"].as())); if (out_file == "-") { allow_output = false; // inhibit output initially @@ -888,7 +892,7 @@ int error_count = 0; } else { out_file = fs::complete(out_file); - fs::create_directories(out_file.branch_path()); + fs::create_directories(boost::wave::util::branch_path(out_file)); output.open(out_file.string().c_str()); if (!output.is_open()) { cerr << "wave: could not open output file: " @@ -900,15 +904,15 @@ int error_count = 0; } else if (!input_is_stdin && vm.count("autooutput")) { // generate output in the file .i - fs::path out_file (file_name, fs::native); - std::string basename (out_file.leaf()); + fs::path out_file (boost::wave::util::create_path(file_name)); + std::string basename (boost::wave::util::leaf(out_file)); std::string::size_type pos = basename.find_last_of("."); if (std::string::npos != pos) basename = basename.substr(0, pos); - out_file = out_file.branch_path() / (basename + ".i"); + out_file = boost::wave::util::branch_path(out_file) / (basename + ".i"); - fs::create_directories(out_file.branch_path()); + fs::create_directories(boost::wave::util::branch_path(out_file)); output.open(out_file.string().c_str()); if (!output.is_open()) { cerr << "wave: could not open output file: " @@ -1182,7 +1186,7 @@ main (int argc, char *argv[]) // // Try to find a wave.cfg in the same directory as the executable was // // started from. If this exists, treat it as a wave config file -// fs::path filename(argv[0], fs::native); +// fs::path filename(argv[0]); // // filename = filename.branch_path() / "wave.cfg"; // cmd_line_utils::read_config_file_options(filename.string(), @@ -1199,8 +1203,12 @@ main (int argc, char *argv[]) // file for all files in a certain project. if (arguments.size() > 0 && arguments[0].value[0] != "-") { // construct full path of input file - fs::path input_dir (fs::complete(fs::path(arguments[0].value[0], fs::native))); - input_dir = input_dir.normalize().branch_path(); // chop of file name + fs::path input_dir (fs::complete( + boost::wave::util::create_path(arguments[0].value[0]))); + + // chop of file name + input_dir = boost::wave::util::branch_path( + boost::wave::util::normalize(input_dir)); // walk up the hierarchy, trying to find a file wave.cfg while (!input_dir.empty()) { @@ -1210,7 +1218,7 @@ main (int argc, char *argv[]) { break; // break on the first cfg file found } - input_dir = input_dir.branch_path(); + input_dir = boost::wave::util::branch_path(input_dir); } } diff --git a/tool/cpp_version.hpp b/tool/cpp_version.hpp index 5789366..d34d213 100644 --- a/tool/cpp_version.hpp +++ b/tool/cpp_version.hpp @@ -19,7 +19,7 @@ #define CPP_VERSION_FULL_STR BOOST_PP_STRINGIZE(CPP_VERSION_FULL) -#define CPP_VERSION_DATE 20080407L -#define CPP_VERSION_DATE_STR "20080407" +#define CPP_VERSION_DATE 20090309L +#define CPP_VERSION_DATE_STR "20090309" #endif // !defined(CPP_VERSION_HPP_CE4FE67F_63F9_468D_8364_C855F89D3C5D_INCLUDED) diff --git a/tool/trace_macro_expansion.hpp b/tool/trace_macro_expansion.hpp index 23e84f4..0b60775 100644 --- a/tool/trace_macro_expansion.hpp +++ b/tool/trace_macro_expansion.hpp @@ -26,6 +26,7 @@ #include #include +#include #include #include #include @@ -820,7 +821,7 @@ protected: namespace fs = boost::filesystem; // ensure all directories for this file do exist - fs::create_directories(fpath.branch_path()); + fs::create_directories(boost::wave::util::branch_path(fpath)); // figure out, whether the file to open was last accessed by us std::ios::openmode mode = std::ios::out; @@ -873,9 +874,8 @@ protected: namespace fs = boost::filesystem; string_type fname ((*it).get_value()); - fs::path fpath ( - util::impl::unescape_lit(fname.substr(1, fname.size()-2)).c_str(), - fs::native); + fs::path fpath (boost::wave::util::create_path( + util::impl::unescape_lit(fname.substr(1, fname.size()-2)).c_str())); fpath = fs::complete(fpath, ctx.get_current_directory()); result = interpret_pragma_option_output_open(fpath, ctx, act_token); } @@ -932,7 +932,7 @@ protected: } else { // there was a file name on the command line - fs::path fpath(default_outfile, fs::native); + fs::path fpath(boost::wave::util::create_path(default_outfile)); result = interpret_pragma_option_output_open(fpath, ctx, act_token); }