From 8c30c59de2d304a416dfd4fcb821e0b227e5db96 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 18 Sep 2019 15:57:52 +0200 Subject: Rename importable_headers variable to translatable_headers This name aligns better with the post-Cologne importable/translatable semantics. --- libbuild2/c/init.cxx | 4 ++-- libbuild2/cc/common.hxx | 9 +++++---- libbuild2/cc/compile-rule.cxx | 24 +++++++++++------------- libbuild2/cc/module.cxx | 16 ++++++++-------- libbuild2/cxx/init.cxx | 14 +++++++------- tests/cc/modules/headers.testscript | 8 ++++---- 6 files changed, 37 insertions(+), 38 deletions(-) diff --git a/libbuild2/c/init.cxx b/libbuild2/c/init.cxx index 43d647f..337df09 100644 --- a/libbuild2/c/init.cxx +++ b/libbuild2/c/init.cxx @@ -169,7 +169,7 @@ namespace build2 v.insert ("config.c.loptions", true), v.insert ("config.c.aoptions", true), v.insert ("config.c.libs", true), - nullptr /* config.c.importable_headers */, + nullptr /* config.c.translatable_headers */, v.insert ("c.path"), v.insert ("c.sys_lib_dirs"), @@ -183,7 +183,7 @@ namespace build2 v.insert ("c.aoptions"), v.insert ("c.libs"), - nullptr /* c.importable_headers */, + nullptr /* c.translatable_headers */, v["cc.poptions"], v["cc.coptions"], diff --git a/libbuild2/cc/common.hxx b/libbuild2/cc/common.hxx index 31219a3..d32d945 100644 --- a/libbuild2/cc/common.hxx +++ b/libbuild2/cc/common.hxx @@ -53,7 +53,7 @@ namespace build2 const variable& config_x_loptions; const variable& config_x_aoptions; const variable& config_x_libs; - const variable* config_x_importable_headers; + const variable* config_x_translatable_headers; const variable& x_path; // Compiler process path. const variable& x_sys_lib_dirs; // System library search directories. @@ -65,7 +65,7 @@ namespace build2 const variable& x_loptions; const variable& x_aoptions; const variable& x_libs; - const variable* x_importable_headers; + const variable* x_translatable_headers; const variable& c_poptions; // cc.* const variable& c_coptions; @@ -147,7 +147,8 @@ namespace build2 bool modules; // x.features.modules bool symexport; // x.features.symexport - const strings* import_hdr; // x.importable_headers (NULL if unused/empty). + const strings* xlate_hdr; // x.translatable_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 @@ -217,7 +218,7 @@ namespace build2 tstd (std), modules (fm), symexport (fs), - import_hdr (nullptr), + xlate_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/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx index 450fbe9..d6adfd3 100644 --- a/libbuild2/cc/compile-rule.cxx +++ b/libbuild2/cc/compile-rule.cxx @@ -876,8 +876,8 @@ namespace build2 if (ut == unit_type::module_iface) cs.append (&md.symexport, sizeof (md.symexport)); - if (import_hdr != nullptr) - hash_options (cs, *import_hdr); + if (xlate_hdr != nullptr) + hash_options (cs, *xlate_hdr); if (md.pp != preprocessed::all) { @@ -2027,19 +2027,17 @@ namespace build2 // Reduce include translation to the import case. // - if (!imp && import_hdr != nullptr) + if (!imp && xlate_hdr != nullptr) { - const strings& ih (*import_hdr); - - auto i (lower_bound (ih.begin (), - ih.end (), - hp, - [] (const string& x, const string& y) - { - return path::traits_type::compare (x, y) < 0; - })); + auto i (lower_bound ( + xlate_hdr->begin (), xlate_hdr->end (), + hp, + [] (const string& x, const string& y) + { + return path::traits_type::compare (x, y) < 0; + })); - imp = (i != ih.end () && *i == hp); + imp = (i != xlate_hdr->end () && *i == hp); } if (imp) diff --git a/libbuild2/cc/module.cxx b/libbuild2/cc/module.cxx index 3113b5c..64ae874 100644 --- a/libbuild2/cc/module.cxx +++ b/libbuild2/cc/module.cxx @@ -527,20 +527,20 @@ namespace build2 rs.assign (x_libs) += cast_null ( config::optional (rs, config_x_libs)); - // config.x.importable_header + // config.x.translatable_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_importable_headers != nullptr) + if (x_translatable_headers != nullptr) { - lookup l (config::omitted (rs, *config_x_importable_headers).first); + lookup l (config::omitted (rs, *config_x_translatable_headers).first); // @@ MODHDR: if(modules) ? // - rs.assign (x_importable_headers) += cast_null (l); + rs.assign (x_translatable_headers) += cast_null (l); } // Load cc.core.config. @@ -567,14 +567,14 @@ namespace build2 if (!cast_false (rs["cc.core.loaded"])) load_module (rs, rs, "cc.core", loc); - // Process, sort, and cache (in this->import_hdr) importable headers. + // Process, sort, and cache (in this->xlate_hdr) translatable headers. // Keep the cache NULL if unused or empty. // // @@ MODHDR TODO: support exclusions entries (e.g., -)? // - if (modules && x_importable_headers != nullptr) + if (modules && x_translatable_headers != nullptr) { - strings* ih (cast_null (rs.assign (x_importable_headers))); + strings* ih (cast_null (rs.assign (x_translatable_headers))); if (ih != nullptr && !ih->empty ()) { @@ -631,7 +631,7 @@ namespace build2 } sort (ih->begin (), ih->end ()); - import_hdr = ih; + xlate_hdr = ih; } } diff --git a/libbuild2/cxx/init.cxx b/libbuild2/cxx/init.cxx index 5619397..6a449c7 100644 --- a/libbuild2/cxx/init.cxx +++ b/libbuild2/cxx/init.cxx @@ -400,16 +400,16 @@ namespace build2 v.insert ("config.cxx.aoptions", true), v.insert ("config.cxx.libs", true), - // List of importable headers. Inclusion of such headers is translated - // to the corresponding header unit imports. + // List of translatable headers. Inclusions of such headers are + // 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 compiler's system - // header search paths (as opposed to -I). Note also that all entries - // must be specified before loading the cxx module. + // translated to the absolute form based on the compiler's system (as + // opposed to -I) header search paths. Note also that all entries must + // be specified before loading the cxx module. // - &v.insert ("config.cxx.importable_headers", true), + &v.insert ("config.cxx.translatable_headers", true), v.insert ("cxx.path"), v.insert ("cxx.sys_lib_dirs"), @@ -423,7 +423,7 @@ namespace build2 v.insert ("cxx.aoptions"), v.insert ("cxx.libs"), - &v.insert ("cxx.importable_headers"), + &v.insert ("cxx.translatable_headers"), v["cc.poptions"], v["cc.coptions"], diff --git a/tests/cc/modules/headers.testscript b/tests/cc/modules/headers.testscript index 8eeb81a..835c599 100644 --- a/tests/cc/modules/headers.testscript +++ b/tests/cc/modules/headers.testscript @@ -70,7 +70,7 @@ cat <=driver-inc.cxx; #endif int main () {return f () - CORE_OUT;} EOI -$* test clean config.cxx.importable_headers="$~/core.hxx" <=driver-inc.cxx; #include int main () {return f ();} EOI -$* test clean config.cxx.importable_headers="$~/core.hxx" <=driver-inc.cxx; # out = ../../headers-remapped-out; $* 'test:' ./@$out/remapped/ \ - config.cxx.importable_headers=$out/remapped/core.hxx <