diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-02 15:18:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-08-02 15:18:25 +0200 |
commit | 083743602a998c7618f65fc214bdbc1ed1915e55 (patch) | |
tree | ec8a3441ad232e31591a8b3ec6ecbe459b495b9c | |
parent | d5ad01a48ac4c7c69995a58a3c198630df904419 (diff) |
Change cc.preprocessed to {c,cxx}.preprocessed
-rw-r--r-- | build2/c/init.cxx | 3 | ||||
-rw-r--r-- | build2/cc/common.hxx | 3 | ||||
-rw-r--r-- | build2/cc/compile.cxx | 4 | ||||
-rw-r--r-- | build2/cc/init.cxx | 11 | ||||
-rw-r--r-- | build2/cxx/init.cxx | 12 | ||||
-rw-r--r-- | tests/cc/preprocessed/buildfile | 2 | ||||
-rw-r--r-- | tests/cc/preprocessed/testscript | 14 |
7 files changed, 25 insertions, 24 deletions
diff --git a/build2/c/init.cxx b/build2/c/init.cxx index 159c0b8..0ca9aae 100644 --- a/build2/c/init.cxx +++ b/build2/c/init.cxx @@ -176,7 +176,8 @@ namespace build2 v["cc.system"], v["cc.module_name"], v["cc.reprocess"], - v["cc.preprocessed"], + + v.insert<string> ("c.preprocessed"), // See cxx.preprocessed. v.insert<string> ("c.std", variable_visibility::project), diff --git a/build2/cc/common.hxx b/build2/cc/common.hxx index 66c226c..05877ad 100644 --- a/build2/cc/common.hxx +++ b/build2/cc/common.hxx @@ -68,7 +68,8 @@ namespace build2 const variable& c_system; // cc.system const variable& c_module_name; // cc.module_name const variable& c_reprocess; // cc.reprocess - const variable& c_preprocessed; // cc.preprocessed + + const variable& x_preprocessed; // x.preprocessed const variable& x_std; diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 9f36e8b..1db827d 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -802,14 +802,14 @@ namespace build2 // This determines which of the following steps we perform and on // what source (original or preprocessed). // - if (const string* v = cast_null<string> (t[c_preprocessed])) + if (const string* v = cast_null<string> (t[x_preprocessed])) try { md.pp = to_preprocessed (*v); } catch (const invalid_argument& e) { - fail << "invalid " << c_preprocessed.name << " variable value " + fail << "invalid " << x_preprocessed.name << " variable value " << "for target " << t << ": " << e; } diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx index 8dceda7..733280a 100644 --- a/build2/cc/init.cxx +++ b/build2/cc/init.cxx @@ -88,17 +88,6 @@ namespace build2 v.insert<bool> ("config.cc.reprocess", true); v.insert<bool> ("cc.reprocess"); - // Ability to indicate that source is already (partially) preprocessed. - // Valid values are 'none' (not preprocessed), 'includes' (no #include - // directives in source), 'modules' (as above plus no module declaration - // depends on preprocessor, e.g., #ifdef, etc), and 'all' (the source is - // fully preprocessed). Note that for 'all' the source can still contain - // comments and line continuations. Note also that for some compilers - // (e.g., VC) there is no way to signal that the source is already - // preprocessed. - // - v.insert<string> ("cc.preprocessed"); - return true; } diff --git a/build2/cxx/init.cxx b/build2/cxx/init.cxx index 7f099cf..6c8cbad 100644 --- a/build2/cxx/init.cxx +++ b/build2/cxx/init.cxx @@ -355,7 +355,17 @@ namespace build2 v["cc.system"], v["cc.module_name"], v["cc.reprocess"], - v["cc.preprocessed"], + + // Ability to indicate that source is already (partially) + // preprocessed. Valid values are 'none' (not preprocessed), + // 'includes' (no #include directives in source), 'modules' (as above + // plus no module declaration depends on preprocessor, e.g., #ifdef, + // etc), and 'all' (the source is fully preprocessed). Note that for + // 'all' the source can still contain comments and line + // continuations. Note also that for some compilers (e.g., VC) there + // is no way to signal that the source is already preprocessed. + // + v.insert<string> ("cxx.preprocessed"), v.insert<string> ("cxx.std", variable_visibility::project), diff --git a/tests/cc/preprocessed/buildfile b/tests/cc/preprocessed/buildfile index d812867..ac6bcdf 100644 --- a/tests/cc/preprocessed/buildfile +++ b/tests/cc/preprocessed/buildfile @@ -2,7 +2,7 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file -# Test cc.preprocessed logic. +# Test {c, cxx}.preprocessed logic. # ./: test{testscript} $b diff --git a/tests/cc/preprocessed/testscript b/tests/cc/preprocessed/testscript index b429853..fb69e65 100644 --- a/tests/cc/preprocessed/testscript +++ b/tests/cc/preprocessed/testscript @@ -61,8 +61,8 @@ cat <<EOI >=test.cxx &!test.cxx; int main () {return TEST_VALUE;} EOI $* --verbose 5 &test* <<EOI 2>&1 | $filter >>EOO - cc.preprocessed = includes - cc.poptions += -DTEST_VALUE=0 + cxx.preprocessed = includes + cxx.poptions += -DTEST_VALUE=0 exe{test}: cxx{test} EOI modules test @@ -76,8 +76,8 @@ cat <<EOI >=test.cxx &!test.cxx; int main () {return TEST_VALUE;} EOI $* --verbose 5 &test* <<EOI 2>&1 | $filter >>EOO - cc.preprocessed = modules - cc.poptions += -DTEST_VALUE=0 + cxx.preprocessed = modules + cxx.poptions += -DTEST_VALUE=0 exe{test}: cxx{test} EOI modules test @@ -95,7 +95,7 @@ cat <<EOI >=test.cxx &!test.cxx; #endif EOI $* &test* <<EOI 2>>EOE != 0 - cc.preprocessed = modules + cxx.preprocessed = modules exe{test}: cxx{test} EOI test.cxx: error: modules support not enabled/available @@ -116,8 +116,8 @@ cat <<EOI >=test.cxx &!test.cxx; in () {} EOI $* --verbose &test* 5 <<EOI 2>&1 | $filter >>EOO - cc.preprocessed = all - cc.poptions += -Dmain=foo + cxx.preprocessed = all + cxx.poptions += -Dmain=foo exe{test}: cxx{test} EOI modules test |