From c09cd7512491cee1e82c1ad8128ce9fd4bc3f79b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Sep 2017 23:32:28 +0200 Subject: Initial modularization with both Clang and VC hacks Note: gave up on VC about half way though. --- tests/base64/buildfile | 6 ++++++ tests/base64/driver.cxx | 18 ++++++++++++++++-- tests/build/root.build | 5 +++++ tests/cpfile/buildfile | 6 ++++++ tests/cpfile/driver.cxx | 23 +++++++++++++++++++---- tests/curl/buildfile | 6 ++++++ tests/curl/driver.cxx | 31 +++++++++++++++++++++++++++---- tests/dir-iterator/buildfile | 6 ++++++ tests/dir-iterator/driver.cxx | 26 +++++++++++++++++++++----- tests/fdstream/buildfile | 6 ++++++ tests/fdstream/driver.cxx | 32 ++++++++++++++++++++++++++------ tests/link/buildfile | 6 ++++++ tests/link/driver.cxx | 22 ++++++++++++++++++---- tests/manifest-parser/buildfile | 6 ++++++ tests/manifest-parser/driver.cxx | 19 ++++++++++++++++--- tests/manifest-roundtrip/buildfile | 6 ++++++ tests/manifest-roundtrip/driver.cxx | 25 +++++++++++++++++++++---- tests/manifest-serializer/buildfile | 6 ++++++ tests/manifest-serializer/driver.cxx | 19 ++++++++++++++++--- tests/mventry/buildfile | 6 ++++++ tests/mventry/driver.cxx | 22 +++++++++++++++++++--- tests/openssl/buildfile | 6 ++++++ tests/openssl/driver.cxx | 28 +++++++++++++++++++++++++--- tests/pager/buildfile | 6 ++++++ tests/pager/driver.cxx | 19 ++++++++++++++++--- tests/path-entry/buildfile | 6 ++++++ tests/path-entry/driver.cxx | 21 ++++++++++++++++++--- tests/path/buildfile | 6 ++++++ tests/path/driver.cxx | 18 ++++++++++++++++-- tests/prefix-map/buildfile | 6 ++++++ tests/prefix-map/driver.cxx | 19 ++++++++++++++++--- tests/process-run/buildfile | 6 ++++++ tests/process-run/driver.cxx | 27 +++++++++++++++++++++++---- tests/process/buildfile | 6 ++++++ tests/process/driver.cxx | 27 ++++++++++++++++++++++----- tests/progress/buildfile | 6 ++++++ tests/progress/driver.cxx | 35 +++++++++++++++++++++++++++++------ tests/regex/buildfile | 6 ++++++ tests/regex/driver.cxx | 20 +++++++++++++++++--- tests/sendmail/buildfile | 6 ++++++ tests/sendmail/driver.cxx | 28 +++++++++++++++++++++++++--- tests/sha256/buildfile | 6 ++++++ tests/sha256/driver.cxx | 19 ++++++++++++++++--- tests/small-vector/buildfile | 6 ++++++ tests/small-vector/driver.cxx | 20 +++++++++++++++++--- tests/standard-version/buildfile | 6 ++++++ tests/standard-version/driver.cxx | 22 ++++++++++++++++++---- tests/strcase/buildfile | 6 ++++++ tests/strcase/driver.cxx | 16 ++++++++++++++-- tests/string-parser/buildfile | 6 ++++++ tests/string-parser/driver.cxx | 28 ++++++++++++++++++++-------- tests/tab-parser/buildfile | 6 ++++++ tests/tab-parser/driver.cxx | 20 +++++++++++++++++--- tests/target-triplet/buildfile | 6 ++++++ tests/target-triplet/driver.cxx | 18 ++++++++++++++++-- tests/timestamp/buildfile | 6 ++++++ tests/timestamp/driver.cxx | 17 +++++++++++++++-- tests/wildcard/buildfile | 6 ++++++ tests/wildcard/driver.cxx | 28 ++++++++++++++++++++++------ 59 files changed, 740 insertions(+), 106 deletions(-) (limited to 'tests') diff --git a/tests/base64/buildfile b/tests/base64/buildfile index 710499e..535b9dc 100644 --- a/tests/base64/buildfile +++ b/tests/base64/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/base64/driver.cxx b/tests/base64/driver.cxx index 040eaf8..fb65a49 100644 --- a/tests/base64/driver.cxx +++ b/tests/base64/driver.cxx @@ -2,11 +2,25 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include +#include #include -#include +#endif -#include +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.base64; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/build/root.build b/tests/build/root.build index 633ccb3..6c98ba9 100644 --- a/tests/build/root.build +++ b/tests/build/root.build @@ -2,6 +2,11 @@ # copyright : Copyright (c) 2014-2017 Code Synthesis Ltd # license : MIT; see accompanying LICENSE file +using cxx.guess + +if ($force_modules != true && $cxx.id == 'clang') + cxx.features.modules = false + cxx.std = experimental using cxx diff --git a/tests/cpfile/buildfile b/tests/cpfile/buildfile index 0d95110..41275fa 100644 --- a/tests/cpfile/buildfile +++ b/tests/cpfile/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/cpfile/driver.cxx b/tests/cpfile/driver.cxx index 3a19322..db529ba 100644 --- a/tests/cpfile/driver.cxx +++ b/tests/cpfile/driver.cxx @@ -2,14 +2,29 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include #include -#include #include +#endif -#include -#include -#include +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.fdstream; +import butl.filesystem; +#else +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/curl/buildfile b/tests/curl/buildfile index 20617cf..dae375b 100644 --- a/tests/curl/buildfile +++ b/tests/curl/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/curl/driver.cxx b/tests/curl/driver.cxx index b5fc400..326d717 100644 --- a/tests/curl/driver.cxx +++ b/tests/curl/driver.cxx @@ -2,12 +2,35 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include #include - -#include -#include // operator<<(ostream, exception) -#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.curl; +import butl.path; +import butl.process; +import butl.utility; // operator<<(ostream, exception) +import butl.fdstream; + +import butl.optional; // @@ MOD Clang should not be necessary. +import butl.small_vector; // @@ MOD Clang should not be necessary. +#else +#include +#include +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/dir-iterator/buildfile b/tests/dir-iterator/buildfile index e536536..7f83e4f 100644 --- a/tests/dir-iterator/buildfile +++ b/tests/dir-iterator/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/dir-iterator/driver.cxx b/tests/dir-iterator/driver.cxx index f584c68..1adef6f 100644 --- a/tests/dir-iterator/driver.cxx +++ b/tests/dir-iterator/driver.cxx @@ -2,14 +2,30 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include // size_t #include + +#ifndef __cpp_lib_modules +#include // size_t #include +#endif + +// Other includes. -#include -#include -#include // operator<<(ostream, exception) -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.path_io; +import butl.utility; +import butl.filesystem; +#else +#include +#include +#include // operator<<(ostream, exception) +#include +#endif using namespace std; using namespace butl; diff --git a/tests/fdstream/buildfile b/tests/fdstream/buildfile index 5440bc1..6028f3f 100644 --- a/tests/fdstream/buildfile +++ b/tests/fdstream/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/fdstream/driver.cxx b/tests/fdstream/driver.cxx index 42414bc..dd70cff 100644 --- a/tests/fdstream/driver.cxx +++ b/tests/fdstream/driver.cxx @@ -2,6 +2,9 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #ifndef _WIN32 # include # include // this_thread::sleep_for() @@ -11,18 +14,35 @@ #include #include #include -#include #include #include #include // move() #include #include +#endif + +// Other includes. -#include -#include -#include -#include -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#ifndef _WIN32 +//@@ MOD TODO import std.threading; +#endif +#endif +import butl.path; +import butl.process; +import butl.fdstream; +import butl.timestamp; +import butl.filesystem; +#else +#include +#include +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/link/buildfile b/tests/link/buildfile index 9d4f6b5..17e3eac 100644 --- a/tests/link/buildfile +++ b/tests/link/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/link/driver.cxx b/tests/link/driver.cxx index a5e94bb..352cadd 100644 --- a/tests/link/driver.cxx +++ b/tests/link/driver.cxx @@ -2,14 +2,28 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include #include + +#ifndef __cpp_lib_modules +#include #include // pair #include +#endif -#include -#include -#include +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +#endif +import butl.path; +import butl.fdstream; +import butl.filesystem; +#else +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/manifest-parser/buildfile b/tests/manifest-parser/buildfile index b57cac6..2a89e29 100644 --- a/tests/manifest-parser/buildfile +++ b/tests/manifest-parser/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/manifest-parser/driver.cxx b/tests/manifest-parser/driver.cxx index 037df96..76959e5 100644 --- a/tests/manifest-parser/driver.cxx +++ b/tests/manifest-parser/driver.cxx @@ -2,14 +2,27 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include #include #include // pair -#include #include #include - -#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.manifest_parser; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/manifest-roundtrip/buildfile b/tests/manifest-roundtrip/buildfile index a2fb3ac..5cd296f 100644 --- a/tests/manifest-roundtrip/buildfile +++ b/tests/manifest-roundtrip/buildfile @@ -4,5 +4,11 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs exe{driver}: test.roundtrip = manifest diff --git a/tests/manifest-roundtrip/driver.cxx b/tests/manifest-roundtrip/driver.cxx index 2068409..1f0b311 100644 --- a/tests/manifest-roundtrip/driver.cxx +++ b/tests/manifest-roundtrip/driver.cxx @@ -3,12 +3,29 @@ // license : MIT; see accompanying LICENSE file #include + +#ifndef __cpp_lib_modules +#include #include +#endif + +// Other includes. -#include // operator<<(ostream, exception) -#include -#include -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream, exception) +import butl.fdstream; +import butl.manifest_parser; +import butl.manifest_serializer; +#else +#include +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/manifest-serializer/buildfile b/tests/manifest-serializer/buildfile index d13daab..df633ae 100644 --- a/tests/manifest-serializer/buildfile +++ b/tests/manifest-serializer/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/manifest-serializer/driver.cxx b/tests/manifest-serializer/driver.cxx index dad96bd..f373ecf 100644 --- a/tests/manifest-serializer/driver.cxx +++ b/tests/manifest-serializer/driver.cxx @@ -2,14 +2,27 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include #include #include // pair -#include #include #include - -#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.manifest_serializer; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/mventry/buildfile b/tests/mventry/buildfile index b665b61..d9af3a2 100644 --- a/tests/mventry/buildfile +++ b/tests/mventry/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/mventry/driver.cxx b/tests/mventry/driver.cxx index 5639c2b..eab2ce3 100644 --- a/tests/mventry/driver.cxx +++ b/tests/mventry/driver.cxx @@ -2,12 +2,28 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include #include +#endif + +// Other includes. -#include -#include // operator<<(ostream, exception) -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.utility; // operator<<(ostream, exception) +import butl.filesystem; +#else +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/openssl/buildfile b/tests/openssl/buildfile index 7713f14..08b0878 100644 --- a/tests/openssl/buildfile +++ b/tests/openssl/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/openssl/driver.cxx b/tests/openssl/driver.cxx index b0e37ae..092b2ba 100644 --- a/tests/openssl/driver.cxx +++ b/tests/openssl/driver.cxx @@ -2,14 +2,36 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include #include #include #include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.utility; // operator<<(ostream, exception) +import butl.openssl; +import butl.process; +import butl.fdstream; // nullfd -#include -#include // operator<<(ostream, exception) -#include +import butl.optional; // @@ MOD Clang should not be necessary. +import butl.small_vector; // @@ MOD Clang should not be necessary. +#else +#include +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/pager/buildfile b/tests/pager/buildfile index 1c1e9f4..d7d0123 100644 --- a/tests/pager/buildfile +++ b/tests/pager/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/pager/driver.cxx b/tests/pager/driver.cxx index 87c811d..6842cef 100644 --- a/tests/pager/driver.cxx +++ b/tests/pager/driver.cxx @@ -2,15 +2,28 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include // ios_base::failure #include #include #include // move() -#include #include #include - -#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.pager; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/path-entry/buildfile b/tests/path-entry/buildfile index 58e315c..e6515ae 100644 --- a/tests/path-entry/buildfile +++ b/tests/path-entry/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/path-entry/driver.cxx b/tests/path-entry/driver.cxx index 4f36f61..c69bf9c 100644 --- a/tests/path-entry/driver.cxx +++ b/tests/path-entry/driver.cxx @@ -2,11 +2,26 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include #include - -#include // operator<<(ostream, exception) -#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream, exception) +import butl.filesystem; +#else +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/path/buildfile b/tests/path/buildfile index e7f19f2..aa39b2d 100644 --- a/tests/path/buildfile +++ b/tests/path/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/path/driver.cxx b/tests/path/driver.cxx index 4d859b3..c2919c0 100644 --- a/tests/path/driver.cxx +++ b/tests/path/driver.cxx @@ -3,11 +3,25 @@ // license : MIT; see accompanying LICENSE file #include + +#ifndef __cpp_lib_modules #include #include +#endif + +// Other includes. -#include -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.path_io; +#else +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/prefix-map/buildfile b/tests/prefix-map/buildfile index 5c2dd69..140fda9 100644 --- a/tests/prefix-map/buildfile +++ b/tests/prefix-map/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/prefix-map/driver.cxx b/tests/prefix-map/driver.cxx index abf7e01..3e165b2 100644 --- a/tests/prefix-map/driver.cxx +++ b/tests/prefix-map/driver.cxx @@ -2,11 +2,24 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include #include -#include -#include +#ifndef __cpp_lib_modules +#include +#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.prefix_map; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/process-run/buildfile b/tests/process-run/buildfile index 770357c..5200af7 100644 --- a/tests/process-run/buildfile +++ b/tests/process-run/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/process-run/driver.cxx b/tests/process-run/driver.cxx index 695fdb9..765bd7d 100644 --- a/tests/process-run/driver.cxx +++ b/tests/process-run/driver.cxx @@ -2,12 +2,31 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules +#include #include +#endif + +// Other includes. -#include -#include -#include -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.process; +import butl.optional; // @@ MOD Clang shouldn't be needed. +import butl.fdstream; +import butl.small_vector; +#else +#include +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/process/buildfile b/tests/process/buildfile index ddb4688..2ecc915 100644 --- a/tests/process/buildfile +++ b/tests/process/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/process/driver.cxx b/tests/process/driver.cxx index 0338af2..01f2c30 100644 --- a/tests/process/driver.cxx +++ b/tests/process/driver.cxx @@ -4,17 +4,34 @@ #include // getenv(), setenv(), _putenv() +#include + +#ifndef __cpp_lib_modules #include #include #include -#include -#include #include // istreambuf_iterator, ostream_iterator #include // copy() +#include +#endif + +// Other includes. -#include -#include -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.process; +import butl.optional; +import butl.fdstream; +#else +#include +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/progress/buildfile b/tests/progress/buildfile index 19e85c0..d8cb6d6 100644 --- a/tests/progress/buildfile +++ b/tests/progress/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/progress/driver.cxx b/tests/progress/driver.cxx index 0ff68f0..c8c2080 100644 --- a/tests/progress/driver.cxx +++ b/tests/progress/driver.cxx @@ -4,20 +4,43 @@ #ifndef _WIN32 # include // write() - -# include // this_thread::sleep_for() #else # include - # include //_write() #endif +#include + +#ifndef __cpp_lib_modules +#include #include // size_t #include +#ifndef _WIN32 +# include // this_thread::sleep_for() +#endif +#endif -#include -#include // fdnull(), stderr_fd() -#include +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#ifndef _WIN32 +//@@ MOD TODO import std.threading; +#endif +#endif +import butl.process; +import butl.fdstream; +import butl.diagnostics; + +import butl.optional; // @@ MOD Clang should not be necessary. +import butl.small_vector; // @@ MOD Clang should not be necessary. +#else +#include +#include // fdnull(), stderr_fd() +#include +#endif using namespace std; using namespace butl; diff --git a/tests/regex/buildfile b/tests/regex/buildfile index baf4bca..ae7e2c3 100644 --- a/tests/regex/buildfile +++ b/tests/regex/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/regex/driver.cxx b/tests/regex/driver.cxx index 054eb31..d48b716 100644 --- a/tests/regex/driver.cxx +++ b/tests/regex/driver.cxx @@ -2,13 +2,27 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include #include + +#ifndef __cpp_lib_modules +#include #include #include +#endif + +// Other includes. -#include -#include // operator<<(ostream, exception) +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.regex; +import butl.utility; // operator<<(ostream, exception) +#else +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/sendmail/buildfile b/tests/sendmail/buildfile index a83cf40..a854e89 100644 --- a/tests/sendmail/buildfile +++ b/tests/sendmail/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/sendmail/driver.cxx b/tests/sendmail/driver.cxx index e48c6b4..f5c9227 100644 --- a/tests/sendmail/driver.cxx +++ b/tests/sendmail/driver.cxx @@ -2,12 +2,34 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include #include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.process; +import butl.utility; // operator<<(ostream, exception) +import butl.sendmail; +import butl.fdstream; -#include -#include // operator<<(ostream, exception) -#include +import butl.optional; // @@ MOD Clang should not be necessary. +import butl.small_vector; // @@ MOD Clang should not be necessary. +#else +#include +#include +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/sha256/buildfile b/tests/sha256/buildfile index 627b78f..fb490d0 100644 --- a/tests/sha256/buildfile +++ b/tests/sha256/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/sha256/driver.cxx b/tests/sha256/driver.cxx index 2d2f963..191756c 100644 --- a/tests/sha256/driver.cxx +++ b/tests/sha256/driver.cxx @@ -1,12 +1,25 @@ -// file : tests/triplet/driver.cxx -*- C++ -*- +// file : tests/sha256/driver.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include #include + +#ifndef __cpp_lib_modules +#include #include +#endif + +// Other includes. -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.sha256; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/small-vector/buildfile b/tests/small-vector/buildfile index 33be9ad..16d61f8 100644 --- a/tests/small-vector/buildfile +++ b/tests/small-vector/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/small-vector/driver.cxx b/tests/small-vector/driver.cxx index c7cafd4..fe386a4 100644 --- a/tests/small-vector/driver.cxx +++ b/tests/small-vector/driver.cxx @@ -2,11 +2,25 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include #include -#include -#include +#ifndef __cpp_lib_modules +#include +#include +#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.small_vector; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/standard-version/buildfile b/tests/standard-version/buildfile index 0583b62..eb30733 100644 --- a/tests/standard-version/buildfile +++ b/tests/standard-version/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx index fa149ae..c6f9c11 100644 --- a/tests/standard-version/driver.cxx +++ b/tests/standard-version/driver.cxx @@ -2,14 +2,28 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include // ios::failbit, ios::badbit #include -#include #include #include // invalid_argument - -#include // operator<<(ostream,exception) -#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream,exception) +import butl.standard_version; +#else +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/strcase/buildfile b/tests/strcase/buildfile index 71fec53..efe8442 100644 --- a/tests/strcase/buildfile +++ b/tests/strcase/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/strcase/driver.cxx b/tests/strcase/driver.cxx index f7f4bd1..285892d 100644 --- a/tests/strcase/driver.cxx +++ b/tests/strcase/driver.cxx @@ -2,10 +2,22 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include #include -#include +#ifndef __cpp_lib_modules +#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +#endif +import butl.utility; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/string-parser/buildfile b/tests/string-parser/buildfile index 5969cd0..4613df1 100644 --- a/tests/string-parser/buildfile +++ b/tests/string-parser/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/string-parser/driver.cxx b/tests/string-parser/driver.cxx index 09443f2..f454a6f 100644 --- a/tests/string-parser/driver.cxx +++ b/tests/string-parser/driver.cxx @@ -2,17 +2,30 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include // ios::failbit, ios::badbit -#include -#include #include + +#ifndef __cpp_lib_modules +#include +#include #include +#endif + +// Other includes. -#include // operator<<(ostream,exception) -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream,exception) +import butl.string_parser; +#else +#include +#include +#endif using namespace std; -using namespace butl; +using namespace butl::string_parser; // Usage: argv[0] [-l] [-u] [-p] // @@ -54,8 +67,7 @@ try string l; while (getline (cin, l)) { - vector> v ( - string_parser::parse_quoted_position (l, unquote)); + vector> v (parse_quoted_position (l, unquote)); if (!spl) { diff --git a/tests/tab-parser/buildfile b/tests/tab-parser/buildfile index 0583b62..eb30733 100644 --- a/tests/tab-parser/buildfile +++ b/tests/tab-parser/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/tab-parser/driver.cxx b/tests/tab-parser/driver.cxx index 238c12a..d5ff5a0 100644 --- a/tests/tab-parser/driver.cxx +++ b/tests/tab-parser/driver.cxx @@ -2,12 +2,26 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file -#include // ios::failbit, ios::badbit #include + +#ifndef __cpp_lib_modules +#include #include +#endif + +// Other includes. -#include // operator<<(ostream,exception) -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.utility; // operator<<(ostream,exception) +import butl.tab_parser; +#else +#include +#include +#endif using namespace std; using namespace butl; diff --git a/tests/target-triplet/buildfile b/tests/target-triplet/buildfile index b8ca712..7dec846 100644 --- a/tests/target-triplet/buildfile +++ b/tests/target-triplet/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/target-triplet/driver.cxx b/tests/target-triplet/driver.cxx index b446a6f..5e61a46 100644 --- a/tests/target-triplet/driver.cxx +++ b/tests/target-triplet/driver.cxx @@ -3,10 +3,24 @@ // license : MIT; see accompanying LICENSE file #include + +#ifndef __cpp_lib_modules +#include #include #include // invalid_argument - -#include +#endif + +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.target_triplet; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/timestamp/buildfile b/tests/timestamp/buildfile index 085daf0..c554fc3 100644 --- a/tests/timestamp/buildfile +++ b/tests/timestamp/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/timestamp/driver.cxx b/tests/timestamp/driver.cxx index 661deb2..ec4c49d 100644 --- a/tests/timestamp/driver.cxx +++ b/tests/timestamp/driver.cxx @@ -4,15 +4,28 @@ #include // tzset() (POSIX), _tzset() (Windows) +#include + +#ifndef __cpp_lib_modules #include #include #include -#include #include #include #include +#endif -#include +// Other includes. + +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.timestamp; +#else +#include +#endif using namespace std; using namespace butl; diff --git a/tests/wildcard/buildfile b/tests/wildcard/buildfile index fc8e94b..90e8b58 100644 --- a/tests/wildcard/buildfile +++ b/tests/wildcard/buildfile @@ -4,4 +4,10 @@ import libs = libbutl%lib{butl} +if ($cxx.features.modules && ($force_std_modules == true || $cxx.id != 'msvc')) +{ + import libs += libstd-modules%liba{std-modules} + cxx.poptions += -D__cpp_lib_modules +} + exe{driver}: {hxx cxx}{*} $libs test{testscript} diff --git a/tests/wildcard/driver.cxx b/tests/wildcard/driver.cxx index 502726f..d95d7cd 100644 --- a/tests/wildcard/driver.cxx +++ b/tests/wildcard/driver.cxx @@ -2,18 +2,34 @@ // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file +#include + +#ifndef __cpp_lib_modules #include #include #include -#include -#include #include // sort() #include +#include +#endif + +// Other includes. -#include -#include // operator<<(ostream, exception) -#include -#include +#ifdef __cpp_modules +#ifdef __cpp_lib_modules +import std.core; +import std.io; +#endif +import butl.path; +import butl.utility; // operator<<(ostream, exception) +import butl.optional; +import butl.filesystem; +#else +#include +#include +#include +#include +#endif using namespace std; using namespace butl; -- cgit v1.1