diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-25 20:27:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-25 20:27:12 +0200 |
commit | 896c2e1af6a8a82c976651d757115ea1033e7b82 (patch) | |
tree | eb4ee32b2e0b188d05873bf199525bd2b6bef9d9 | |
parent | c680bdb672c2ee69190d2021b0f7b10574ded6bd (diff) |
Fix bug in switching to preprocessed source
-rw-r--r-- | build2/cc/compile.cxx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index b2648dd..bd54f35 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -3302,7 +3302,7 @@ namespace build2 md.mods.copied)); // See search_modules() for details. const file& s (pr.second); - const path& sp (s.path ()); + const path* sp (&s.path ()); if (pr.first) { @@ -3472,9 +3472,9 @@ namespace build2 // Note: no way to indicate that the source if already preprocessed. - args.push_back ("/c"); // Compile only. - args.push_back (langopt (md)); // Compile as. - args.push_back (sp.string ().c_str ()); // Note: rely on being last. + args.push_back ("/c"); // Compile only. + args.push_back (langopt (md)); // Compile as. + args.push_back (sp->string ().c_str ()); // Note: relied on being last. } else { @@ -3575,7 +3575,7 @@ namespace build2 } } - args.push_back (sp.string ().c_str ()); + args.push_back (sp->string ().c_str ()); } args.push_back (nullptr); @@ -3601,6 +3601,8 @@ namespace build2 args.pop_back (); // nullptr args.pop_back (); // sp + sp = &md.psrc.path; + // This should match with how we setup preprocessing. // switch (cid) @@ -3631,7 +3633,7 @@ namespace build2 assert (false); } - args.push_back (md.psrc.path.string ().c_str ()); + args.push_back (sp->string ().c_str ()); args.push_back (nullptr); // Let's keep the preprocessed file in case of an error but only at @@ -3670,7 +3672,7 @@ namespace build2 ifdstream is ( move (pr.in_ofd), fdstream_mode::text, ifdstream::badbit); - msvc_filter_cl (is, sp); + msvc_filter_cl (is, *sp); // If anything remains in the stream, send it all to stderr. Note // that the eof check is important: if the stream is at eof, this |