From 2a7b593a807c4979edbbe4215951ab19c43494b1 Mon Sep 17 00:00:00 2001 From: yshui Date: Fri, 5 Jan 2018 03:10:40 +0800 Subject: [PATCH] Use gnu11 standard when none is specified (#231) Reference: 1. https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes 2. https://gcc.gnu.org/onlinedocs/gcc/Standards.html --- src/project.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/project.cc b/src/project.cc index 714b698e..c0c2cab1 100644 --- a/src/project.cc +++ b/src/project.cc @@ -137,7 +137,7 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry( } if (!AnyStartsWith(entry.args, "-std=")) { if (*source_file_type == "c") - result.args.push_back("-std=c11"); + result.args.push_back("-std=gnu11"); else if (*source_file_type == "c++") result.args.push_back("-std=c++11"); } @@ -516,7 +516,7 @@ TEST_SUITE("Project") { "/home/user", "/home/user/foo/bar.c", /* raw */ {"cc", "-O0", "foo/bar.c"}, /* 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"}); }