yshui 2018-01-05 03:10:40 +08:00 committed by Fangrui Song
parent e2ce134e1f
commit 2a7b593a80

View File

@ -137,7 +137,7 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
} }
if (!AnyStartsWith(entry.args, "-std=")) { if (!AnyStartsWith(entry.args, "-std=")) {
if (*source_file_type == "c") if (*source_file_type == "c")
result.args.push_back("-std=c11"); result.args.push_back("-std=gnu11");
else if (*source_file_type == "c++") else if (*source_file_type == "c++")
result.args.push_back("-std=c++11"); result.args.push_back("-std=c++11");
} }
@ -516,7 +516,7 @@ TEST_SUITE("Project") {
"/home/user", "/home/user/foo/bar.c", "/home/user", "/home/user/foo/bar.c",
/* raw */ {"cc", "-O0", "foo/bar.c"}, /* raw */ {"cc", "-O0", "foo/bar.c"},
/* expected */ /* expected */
{"cc", "-working-directory", "/home/user", "-xc", "-std=c11", "-O0", "-resource-dir=/w/resource_dir/", {"cc", "-working-directory", "/home/user", "-xc", "-std=gnu11", "-O0", "-resource-dir=/w/resource_dir/",
"-Wno-unknown-warning-option", "-fparse-all-comments"}); "-Wno-unknown-warning-option", "-fparse-all-comments"});
} }