aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-07-16 09:05:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-07-16 09:05:04 +0200
commit51ab0a979c5c53defd5eda9fa997b2abfd0d4f7d (patch)
treea7be7d7a9c8956efc8f9cc81ab7e7576fe78668b
parentbca2aa388e690d1e575d890cf15e0dc9632728f7 (diff)
Save original compiler path/mode in {c,cxx}.config.path/mode
It turns out that when propagating {c,cxx}.config in tests we don't want to propagate any options (such as *.std) that have been folded into our project's mode.
-rw-r--r--NEWS1
-rw-r--r--libbuild2/c/init.cxx2
-rw-r--r--libbuild2/cc/common.hxx2
-rw-r--r--libbuild2/cc/init.cxx16
-rw-r--r--libbuild2/cc/module.cxx8
-rw-r--r--libbuild2/cxx/init.cxx2
-rw-r--r--tests/cc/libu/testscript2
-rw-r--r--tests/cc/modules/common.testscript2
-rw-r--r--tests/cc/preprocessed/testscript2
-rw-r--r--tests/dependency/recipe/testscript2
10 files changed, 26 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index 260952c..90de9ca 100644
--- a/NEWS
+++ b/NEWS
@@ -230,6 +230,7 @@ Version 0.13.0
* The translated {c,cxx}.std options are now folded into the compiler mode
options ({c,cxx}.mode). This makes them accessible from ad hoc recipes.
+ The original mode/path are available in {c,cxx}.config.mode/path.
* Generation of a common pkg-config .pc file in addition to static/shared-
specific.
diff --git a/libbuild2/c/init.cxx b/libbuild2/c/init.cxx
index 38ee3d2..923fbcb 100644
--- a/libbuild2/c/init.cxx
+++ b/libbuild2/c/init.cxx
@@ -177,6 +177,8 @@ namespace build2
vp.insert<process_path_ex> ("c.path"),
vp.insert<strings> ("c.mode"),
+ vp.insert<path> ("c.config.path"),
+ vp.insert<strings> ("c.config.mode"),
vp.insert<dir_paths> ("c.sys_lib_dirs"),
vp.insert<dir_paths> ("c.sys_inc_dirs"),
diff --git a/libbuild2/cc/common.hxx b/libbuild2/cc/common.hxx
index 781fcf5..bf971ab 100644
--- a/libbuild2/cc/common.hxx
+++ b/libbuild2/cc/common.hxx
@@ -56,6 +56,8 @@ namespace build2
const variable& x_path; // Compiler process path.
const variable& x_mode; // Compiler mode options.
+ const variable& x_c_path; // Compiler path as configured.
+ const variable& x_c_mode; // Compiler mode as configured.
const variable& x_sys_lib_dirs; // System library search directories.
const variable& x_sys_inc_dirs; // System header search directories.
diff --git a/libbuild2/cc/init.cxx b/libbuild2/cc/init.cxx
index 040df7f..6791190 100644
--- a/libbuild2/cc/init.cxx
+++ b/libbuild2/cc/init.cxx
@@ -185,18 +185,18 @@ namespace build2
// config.cc.{id,hinter}
//
+ // These values must be hinted.
+ //
{
- // These values must be hinted.
- //
rs.assign<string> ("cc.id") = cast<string> (h["config.cc.id"]);
rs.assign<string> ("cc.hinter") = cast<string> (h["config.cc.hinter"]);
}
// config.cc.target
//
+ // This value must be hinted.
+ //
{
- // This value must be hinted.
- //
const auto& t (cast<target_triplet> (h["config.cc.target"]));
// Also enter as cc.target.{cpu,vendor,system,version,class} for
@@ -213,18 +213,18 @@ namespace build2
// config.cc.pattern
//
+ // This value could be hinted. Note that the hints may not be the same.
+ //
{
- // This value could be hinted.
- //
rs.assign<string> ("cc.pattern") =
cast_empty<string> (h["config.cc.pattern"]);
}
// config.cc.mode
//
+ // This value could be hinted. Note that the hints may not be the same.
+ //
{
- // This value could be hinted.
- //
rs.assign<strings> ("cc.mode") =
cast_empty<strings> (h["config.cc.mode"]);
}
diff --git a/libbuild2/cc/module.cxx b/libbuild2/cc/module.cxx
index eed2510..1aa1e01 100644
--- a/libbuild2/cc/module.cxx
+++ b/libbuild2/cc/module.cxx
@@ -140,11 +140,17 @@ namespace build2
mode.assign (++v.begin (), v.end ());
+ // Save original path/mode in *.config.path/mode.
+ //
+ rs.assign (x_c_path) = xc;
+ rs.assign (x_c_mode) = mode;
+
// Figure out which compiler we are dealing with, its target, etc.
//
// Note that we could allow guess() to modify mode to support
// imaginary options (such as /MACHINE for cl.exe). Though it's not
- // clear what cc.mode would contain (original or modified).
+ // clear what cc.mode would contain (original or modified). Note that
+ // we are now folding *.std options into mode options.
//
x_info = &build2::cc::guess (
x, x_lang, move (xc),
diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx
index a43dcb2..8f91b19 100644
--- a/libbuild2/cxx/init.cxx
+++ b/libbuild2/cxx/init.cxx
@@ -435,6 +435,8 @@ namespace build2
vp.insert<process_path_ex> ("cxx.path"),
vp.insert<strings> ("cxx.mode"),
+ vp.insert<path> ("cxx.config.path"),
+ vp.insert<strings> ("cxx.config.mode"),
vp.insert<dir_paths> ("cxx.sys_lib_dirs"),
vp.insert<dir_paths> ("cxx.sys_inc_dirs"),
diff --git a/tests/cc/libu/testscript b/tests/cc/libu/testscript
index f52bd81..9db3406 100644
--- a/tests/cc/libu/testscript
+++ b/tests/cc/libu/testscript
@@ -2,7 +2,7 @@
# license : MIT; see accompanying LICENSE file
crosstest = false
-test.arguments = config.cxx=$quote($recall($cxx.path) $cxx.mode, true)
+test.arguments = config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true)
.include ../../common.testscript
diff --git a/tests/cc/modules/common.testscript b/tests/cc/modules/common.testscript
index cb567a3..2fbb9a5 100644
--- a/tests/cc/modules/common.testscript
+++ b/tests/cc/modules/common.testscript
@@ -2,7 +2,7 @@
# license : MIT; see accompanying LICENSE file
crosstest = false
-test.arguments = config.cxx=$quote($recall($cxx.path) $cxx.mode, true)
+test.arguments = config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true)
.include ../../common.testscript
diff --git a/tests/cc/preprocessed/testscript b/tests/cc/preprocessed/testscript
index 1c6dc76..269cafe 100644
--- a/tests/cc/preprocessed/testscript
+++ b/tests/cc/preprocessed/testscript
@@ -2,7 +2,7 @@
# license : MIT; see accompanying LICENSE file
crosstest = false
-test.arguments = config.cxx=$quote($recall($cxx.path) $cxx.mode, true) update
+test.arguments = config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true) update
.include ../../common.testscript
diff --git a/tests/dependency/recipe/testscript b/tests/dependency/recipe/testscript
index 43ec514..09a38ad 100644
--- a/tests/dependency/recipe/testscript
+++ b/tests/dependency/recipe/testscript
@@ -657,7 +657,7 @@ EOE
: process-path-ex
:
{
- config_cxx = config.cxx=$quote($recall($cxx.path) $cxx.mode, true)
+ config_cxx = config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true)
mkdir build;
cat <<EOI >=build/bootstrap.build;