瀏覽代碼

We want -MQ instead of -MT for mkfile deps

default_compile_flags
vector-of-bool 4 年之前
父節點
當前提交
9a02f2436c
共有 4 個文件被更改,包括 26 次插入13 次删除
  1. +7
    -0
      src/dds/build/file_deps.test.cpp
  2. +7
    -1
      src/dds/build/plan/compile_exec.cpp
  3. +11
    -11
      src/dds/toolchain/from_json.test.cpp
  4. +1
    -1
      src/dds/toolchain/toolchain.cpp

+ 7
- 0
src/dds/build/file_deps.test.cpp 查看文件

@@ -12,6 +12,13 @@ TEST_CASE("Parse Makefile deps") {
deps = dds::parse_mkfile_deps_str("foo.o: bar.c \\\n baz.c");
CHECK(deps.output == "foo.o");
CHECK(deps.inputs == path_vec("bar.c", "baz.c"));

deps = dds::parse_mkfile_deps_str(
"/some-path/Ю́рий\\ Алексе́евич\\ Гага́рин/build/obj/foo.main.cpp.o: \\\n"
" /foo.main.cpp \\\n"
" /stdc-predef.h\n");
CHECK(deps.output == "/some-path/Ю́рий Алексе́евич Гага́рин/build/obj/foo.main.cpp.o");
CHECK(deps.inputs == path_vec("/foo.main.cpp", "/stdc-predef.h"));
}

TEST_CASE("Invalid deps") {

+ 7
- 1
src/dds/build/plan/compile_exec.cpp 查看文件

@@ -8,6 +8,7 @@
#include <dds/util/string.hpp>
#include <dds/util/time.hpp>

#include <neo/assert.hpp>
#include <range/v3/range/conversion.hpp>
#include <range/v3/view/filter.hpp>
#include <range/v3/view/transform.hpp>
@@ -91,7 +92,12 @@ do_compile(const compile_file_full& cf, build_env_ref env, compile_counter& coun
} else {
dds_log(trace, "Loading compilation dependencies from {}", df_path.string());
auto dep_info = dds::parse_mkfile_deps_file(df_path);
assert(dep_info.output == cf.object_file_path);
neo_assert(invariant,
dep_info.output == cf.object_file_path,
"Generated mkfile deps output path does not match the object file path that "
"we gave it to compile into.",
dep_info.output.string(),
cf.object_file_path.string());
dep_info.command = quote_command(cf.cmd_info.command);
dep_info.command_output = compiler_output;
ret_deps_info = std::move(dep_info);

+ 11
- 11
src/dds/toolchain/from_json.test.cpp 查看文件

@@ -48,32 +48,32 @@ void check_tc_compile(std::string_view tc_content,

TEST_CASE("Generating toolchain commands") {
check_tc_compile("{compiler_id: 'gnu'}",
"g++ -fPIC -pthread -MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o",
"g++ -fPIC -pthread -MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"g++ -fPIC -pthread -Wall -Wextra -Wpedantic -Wconversion "
"-MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o",
"-MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"ar rcs stuff.a foo.o bar.o",
"g++ -fPIC foo.o bar.a -pthread -omeow.exe");

check_tc_compile("{compiler_id: 'gnu', debug: true}",
"g++ -g -fPIC -pthread -MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o",
"g++ -g -fPIC -pthread -MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"g++ -g -fPIC -pthread -Wall -Wextra -Wpedantic -Wconversion "
"-MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o",
"-MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"ar rcs stuff.a foo.o bar.o",
"g++ -fPIC foo.o bar.a -pthread -omeow.exe -g");

check_tc_compile("{compiler_id: 'gnu', debug: true, optimize: true}",
"g++ -O2 -g -fPIC -pthread -MD -MF foo.o.d -MT foo.o -c foo.cpp "
"g++ -O2 -g -fPIC -pthread -MD -MF foo.o.d -MQ foo.o -c foo.cpp "
"-ofoo.o",
"g++ -O2 -g -fPIC -pthread -Wall -Wextra -Wpedantic -Wconversion "
"-MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o",
"-MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"ar rcs stuff.a foo.o bar.o",
"g++ -fPIC foo.o bar.a -pthread -omeow.exe -O2 -g");

check_tc_compile(
"{compiler_id: 'gnu', debug: 'split', optimize: true}",
"g++ -O2 -g -gsplit-dwarf -fPIC -pthread -MD -MF foo.o.d -MT foo.o -c foo.cpp -ofoo.o",
"g++ -O2 -g -gsplit-dwarf -fPIC -pthread -MD -MF foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"g++ -O2 -g -gsplit-dwarf -fPIC -pthread -Wall -Wextra -Wpedantic -Wconversion -MD -MF "
"foo.o.d -MT foo.o -c foo.cpp -ofoo.o",
"foo.o.d -MQ foo.o -c foo.cpp -ofoo.o",
"ar rcs stuff.a foo.o bar.o",
"g++ -fPIC foo.o bar.a -pthread -omeow.exe -O2 -g -gsplit-dwarf");

@@ -145,7 +145,7 @@ TEST_CASE("Manipulate a toolchain and file compilation") {
"-MD",
"-MF",
"foo.o.d",
"-MT",
"-MQ",
"foo.o",
"-c",
"foo.cpp",
@@ -165,7 +165,7 @@ TEST_CASE("Manipulate a toolchain and file compilation") {
"-MD",
"-MF",
"foo.o.d",
"-MT",
"-MQ",
"foo.o",
"-c",
"foo.cpp",
@@ -184,7 +184,7 @@ TEST_CASE("Manipulate a toolchain and file compilation") {
"-MD",
"-MF",
"foo.o.d",
"-MT",
"-MQ",
"foo.o",
"-c",
"foo.cpp",

+ 1
- 1
src/dds/toolchain/toolchain.cpp 查看文件

@@ -129,7 +129,7 @@ compile_command_info toolchain::create_compile_command(const compile_file_spec&
{"-MD"sv,
"-MF"sv,
std::string_view(gnu_depfile_path->string()),
"-MT"sv,
"-MQ"sv,
std::string_view(spec.out_path.string())});
} else if (_deps_mode == file_deps_mode::msvc) {
flags.push_back("/showIncludes");

Loading…
取消
儲存