diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-14 11:50:23 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-14 11:50:23 +0200 |
commit | edc9022131b77cec3fe5a662766e36fa9a71d23e (patch) | |
tree | 1e084ffcf7ec3da9ad1eb2e6755335bdda9137f8 /build2/cc | |
parent | 5d615c7ae1761d1511e01d0b4bea4920fda190a7 (diff) |
Enable modules support only for VC 15u5 and up, drop hacks for earlier
Diffstat (limited to 'build2/cc')
-rw-r--r-- | build2/cc/compile-rule.cxx | 34 | ||||
-rw-r--r-- | build2/cc/parser.cxx | 15 | ||||
-rw-r--r-- | build2/cc/parser.hxx | 1 |
3 files changed, 7 insertions, 43 deletions
diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx index e77ef08..1e1d45d 100644 --- a/build2/cc/compile-rule.cxx +++ b/build2/cc/compile-rule.cxx @@ -2991,41 +2991,15 @@ namespace build2 if (ps) psrc.active = true; // Re-arm. - // Prior to 15u5 VC was not using the 'export module' syntax so we - // use the preprequisite type to distinguish between interface and - // implementation units. + // Prior to 15u5 (19.12) VC was not using the 'export module M;' + // syntax so we use the preprequisite type to distinguish between + // interface and implementation units. // if (cid == compiler_id::msvc && cmaj == 19 && cmin <= 11 && x_mod != nullptr && src.is_a (*x_mod)) { - // It's quite painful to guard the export with an #if/#endif so - // if it is present, "fixup" the (temporary) preprocessed output - // by getting rid of the keyword. - // - // Note: when removing this also remember to remove the test. - // - if (tu.mod.iface) - { - // We can only fixup a temporary file. - // - if (!ps) - fail (relative (src)) << "fixup requires preprocessor"; - - // Stomp out the export keyword with spaces. We are using - // std::fstream since our fdstream does not yet support - // seeking. - // - fstream os (psrc.path.string (), fstream::out | fstream::in); - auto pos (static_cast<fstream::pos_type> (p.export_pos)); - - if (!os.is_open () || - !os.seekp (pos) || - !os.write (" ", 6)) - fail << "unable to overwrite preprocessor output"; - } - else - tu.mod.iface = true; + tu.mod.iface = true; } return pair<translation_unit, string> (move (tu), p.checksum); diff --git a/build2/cc/parser.cxx b/build2/cc/parser.cxx index fcb6265..c8fcf4b 100644 --- a/build2/cc/parser.cxx +++ b/build2/cc/parser.cxx @@ -82,23 +82,14 @@ namespace build2 } else if (id == "export") { - uint64_t pos (t.position); - switch (l_->next (t)) { case type::lcbrace: ++bb; ex = true; break; case type::identifier: { - if (id == "module") - { - export_pos = pos; - parse_module (t, true); - } - else if (id == "import") - parse_import (t, true); - else - n = false; // Something else (e.g., export namespace). - + if (id == "module") parse_module (t, true); + else if (id == "import") parse_import (t, true); + else n = false; // Something else (e.g., export namespace). break; } default: n = false; break; diff --git a/build2/cc/parser.hxx b/build2/cc/parser.hxx index bec67bd..a4fd5f8 100644 --- a/build2/cc/parser.hxx +++ b/build2/cc/parser.hxx @@ -39,7 +39,6 @@ namespace build2 public: string checksum; // Translation unit checksum. - uint64_t export_pos; // Temporary hack, see parse_unit(). private: lexer* l_; |