diff --git a/drivers/lang/c/src/gcc/driver.c b/drivers/lang/c/src/gcc/driver.c index e33c1c1..0e9e6ee 100644 --- a/drivers/lang/c/src/gcc/driver.c +++ b/drivers/lang/c/src/gcc/driver.c @@ -136,7 +136,6 @@ void gcc_add_std( } else if (lang == BAKE_SRC_LANG_C) { ut_strbuf_append(cmd, " -std=%s ", driver->get_attr_string("c-standard")); - ut_strbuf_append(cmd, " -D_XOPEN_SOURCE=600"); } ut_strbuf_appendstr(cmd, " -Wall -W -Wextra -pedantic"); diff --git a/drivers/lang/c/src/main.c b/drivers/lang/c/src/main.c index 1cc7bb1..3f27738 100644 --- a/drivers/lang/c/src/main.c +++ b/drivers/lang/c/src/main.c @@ -176,6 +176,12 @@ bool is_clang(bake_src_lang lang) return is_compiler("clang", lang); } +/* Is current compiler msvc */ +static +bool is_gcc(void) { + return is_compiler("gcc", 0); +} + /* Is current compiler emcc */ static bool is_emcc(void) { @@ -194,9 +200,10 @@ bool is_msvc(void) { return is_compiler("cl.exe", 0); } +/* Is current compiler mingw */ static bool is_mingw(void) { - return is_compiler("gcc", 0) && is_msys(); + return is_gcc() && is_msys(); } /* Is binary a dylib */ @@ -256,7 +263,11 @@ void init( driver->set_attr_string("cpp-standard", "c++0x"); } if (!driver->get_attr("c-standard")) { - driver->set_attr_string("c-standard", "c99"); + if (is_gcc() || is_clang(BAKE_SRC_LANG_C)) { + driver->set_attr_string("c-standard", "gnu99"); + } else { + driver->set_attr_string("c-standard", "c99"); + } } if (!driver->get_attr("precompile-header")) { #ifndef _WIN32