diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-05-03 13:23:33 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-05-03 13:23:33 +0200 |
commit | 8618078b90189fb49e9c0a76ac01d471b51f1e93 (patch) | |
tree | 63ee0435f3311d90d5863ca49a3dc0e5807bb097 | |
parent | 43c53a8b475f901a902ba1bf6ec603e7a28311b1 (diff) |
Rename [config.]cxx.header_units to importable_headers
-rw-r--r-- | build2/c/init.cxx | 4 | ||||
-rw-r--r-- | build2/cc/common.hxx | 8 | ||||
-rw-r--r-- | build2/cc/compile-rule.cxx | 10 | ||||
-rw-r--r-- | build2/cc/module.cxx | 16 | ||||
-rw-r--r-- | build2/cc/types.hxx | 7 | ||||
-rw-r--r-- | build2/cxx/init.cxx | 10 | ||||
-rw-r--r-- | tests/cc/modules/headers.testscript | 2 |
7 files changed, 31 insertions, 26 deletions
diff --git a/build2/c/init.cxx b/build2/c/init.cxx index 6944680..dbaff78 100644 --- a/build2/c/init.cxx +++ b/build2/c/init.cxx @@ -168,7 +168,7 @@ namespace build2 v.insert<strings> ("config.c.coptions", true), v.insert<strings> ("config.c.loptions", true), v.insert<strings> ("config.c.libs", true), - nullptr /* config.c.header_units */, + nullptr /* config.c.importable_headers */, v.insert<process_path> ("c.path"), v.insert<dir_paths> ("c.sys_lib_dirs"), @@ -178,7 +178,7 @@ namespace build2 v.insert<strings> ("c.coptions"), v.insert<strings> ("c.loptions"), v.insert<strings> ("c.libs"), - nullptr /* c.header_units */, + nullptr /* c.importable_headers */, v["cc.poptions"], v["cc.coptions"], diff --git a/build2/cc/common.hxx b/build2/cc/common.hxx index f9f13c1..dec71ed 100644 --- a/build2/cc/common.hxx +++ b/build2/cc/common.hxx @@ -47,7 +47,7 @@ namespace build2 const variable& config_x_coptions; const variable& config_x_loptions; const variable& config_x_libs; - const variable* config_x_header_units; + const variable* config_x_importable_headers; const variable& x_path; // Compiler process path. const variable& x_sys_lib_dirs; // System library search directories. @@ -57,7 +57,7 @@ namespace build2 const variable& x_coptions; const variable& x_loptions; const variable& x_libs; - const variable* x_header_units; + const variable* x_importable_headers; const variable& c_poptions; // cc.* const variable& c_coptions; @@ -140,7 +140,7 @@ namespace build2 bool modules; // x.features.modules bool symexport; // x.features.symexport - const strings* hdr_units; // x.header_units (NULL if unused/empty) + const strings* import_hdr; // x.importable_headers (NULL if unused/empty). const dir_paths& sys_lib_dirs; // x.sys_lib_dirs const dir_paths& sys_inc_dirs; // x.sys_inc_dirs @@ -210,7 +210,7 @@ namespace build2 tstd (std), modules (fm), symexport (fs), - hdr_units (nullptr), + import_hdr (nullptr), sys_lib_dirs (sld), sys_inc_dirs (sid), sys_lib_dirs_extra (sle), sys_inc_dirs_extra (sie), x_src (src), x_mod (mod), x_hdr (hdr), x_inc (inc) {} diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx index 07677a9..dd38945 100644 --- a/build2/cc/compile-rule.cxx +++ b/build2/cc/compile-rule.cxx @@ -877,8 +877,8 @@ namespace build2 if (ut == unit_type::module_iface) cs.append (&md.symexport, sizeof (md.symexport)); - if (hdr_units != nullptr) - hash_options (cs, *hdr_units); + if (import_hdr != nullptr) + hash_options (cs, *import_hdr); if (md.pp != preprocessed::all) { @@ -2003,11 +2003,11 @@ namespace build2 { // See if we need to translate this include to import. // - if (hdr_units != nullptr) + if (const strings* ih = import_hdr) { - auto i (lower_bound (hdr_units->begin (), hdr_units->end (), hp)); + auto i (lower_bound (ih->begin (), ih->end (), hp)); - if (i != hdr_units->end () && *i == hp) + if (i != ih->end () && *i == hp) { // Doesn't seem there is much use in trying to correlate the // followup in this case; what else can the compiler import? diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx index a8f25c6..20e39a8 100644 --- a/build2/cc/module.cxx +++ b/build2/cc/module.cxx @@ -463,20 +463,20 @@ namespace build2 rs.assign (x_libs) += cast_null<strings> ( config::optional (rs, config_x_libs)); - // config.x.header_units + // config.x.importable_header // // It's still fuzzy whether specifying (or maybe tweaking) this list in // the configuration will be a common thing to do so for now we use // omitted. It's also probably too early to think whether we should have // the cc.* version and what the semantics should be. // - if (x_header_units != nullptr) + if (x_importable_headers != nullptr) { - lookup l (config::omitted (rs, *config_x_header_units).first); + lookup l (config::omitted (rs, *config_x_importable_headers).first); // @@ MODHDR: if(modules) ? // - rs.assign (x_header_units) += cast_null<strings> (l); + rs.assign (x_importable_headers) += cast_null<strings> (l); } // Load cc.core.config. @@ -503,20 +503,20 @@ namespace build2 if (!cast_false<bool> (rs["cc.core.loaded"])) load_module (rs, rs, "cc.core", loc); - // Process, sort, and cache (in this->hdr_units) the header units list. + // Process, sort, and cache (in this->import_hdr) importable headers. // Keep the cache NULL if unused or empty. // // @@ MODHDR TODO: translate <> to absolute paths. // @@ MODHDR TODO: support exclusions entries (e.g., -<stdio.h>)? // - if (modules && x_header_units != nullptr) + if (modules && x_importable_headers != nullptr) { - strings* v (cast_null<strings> (rs.assign (x_header_units))); + strings* v (cast_null<strings> (rs.assign (x_importable_headers))); if (v != nullptr && !v->empty ()) { sort (v->begin (), v->end ()); - hdr_units = v; + import_hdr = v; } } diff --git a/build2/cc/types.hxx b/build2/cc/types.hxx index 4403e4c..60c9a34 100644 --- a/build2/cc/types.hxx +++ b/build2/cc/types.hxx @@ -21,7 +21,12 @@ namespace build2 // // Note that our terminology doesn't exactly align with the (current) // standard where a header unit is not a module (that is, you either - // import a module unit or a header unit). + // import a "module [interface translation unit]" or a "[synthesized] + // header [translation] unit"). On the other hand, lots of the underlying + // mechanics suggest that a header unit is module-like; they end up having + // BMIs (which stand for "binary module interface"), etc. In a sense, a + // header unit is an "interface unit" for (a part of) the global module + // (maybe a partition). // enum class unit_type { diff --git a/build2/cxx/init.cxx b/build2/cxx/init.cxx index 3fb636f..a04a30a 100644 --- a/build2/cxx/init.cxx +++ b/build2/cxx/init.cxx @@ -394,16 +394,16 @@ namespace build2 v.insert<strings> ("config.cxx.loptions", true), v.insert<strings> ("config.cxx.libs", true), - // List of modular headers. Inclusion of such headers is translated to - // the corresponding header unit imports. + // List of importable headers. Inclusion of such headers is translated + // to the corresponding header unit imports. // // A header can be specified either as an absolute and normalized path // or as a <>-style include name. The latter kind is automatically // translated to the absolute form based on the include search paths // extracted from the compiler. Note also that all entries must be - // specified before loading the module. + // specified before loading the cxx module. // - &v.insert<strings> ("config.cxx.header_units", true), + &v.insert<strings> ("config.cxx.importable_headers", true), v.insert<process_path> ("cxx.path"), v.insert<dir_paths> ("cxx.sys_lib_dirs"), @@ -413,7 +413,7 @@ namespace build2 v.insert<strings> ("cxx.coptions"), v.insert<strings> ("cxx.loptions"), v.insert<strings> ("cxx.libs"), - &v.insert<strings> ("cxx.header_units"), + &v.insert<strings> ("cxx.importable_headers"), v["cc.poptions"], v["cc.coptions"], diff --git a/tests/cc/modules/headers.testscript b/tests/cc/modules/headers.testscript index c6f16b7..4b8067f 100644 --- a/tests/cc/modules/headers.testscript +++ b/tests/cc/modules/headers.testscript @@ -26,6 +26,6 @@ cat <<EOI >=driver.cxx; #endif int main () {return f () - CORE_OUT;} EOI -$* test clean config.cxx.header_units="$~/core.hxx" &$~/../build/cc/*** <<EOI +$* test clean config.cxx.importable_headers="$~/core.hxx" &$~/../build/cc/*** <<EOI exe{test}: cxx{driver} EOI |