aboutsummaryrefslogtreecommitdiff
path: root/build2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-08-06 14:23:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-08-06 14:23:38 +0200
commit4a853594b0a27dca6576c64d7bb8e6f9340b066f (patch)
tree1fdaad73daabd80543106ca25cc883eec1c76e60 /build2/cc
parent55bc2627dcca7f126580a0d89d786004dab2653c (diff)
Filter out warning as error options during preprocessing
Diffstat (limited to 'build2/cc')
-rw-r--r--build2/cc/compile.cxx30
1 files changed, 17 insertions, 13 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx
index c703a8a..9fae3c6 100644
--- a/build2/cc/compile.cxx
+++ b/build2/cc/compile.cxx
@@ -1714,8 +1714,13 @@ namespace build2
// is to remove the -fmodules-ts option when preprocessing. Hopefully
// there will be a "pure modules" mode at some point.
//
- append_options (args, t, c_coptions);
- append_options (args, t, x_coptions);
+
+ // Don't treat warnings as errors.
+ //
+ const char* werror (cid == compiler_id::msvc ? "/WX" : "-Werror");
+
+ append_options (args, t, c_coptions, werror);
+ append_options (args, t, x_coptions, werror);
append_options (args, tstd,
tstd.size () -
(modules && cid == compiler_id::clang ? 1 : 0));
@@ -1775,15 +1780,8 @@ namespace build2
// Clang's -M does not imply -w (disable warnings). We also don't
// need them in the -MD case (see above) so disable for both.
//
- // For GCC we want warnings in -MD (see sense_diag) but we don't
- // want then to be treated as errors.
- //
- switch (cid)
- {
- case compiler_id::clang: args.push_back ("-w"); break;
- case compiler_id::gcc: args.push_back ("-Wno-error"); break;
- default: break;
- }
+ if (cid == compiler_id::clang)
+ args.push_back ("-w");
// Previously we used '*' as a target name but it gets expanded to
// the current directory file names by GCC (4.9) that comes with
@@ -2654,8 +2652,14 @@ namespace build2
if (md.symexport)
append_symexport_options (args, t);
- append_options (args, t, c_coptions);
- append_options (args, t, x_coptions);
+ // Make sure we don't fail because of warnings.
+ //
+ // @@ Can be both -WX and /WX.
+ //
+ const char* werror (cid == compiler_id::msvc ? "/WX" : "-Werror");
+
+ append_options (args, t, c_coptions, werror);
+ append_options (args, t, x_coptions, werror);
append_options (args, tstd,
tstd.size () -
(modules && cid == compiler_id::clang ? 1 : 0));