diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-09-28 19:24:31 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-09-28 20:29:59 +0300 |
commit | df1ef68cd8e8582724ce1192bfc202e0b9aeaf0c (patch) | |
tree | b731ca4c68e60c00c7e7d499dbf4868ee7b71f44 | |
parent | 7a4fc37f264cdb67f2f83fa92703c869215bbc86 (diff) |
Get rid of C++ modules related code and rename *.mxx files to *.hxx
-rw-r--r-- | build/root.build | 2 | ||||
-rw-r--r-- | libbutl/b.cxx | 58 | ||||
-rw-r--r-- | libbutl/b.hxx (renamed from libbutl/b.mxx) | 39 | ||||
-rw-r--r-- | libbutl/backtrace.cxx | 22 | ||||
-rw-r--r-- | libbutl/backtrace.hxx (renamed from libbutl/backtrace.mxx) | 19 | ||||
-rw-r--r-- | libbutl/base64.cxx | 26 | ||||
-rw-r--r-- | libbutl/base64.hxx (renamed from libbutl/base64.mxx) | 20 | ||||
-rw-r--r-- | libbutl/buildfile | 19 | ||||
-rw-r--r-- | libbutl/builtin.cxx | 55 | ||||
-rw-r--r-- | libbutl/builtin.hxx (renamed from libbutl/builtin.mxx) | 31 | ||||
-rw-r--r-- | libbutl/char-scanner.hxx (renamed from libbutl/char-scanner.mxx) | 21 | ||||
-rw-r--r-- | libbutl/char-scanner.txx | 2 | ||||
-rw-r--r-- | libbutl/command.cxx | 42 | ||||
-rw-r--r-- | libbutl/command.hxx (renamed from libbutl/command.mxx) | 23 | ||||
-rw-r--r-- | libbutl/const-ptr.hxx (renamed from libbutl/const-ptr.mxx) | 19 | ||||
-rw-r--r-- | libbutl/curl.cxx | 34 | ||||
-rw-r--r-- | libbutl/curl.hxx (renamed from libbutl/curl.mxx) | 35 | ||||
-rw-r--r-- | libbutl/curl.ixx | 6 | ||||
-rw-r--r-- | libbutl/curl.txx | 2 | ||||
-rw-r--r-- | libbutl/default-options.hxx (renamed from libbutl/default-options.mxx) | 37 | ||||
-rw-r--r-- | libbutl/default-options.ixx | 2 | ||||
-rw-r--r-- | libbutl/default-options.txx | 10 | ||||
-rw-r--r-- | libbutl/diagnostics.cxx | 37 | ||||
-rw-r--r-- | libbutl/diagnostics.hxx (renamed from libbutl/diagnostics.mxx) | 17 | ||||
-rw-r--r-- | libbutl/export.hxx | 8 | ||||
-rw-r--r-- | libbutl/fdstream.cxx | 43 | ||||
-rw-r--r-- | libbutl/fdstream.hxx (renamed from libbutl/fdstream.mxx) | 34 | ||||
-rw-r--r-- | libbutl/fdstream.ixx | 2 | ||||
-rw-r--r-- | libbutl/filesystem.cxx | 45 | ||||
-rw-r--r-- | libbutl/filesystem.hxx (renamed from libbutl/filesystem.mxx) | 38 | ||||
-rw-r--r-- | libbutl/filesystem.ixx | 3 | ||||
-rw-r--r-- | libbutl/git.cxx | 40 | ||||
-rw-r--r-- | libbutl/git.hxx (renamed from libbutl/git.mxx) | 28 | ||||
-rw-r--r-- | libbutl/lz4-stream.cxx | 2 | ||||
-rw-r--r-- | libbutl/lz4-stream.hxx | 2 | ||||
-rw-r--r-- | libbutl/lz4.cxx | 2 | ||||
-rw-r--r-- | libbutl/lz4.hxx | 4 | ||||
-rw-r--r-- | libbutl/manifest-parser.cxx | 31 | ||||
-rw-r--r-- | libbutl/manifest-parser.hxx (renamed from libbutl/manifest-parser.mxx) | 34 | ||||
-rw-r--r-- | libbutl/manifest-rewriter.cxx | 36 | ||||
-rw-r--r-- | libbutl/manifest-rewriter.hxx (renamed from libbutl/manifest-rewriter.mxx) | 28 | ||||
-rw-r--r-- | libbutl/manifest-serializer.cxx | 37 | ||||
-rw-r--r-- | libbutl/manifest-serializer.hxx (renamed from libbutl/manifest-serializer.mxx) | 23 | ||||
-rw-r--r-- | libbutl/manifest-types.hxx (renamed from libbutl/manifest-types.mxx) | 22 | ||||
-rw-r--r-- | libbutl/multi-index.hxx (renamed from libbutl/multi-index.mxx) | 21 | ||||
-rw-r--r-- | libbutl/openssl.cxx | 27 | ||||
-rw-r--r-- | libbutl/openssl.hxx (renamed from libbutl/openssl.mxx) | 34 | ||||
-rw-r--r-- | libbutl/openssl.ixx | 5 | ||||
-rw-r--r-- | libbutl/openssl.txx | 4 | ||||
-rw-r--r-- | libbutl/optional.hxx (renamed from libbutl/optional.mxx) | 21 | ||||
-rw-r--r-- | libbutl/pager.cxx | 40 | ||||
-rw-r--r-- | libbutl/pager.hxx (renamed from libbutl/pager.mxx) | 26 | ||||
-rw-r--r-- | libbutl/path-io.hxx (renamed from libbutl/path-io.mxx) | 24 | ||||
-rw-r--r-- | libbutl/path-map.hxx (renamed from libbutl/path-map.mxx) | 27 | ||||
-rw-r--r-- | libbutl/path-pattern.cxx | 33 | ||||
-rw-r--r-- | libbutl/path-pattern.hxx (renamed from libbutl/path-pattern.mxx) | 27 | ||||
-rw-r--r-- | libbutl/path.cxx | 29 | ||||
-rw-r--r-- | libbutl/path.hxx (renamed from libbutl/path.mxx) | 31 | ||||
-rw-r--r-- | libbutl/path.ixx | 2 | ||||
-rw-r--r-- | libbutl/path.txx | 2 | ||||
-rw-r--r-- | libbutl/prefix-map.hxx (renamed from libbutl/prefix-map.mxx) | 19 | ||||
-rw-r--r-- | libbutl/prefix-map.txx | 2 | ||||
-rw-r--r-- | libbutl/process-details.hxx | 5 | ||||
-rw-r--r-- | libbutl/process-io.cxx | 29 | ||||
-rw-r--r-- | libbutl/process-io.hxx (renamed from libbutl/process-io.mxx) | 23 | ||||
-rw-r--r-- | libbutl/process-run.cxx | 27 | ||||
-rw-r--r-- | libbutl/process-run.txx | 4 | ||||
-rw-r--r-- | libbutl/process.cxx | 56 | ||||
-rw-r--r-- | libbutl/process.hxx (renamed from libbutl/process.mxx) | 37 | ||||
-rw-r--r-- | libbutl/process.ixx | 3 | ||||
-rw-r--r-- | libbutl/project-name.cxx | 30 | ||||
-rw-r--r-- | libbutl/project-name.hxx (renamed from libbutl/project-name.mxx) | 23 | ||||
-rw-r--r-- | libbutl/prompt.cxx | 26 | ||||
-rw-r--r-- | libbutl/prompt.hxx (renamed from libbutl/prompt.mxx) | 19 | ||||
-rw-r--r-- | libbutl/regex.cxx | 31 | ||||
-rw-r--r-- | libbutl/regex.hxx (renamed from libbutl/regex.mxx) | 29 | ||||
-rw-r--r-- | libbutl/regex.ixx | 4 | ||||
-rw-r--r-- | libbutl/regex.txx | 5 | ||||
-rw-r--r-- | libbutl/semantic-version.cxx | 29 | ||||
-rw-r--r-- | libbutl/semantic-version.hxx (renamed from libbutl/semantic-version.mxx) | 23 | ||||
-rw-r--r-- | libbutl/sendmail.cxx | 27 | ||||
-rw-r--r-- | libbutl/sendmail.hxx (renamed from libbutl/sendmail.mxx) | 31 | ||||
-rw-r--r-- | libbutl/sendmail.ixx | 5 | ||||
-rw-r--r-- | libbutl/sha1.cxx | 24 | ||||
-rw-r--r-- | libbutl/sha1.hxx (renamed from libbutl/sha1.mxx) | 19 | ||||
-rw-r--r-- | libbutl/sha256.cxx | 34 | ||||
-rw-r--r-- | libbutl/sha256.hxx (renamed from libbutl/sha256.mxx) | 19 | ||||
-rw-r--r-- | libbutl/small-allocator.hxx (renamed from libbutl/small-allocator.mxx) | 18 | ||||
-rw-r--r-- | libbutl/small-forward-list.hxx (renamed from libbutl/small-forward-list.mxx) | 20 | ||||
-rw-r--r-- | libbutl/small-list.hxx (renamed from libbutl/small-list.mxx) | 24 | ||||
-rw-r--r-- | libbutl/small-vector-odb.hxx | 2 | ||||
-rw-r--r-- | libbutl/small-vector.hxx (renamed from libbutl/small-vector.mxx) | 24 | ||||
-rw-r--r-- | libbutl/standard-version.cxx | 33 | ||||
-rw-r--r-- | libbutl/standard-version.hxx (renamed from libbutl/standard-version.mxx) | 23 | ||||
-rw-r--r-- | libbutl/string-parser.cxx | 28 | ||||
-rw-r--r-- | libbutl/string-parser.hxx (renamed from libbutl/string-parser.mxx) | 19 | ||||
-rw-r--r-- | libbutl/string-table.hxx (renamed from libbutl/string-table.mxx) | 26 | ||||
-rw-r--r-- | libbutl/string-table.txx | 3 | ||||
-rw-r--r-- | libbutl/tab-parser.cxx | 31 | ||||
-rw-r--r-- | libbutl/tab-parser.hxx (renamed from libbutl/tab-parser.mxx) | 20 | ||||
-rw-r--r-- | libbutl/target-triplet.cxx | 26 | ||||
-rw-r--r-- | libbutl/target-triplet.hxx (renamed from libbutl/target-triplet.mxx) | 22 | ||||
-rw-r--r-- | libbutl/timestamp.cxx | 39 | ||||
-rw-r--r-- | libbutl/timestamp.hxx (renamed from libbutl/timestamp.mxx) | 32 | ||||
-rw-r--r-- | libbutl/unicode.cxx | 23 | ||||
-rw-r--r-- | libbutl/unicode.hxx (renamed from libbutl/unicode.mxx) | 20 | ||||
-rw-r--r-- | libbutl/url.hxx (renamed from libbutl/url.mxx) | 41 | ||||
-rw-r--r-- | libbutl/url.ixx | 2 | ||||
-rw-r--r-- | libbutl/url.txx | 7 | ||||
-rw-r--r-- | libbutl/utf8.hxx (renamed from libbutl/utf8.mxx) | 22 | ||||
-rw-r--r-- | libbutl/utility.cxx | 26 | ||||
-rw-r--r-- | libbutl/utility.hxx (renamed from libbutl/utility.mxx) | 27 | ||||
-rw-r--r-- | libbutl/utility.ixx | 2 | ||||
-rw-r--r-- | libbutl/uuid-linux.cxx | 2 | ||||
-rw-r--r-- | libbutl/vector-view.hxx (renamed from libbutl/vector-view.mxx) | 19 | ||||
-rw-r--r-- | libbutl/win32-utility.cxx | 9 | ||||
-rw-r--r-- | libbutl/win32-utility.hxx | 4 | ||||
-rw-r--r-- | tests/b-info/driver.cxx | 22 | ||||
-rw-r--r-- | tests/backtrace/driver.cxx | 21 | ||||
-rw-r--r-- | tests/base64/driver.cxx | 14 | ||||
-rw-r--r-- | tests/builtin/driver.cxx | 26 | ||||
-rw-r--r-- | tests/command/driver.cxx | 29 | ||||
-rw-r--r-- | tests/cpfile/driver.cxx | 20 | ||||
-rw-r--r-- | tests/curl/driver.cxx | 31 | ||||
-rw-r--r-- | tests/default-options/driver.cxx | 30 | ||||
-rw-r--r-- | tests/dir-iterator/driver.cxx | 25 | ||||
-rw-r--r-- | tests/entry-time/driver.cxx | 23 | ||||
-rw-r--r-- | tests/fdstream/driver.cxx | 29 | ||||
-rw-r--r-- | tests/link/driver.cxx | 26 | ||||
-rw-r--r-- | tests/lz4/driver.cxx | 4 | ||||
-rw-r--r-- | tests/manifest-parser/driver.cxx | 19 | ||||
-rw-r--r-- | tests/manifest-rewriter/driver.cxx | 28 | ||||
-rw-r--r-- | tests/manifest-roundtrip/driver.cxx | 23 | ||||
-rw-r--r-- | tests/manifest-serializer/driver.cxx | 16 | ||||
-rw-r--r-- | tests/mventry/driver.cxx | 20 | ||||
-rw-r--r-- | tests/openssl/driver.cxx | 27 | ||||
-rw-r--r-- | tests/optional/driver.cxx | 15 | ||||
-rw-r--r-- | tests/pager/driver.cxx | 16 | ||||
-rw-r--r-- | tests/path-entry/driver.cxx | 31 | ||||
-rw-r--r-- | tests/path/driver.cxx | 17 | ||||
-rw-r--r-- | tests/prefix-map/driver.cxx | 16 | ||||
-rw-r--r-- | tests/process-run/driver.cxx | 26 | ||||
-rw-r--r-- | tests/process-term/driver.cxx | 20 | ||||
-rw-r--r-- | tests/process/driver.cxx | 31 | ||||
-rw-r--r-- | tests/progress/driver.cxx | 26 | ||||
-rw-r--r-- | tests/project-name/driver.cxx | 20 | ||||
-rw-r--r-- | tests/regex/driver.cxx | 18 | ||||
-rw-r--r-- | tests/semantic-version/driver.cxx | 14 | ||||
-rw-r--r-- | tests/sendmail/driver.cxx | 27 | ||||
-rw-r--r-- | tests/sha1/driver.cxx | 24 | ||||
-rw-r--r-- | tests/sha256/driver.cxx | 24 | ||||
-rw-r--r-- | tests/small-forward-list/driver.cxx | 16 | ||||
-rw-r--r-- | tests/small-list/driver.cxx | 14 | ||||
-rw-r--r-- | tests/small-vector/driver.cxx | 16 | ||||
-rw-r--r-- | tests/standard-version/driver.cxx | 22 | ||||
-rw-r--r-- | tests/strcase/driver.cxx | 13 | ||||
-rw-r--r-- | tests/string-parser/driver.cxx | 19 | ||||
-rw-r--r-- | tests/tab-parser/driver.cxx | 17 | ||||
-rw-r--r-- | tests/target-triplet/driver.cxx | 16 | ||||
-rw-r--r-- | tests/timestamp/driver.cxx | 14 | ||||
-rw-r--r-- | tests/url/driver.cxx | 19 | ||||
-rw-r--r-- | tests/utf8/driver.cxx | 18 | ||||
-rw-r--r-- | tests/wildcard/driver.cxx | 26 |
163 files changed, 548 insertions, 2990 deletions
diff --git a/build/root.build b/build/root.build index e867421..1526ef0 100644 --- a/build/root.build +++ b/build/root.build @@ -5,7 +5,7 @@ cxx.std = latest using cxx -hxx{*}: extension = hxx # We also have .mxx; see libbutl/buildfile. +hxx{*}: extension = hxx ixx{*}: extension = ixx txx{*}: extension = txx cxx{*}: extension = cxx diff --git a/libbutl/b.cxx b/libbutl/b.cxx index 86a87ff..74a430c 100644 --- a/libbutl/b.cxx +++ b/libbutl/b.cxx @@ -1,59 +1,19 @@ // file : libbutl/b.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/b.mxx> -#endif - -// C includes. +#include <libbutl/b.hxx> +#include <ios> // ios::failure #include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <vector> -#include <cstddef> -#include <cstdint> -#include <stdexcept> -#include <functional> - -#include <ios> // ios::failure -#include <utility> // move() +#include <utility> // move() #include <sstream> #include <algorithm> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.b; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.url; -import butl.path; -import butl.process; -import butl.optional; -import butl.project_name; -import butl.standard_version; -#endif - -import butl.utility; // next_word(), eof(), etc -import butl.path_io; -import butl.fdstream; -import butl.process_io; // operator<<(ostream, process_path) -import butl.small_vector; -#else -#include <libbutl/utility.mxx> -#include <libbutl/path-io.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/process-io.mxx> -#include <libbutl/small-vector.mxx> -#endif + +#include <libbutl/utility.hxx> // next_word(), eof(), etc +#include <libbutl/path-io.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/process-io.hxx> // operator<<(ostream, process_path) +#include <libbutl/small-vector.hxx> using namespace std; diff --git a/libbutl/b.mxx b/libbutl/b.hxx index cca9696..cc3a309 100644 --- a/libbutl/b.mxx +++ b/libbutl/b.hxx @@ -1,13 +1,8 @@ -// file : libbutl/b.mxx -*- C++ -*- +// file : libbutl/b.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <utility> // move() @@ -15,33 +10,17 @@ #include <cstdint> // uint16_t #include <stdexcept> // runtime_error #include <functional> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.b; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.url; -import butl.path; -import butl.process; -import butl.optional; -import butl.project_name; -import butl.standard_version; -#else -#include <libbutl/url.mxx> -#include <libbutl/path.mxx> -#include <libbutl/process.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/project-name.mxx> -#include <libbutl/standard-version.mxx> -#endif + +#include <libbutl/url.hxx> +#include <libbutl/path.hxx> +#include <libbutl/process.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/project-name.hxx> +#include <libbutl/standard-version.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { class LIBBUTL_SYMEXPORT b_error: public std::runtime_error { diff --git a/libbutl/backtrace.cxx b/libbutl/backtrace.cxx index 8c9c6ae..c0cf472 100644 --- a/libbutl/backtrace.cxx +++ b/libbutl/backtrace.cxx @@ -1,9 +1,7 @@ // file : libbutl/backtrace.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/backtrace.mxx> -#endif +#include <libbutl/backtrace.hxx> // We only enable backtrace during bootstrap if we can do it without any // complications of the build scripts/makefiles. @@ -35,30 +33,12 @@ #include <cassert> -#ifndef __cpp_lib_modules_ts -#include <string> - #ifdef LIBBUTL_BACKTRACE # include <memory> // unique_ptr # include <cstddef> // size_t #endif #include <exception> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.backtrace; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif - -#endif using namespace std; diff --git a/libbutl/backtrace.mxx b/libbutl/backtrace.hxx index f5a63d5..6afb6ea 100644 --- a/libbutl/backtrace.mxx +++ b/libbutl/backtrace.hxx @@ -1,28 +1,13 @@ -// file : libbutl/backtrace.mxx -*- C++ -*- +// file : libbutl/backtrace.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.backtrace; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Return the calling thread's backtrace or empty string if this // functionality is not supported or an error has occurred. The exact diff --git a/libbutl/base64.cxx b/libbutl/base64.cxx index 527c6af..4466f24 100644 --- a/libbutl/base64.cxx +++ b/libbutl/base64.cxx @@ -1,37 +1,13 @@ // file : libbutl/base64.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/base64.mxx> -#endif - -// C includes. - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <vector> +#include <libbutl/base64.hxx> #include <cstddef> // size_t #include <istream> #include <ostream> #include <iterator> // {istreambuf, ostreambuf, back_insert}_iterator #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.base64; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif - -#endif using namespace std; diff --git a/libbutl/base64.mxx b/libbutl/base64.hxx index 698b7e2..f38e62f 100644 --- a/libbutl/base64.mxx +++ b/libbutl/base64.hxx @@ -1,31 +1,15 @@ -// file : libbutl/base64.mxx -*- C++ -*- +// file : libbutl/base64.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <iosfwd> #include <string> #include <vector> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.base64; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Base64-encode a stream or a buffer. Split the output into 76 char-long // lines (new line is the 77th). If reading from a stream, check if it has diff --git a/libbutl/buildfile b/libbutl/buildfile index 5398f71..ff7344e 100644 --- a/libbutl/buildfile +++ b/libbutl/buildfile @@ -1,22 +1,13 @@ # file : libbutl/buildfile # license : MIT; see accompanying LICENSE file -# This library was modularized using the Modules TS semantics (with support -# for dual, module/header consumption) which was subsequently partially -# dismantled. We, however, kept some of the changes in anticipation that they -# would be useful when attempting to modularize using the merged modules -# semantics. Specifically, there are currently headers with both .mxx and .hxx -# extensions and the code is littered with the `#if __cpp_[lib_]modules_ts` -# blocks. Note that it's important for the auto-generated header support -# that the default extension for hxx{} is .hxx. -# # @@ If/when going back to using mxx{}, make sure to cleanup explicit .mxx. # -lib{butl}: {hxx ixx txx cxx}{** -uuid-* +uuid-io \ - -win32-utility \ - -version \ - -builtin-options} \ - hxx{**.mxx} {hxx}{version} {hxx ixx cxx}{builtin-options} +lib{butl}: {hxx ixx txx cxx}{** -uuid-* +uuid-io \ + -win32-utility \ + -version \ + -builtin-options} \ + {hxx}{version} {hxx ixx cxx}{builtin-options} tclass = $cxx.target.class tsys = $cxx.target.system diff --git a/libbutl/builtin.cxx b/libbutl/builtin.cxx index 61df568..4d6b60d 100644 --- a/libbutl/builtin.cxx +++ b/libbutl/builtin.cxx @@ -1,28 +1,16 @@ // file : libbutl/builtin.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/builtin.mxx> -#endif +#include <libbutl/builtin.hxx> #ifdef _WIN32 # include <libbutl/win32-utility.hxx> #endif -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <map> -#include <string> -#include <vector> -#include <thread> -#include <utility> // move(), forward() -#include <cstdint> // uint*_t -#include <functional> - #include <ios> #include <chrono> #include <cerrno> +#include <cassert> #include <ostream> #include <sstream> #include <cstdlib> // strtoull() @@ -30,41 +18,16 @@ #include <exception> #include <system_error> -#endif +#include <libbutl/regex.hxx> +#include <libbutl/path-io.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream,exception), + // throw_generic_error() +#include <libbutl/optional.hxx> +#include <libbutl/filesystem.hxx> +#include <libbutl/small-vector.hxx> #include <libbutl/builtin-options.hxx> -#ifdef __cpp_modules_ts -module butl.builtin; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -import std.threading; -#endif -import butl.path; -import butl.fdstream; -import butl.timestamp; -#endif - -import butl.regex; -import butl.path_io; -import butl.utility; // operator<<(ostream,exception), - // throw_generic_error() -import butl.optional; -import butl.filesystem; -import butl.small_vector; -#else -#include <libbutl/regex.mxx> -#include <libbutl/path-io.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/filesystem.mxx> -#include <libbutl/small-vector.mxx> -#endif - // Strictly speaking a builtin which reads/writes from/to standard streams // must be asynchronous so that the caller can communicate with it through // pipes without being blocked on I/O operations. However, as an optimization, diff --git a/libbutl/builtin.mxx b/libbutl/builtin.hxx index a99d6f4..2398c84 100644 --- a/libbutl/builtin.mxx +++ b/libbutl/builtin.hxx @@ -1,13 +1,8 @@ -// file : libbutl/builtin.mxx -*- C++ -*- +// file : libbutl/builtin.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <map> #include <mutex> #include <string> @@ -20,28 +15,14 @@ #include <cstdint> // uint8_t #include <functional> #include <condition_variable> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.builtin; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.threading; -#endif -import butl.path; -import butl.fdstream; -import butl.timestamp; -#else -#include <libbutl/path.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/timestamp.mxx> -#endif + +#include <libbutl/path.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/timestamp.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // A process/thread-like object representing a running builtin. // diff --git a/libbutl/char-scanner.mxx b/libbutl/char-scanner.hxx index 27f692b..b7ea14b 100644 --- a/libbutl/char-scanner.mxx +++ b/libbutl/char-scanner.hxx @@ -1,36 +1,21 @@ -// file : libbutl/char-scanner.mxx -*- C++ -*- +// file : libbutl/char-scanner.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -#include <cassert> - -#ifndef __cpp_lib_modules_ts #include <string> // char_traits +#include <cassert> #include <cstddef> // size_t #include <cstdint> // uint64_t #include <climits> // INT_* #include <utility> // pair, make_pair() #include <istream> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.char_scanner; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#else #include <libbutl/bufstreambuf.hxx> -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Refer to utf8_validator for details. // diff --git a/libbutl/char-scanner.txx b/libbutl/char-scanner.txx index 63389f0..6e0063a 100644 --- a/libbutl/char-scanner.txx +++ b/libbutl/char-scanner.txx @@ -1,9 +1,7 @@ // file : libbutl/char-scanner.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <utility> // move -#endif namespace butl { diff --git a/libbutl/command.cxx b/libbutl/command.cxx index c23dfd5..6f8c0f1 100644 --- a/libbutl/command.cxx +++ b/libbutl/command.cxx @@ -1,48 +1,18 @@ // file : libbutl/command.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/command.mxx> -#endif - -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <map> -#include <string> -#include <cstddef> -#include <functional> +#include <libbutl/command.hxx> #include <ios> // ios::failure #include <vector> +#include <cassert> #include <utility> // move() #include <stdexcept> // invalid_argument #include <system_error> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.command; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.process; -import butl.optional; -#endif - -import butl.builtin; -import butl.fdstream; -import butl.string_parser; -#else -#include <libbutl/builtin.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/string-parser.mxx> -#endif + +#include <libbutl/builtin.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/string-parser.hxx> using namespace std; diff --git a/libbutl/command.mxx b/libbutl/command.hxx index 143d406..fb7258f 100644 --- a/libbutl/command.mxx +++ b/libbutl/command.hxx @@ -1,34 +1,19 @@ -// file : libbutl/command.mxx -*- C++ -*- +// file : libbutl/command.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -#ifndef __cpp_lib_modules_ts #include <map> #include <string> #include <cstddef> // size_t #include <functional> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.command; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.process; -import butl.optional; -#else -#include <libbutl/process.mxx> -#include <libbutl/optional.mxx> -#endif +#include <libbutl/process.hxx> +#include <libbutl/optional.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Run a process or a builtin, interpreting the command line as // whitespace-separated, potentially quoted program path/builtin name, diff --git a/libbutl/const-ptr.mxx b/libbutl/const-ptr.hxx index 343ecf6..f0ff706 100644 --- a/libbutl/const-ptr.mxx +++ b/libbutl/const-ptr.hxx @@ -1,28 +1,13 @@ -// file : libbutl/const-ptr.mxx -*- C++ -*- +// file : libbutl/const-ptr.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <cstddef> // nullptr_t -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.const_ptr; -#ifdef __cpp_lib_modules_ts -import std.core; // @@ MOD std.fundamental. -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Const-propagating pointer. // diff --git a/libbutl/curl.cxx b/libbutl/curl.cxx index ac3d0cb..addba81 100644 --- a/libbutl/curl.cxx +++ b/libbutl/curl.cxx @@ -1,41 +1,13 @@ // file : libbutl/curl.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/curl.mxx> -#endif - -// C includes. +#include <libbutl/curl.hxx> #include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> - #include <utility> // move() #include <exception> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.curl; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.process; -import butl.fdstream; -import butl.small_vector; -#endif - -import butl.utility; // icasecmp() -#else -#include <libbutl/utility.mxx> -#endif + +#include <libbutl/utility.hxx> using namespace std; diff --git a/libbutl/curl.mxx b/libbutl/curl.hxx index 03aac99..cd4ebd0 100644 --- a/libbutl/curl.mxx +++ b/libbutl/curl.hxx @@ -1,42 +1,19 @@ -// file : libbutl/curl.mxx -*- C++ -*- +// file : libbutl/curl.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <type_traits> -#include <cstddef> // size_t -#include <utility> // forward() -#include <exception> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.curl; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.process; //@@ MOD TODO: should we re-export? -import butl.fdstream; -import butl.small_vector; -#else -#include <libbutl/path.mxx> -#include <libbutl/process.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/small-vector.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/process.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/small-vector.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Perform a method (GET, POST, PUT) on a URL using the curl(1) program. // Throw process_error and io_error (both derive from system_error) in case diff --git a/libbutl/curl.ixx b/libbutl/curl.ixx index 61a4ff5..b7f6496 100644 --- a/libbutl/curl.ixx +++ b/libbutl/curl.ixx @@ -1,7 +1,11 @@ // file : libbutl/curl.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +#include <cstddef> // size_t +#include <utility> // forward() +#include <exception> // invalid_argument + +namespace butl { template <typename I, typename O, diff --git a/libbutl/curl.txx b/libbutl/curl.txx index 0c07d35..ee08145 100644 --- a/libbutl/curl.txx +++ b/libbutl/curl.txx @@ -1,7 +1,7 @@ // file : libbutl/curl.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +namespace butl { template <typename I> typename std::enable_if<curl::is_other<I>::value, I>::type curl:: diff --git a/libbutl/default-options.mxx b/libbutl/default-options.hxx index 1694d48..1d363b6 100644 --- a/libbutl/default-options.mxx +++ b/libbutl/default-options.hxx @@ -1,45 +1,18 @@ -// file : libbutl/default-options.mxx -*- C++ -*- +// file : libbutl/default-options.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> -#include <utility> // move(), forward(), make_pair() -#include <algorithm> // reverse() -#include <stdexcept> // invalid_argument -#include <system_error> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.default_options; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.optional; -import butl.small_vector; - -import butl.git; -import butl.filesystem; -#else -#include <libbutl/path.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/small-vector.mxx> - -#include <libbutl/git.mxx> -#include <libbutl/filesystem.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/small-vector.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Default options files helper implementation. // diff --git a/libbutl/default-options.ixx b/libbutl/default-options.ixx index 4a551ac..7248d7d 100644 --- a/libbutl/default-options.ixx +++ b/libbutl/default-options.ixx @@ -1,7 +1,7 @@ // file : libbutl/default-options.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +namespace butl { template <typename O> inline O diff --git a/libbutl/default-options.txx b/libbutl/default-options.txx index 0c2501c..aa254b2 100644 --- a/libbutl/default-options.txx +++ b/libbutl/default-options.txx @@ -1,7 +1,15 @@ // file : libbutl/default-options.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +#include <utility> // move(), forward(), make_pair() +#include <algorithm> // reverse() +#include <stdexcept> // invalid_argument +#include <system_error> + +#include <libbutl/git.hxx> +#include <libbutl/filesystem.hxx> + +namespace butl { inline bool options_dir_exists (const dir_path& d) diff --git a/libbutl/diagnostics.cxx b/libbutl/diagnostics.cxx index b038e5d..8525d60 100644 --- a/libbutl/diagnostics.cxx +++ b/libbutl/diagnostics.cxx @@ -1,9 +1,7 @@ // file : libbutl/diagnostics.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/diagnostics.mxx> -#endif +#include <libbutl/diagnostics.hxx> #ifndef _WIN32 # include <unistd.h> // write() @@ -12,41 +10,16 @@ # include <io.h> //_write() #endif -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <utility> -#include <exception> - #include <ios> // ios::failure #include <mutex> #include <string> +#include <cassert> #include <cstddef> // size_t #include <iostream> // cerr -#endif - -// Other includes. -#ifdef __cpp_modules_ts -module butl.diagnostics; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif - -import std.threading; -import butl.utility; -import butl.optional; -import butl.fdstream; // stderr_fd(), fdterm() -#else -#include <libbutl/utility.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/fdstream.mxx> -#endif +#include <libbutl/utility.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/fdstream.hxx> using namespace std; diff --git a/libbutl/diagnostics.mxx b/libbutl/diagnostics.hxx index d41ba74..712de0c 100644 --- a/libbutl/diagnostics.mxx +++ b/libbutl/diagnostics.hxx @@ -1,32 +1,19 @@ -// file : libbutl/diagnostics.mxx -*- C++ -*- +// file : libbutl/diagnostics.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif #include <cassert> - -#ifndef __cpp_lib_modules_ts #include <ostream> #include <sstream> #include <utility> // move(), forward() #include <exception> // uncaught_exception[s]() -#endif #include <libbutl/ft/exception.hxx> // uncaught_exceptions -#ifdef __cpp_modules_ts -export module butl.diagnostics; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif - #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Diagnostic facility base infrastructure. // diff --git a/libbutl/export.hxx b/libbutl/export.hxx index 3353ca8..dc04f85 100644 --- a/libbutl/export.hxx +++ b/libbutl/export.hxx @@ -3,14 +3,6 @@ #pragma once -// If modules are available, setup the module export. -// -#ifdef __cpp_modules_ts -# define LIBBUTL_MODEXPORT export -#else -# define LIBBUTL_MODEXPORT -#endif - // Normally we don't export class templates (but do complete specializations), // inline functions, and classes with only inline member functions. Exporting // classes that inherit from non-exported/imported bases (e.g., std::string) diff --git a/libbutl/fdstream.cxx b/libbutl/fdstream.cxx index eb0ec7b..85459de 100644 --- a/libbutl/fdstream.cxx +++ b/libbutl/fdstream.cxx @@ -1,9 +1,7 @@ // file : libbutl/fdstream.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/fdstream.mxx> -#endif +#include <libbutl/fdstream.hxx> #include <errno.h> // errno, E* @@ -39,52 +37,21 @@ # include <algorithm> // count() #endif -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <vector> -#include <string> -#include <chrono> -#include <istream> -#include <ostream> -#include <utility> -#include <cstdint> -#include <cstddef> - #include <ios> // ios_base::openmode, ios_base::failure #include <new> // bad_alloc #include <limits> // numeric_limits +#include <cassert> #include <cstring> // memcpy(), memmove() #include <iostream> // cin, cout #include <exception> // uncaught_exception[s]() #include <stdexcept> // invalid_argument #include <system_error> -#endif -#include <libbutl/ft/exception.hxx> // uncaught_exceptions +#include <libbutl/ft/exception.hxx> // uncaught_exceptions #include <libbutl/process-details.hxx> -#ifdef __cpp_modules_ts -module butl.fdstream; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -import std.threading; // Clang wants it in purview (see process-details.hxx). -#endif -import butl.path; -import butl.filesystem; -import butl.small_vector; -#endif - -import butl.utility; // throw_*_ios_failure(), function_cast() -import butl.timestamp; -#else -#include <libbutl/utility.mxx> -#include <libbutl/timestamp.mxx> -#endif +#include <libbutl/utility.hxx> // throw_*_ios_failure(), function_cast() +#include <libbutl/timestamp.hxx> using namespace std; diff --git a/libbutl/fdstream.mxx b/libbutl/fdstream.hxx index 0d3fd86..4dc89a3 100644 --- a/libbutl/fdstream.mxx +++ b/libbutl/fdstream.hxx @@ -1,13 +1,8 @@ -// file : libbutl/fdstream.mxx -*- C++ -*- +// file : libbutl/fdstream.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif - -#include <cassert> -#ifndef __cpp_lib_modules_ts #include <ios> // streamsize #include <vector> #include <string> @@ -18,30 +13,14 @@ #include <cstdint> // uint16_t, uint64_t #include <cstddef> // size_t -#include <iterator> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.fdstream; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.filesystem; // permissions, entry_stat -import butl.small_vector; -#else -#include <libbutl/path.mxx> -#include <libbutl/filesystem.mxx> -#include <libbutl/small-vector.mxx> +#include <libbutl/path.hxx> +#include <libbutl/filesystem.hxx> // permissions, entry_stat +#include <libbutl/small-vector.hxx> #include <libbutl/bufstreambuf.hxx> -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // RAII type for file descriptors. Note that failure to close the descriptor // is silently ignored by both the destructor and reset(). @@ -55,9 +34,6 @@ LIBBUTL_MODEXPORT namespace butl constexpr operator int () const {return -1;} }; -#if defined(__cpp_modules_ts) && defined(__clang__) //@@ MOD Clang duplicate sym. - inline -#endif constexpr nullfd_t nullfd (-1); class LIBBUTL_SYMEXPORT auto_fd diff --git a/libbutl/fdstream.ixx b/libbutl/fdstream.ixx index 9ec9e06..08e317c 100644 --- a/libbutl/fdstream.ixx +++ b/libbutl/fdstream.ixx @@ -1,6 +1,8 @@ // file : libbutl/fdstream.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file +#include <cassert> + namespace butl { // auto_fd diff --git a/libbutl/filesystem.cxx b/libbutl/filesystem.cxx index 3427ee9..0a3d260 100644 --- a/libbutl/filesystem.cxx +++ b/libbutl/filesystem.cxx @@ -1,9 +1,7 @@ // file : libbutl/filesystem.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/filesystem.mxx> -#endif +#include <libbutl/filesystem.hxx> #include <errno.h> // errno, E* @@ -34,46 +32,17 @@ # include <cstring> // strncmp() #endif -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <cstddef> -#include <cstdint> -#include <utility> -#include <iterator> -#include <functional> - +#include <chrono> #include <vector> #include <memory> // unique_ptr +#include <cassert> #include <algorithm> // find(), copy() #include <system_error> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -module butl.filesystem; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.timestamp; -import butl.path_pattern; -#endif - -import butl.utility; // throw_generic_error() -import butl.fdstream; -import butl.small_vector; -#else -#include <libbutl/path.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/small-vector.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/utility.hxx> // throw_generic_error() +#include <libbutl/fdstream.hxx> +#include <libbutl/small-vector.hxx> #ifndef _WIN32 # ifndef PATH_MAX diff --git a/libbutl/filesystem.mxx b/libbutl/filesystem.hxx index eb03ab2..8804b04 100644 --- a/libbutl/filesystem.mxx +++ b/libbutl/filesystem.hxx @@ -1,9 +1,7 @@ -// file : libbutl/filesystem.mxx -*- C++ -*- +// file : libbutl/filesystem.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif #include <errno.h> // E* @@ -22,7 +20,6 @@ using mode_t = int; #endif -#ifndef __cpp_lib_modules_ts #include <string> #include <cstddef> // ptrdiff_t #include <cstdint> // uint16_t, etc @@ -30,35 +27,14 @@ #include <iterator> // input_iterator_tag #include <functional> -#include <chrono> //@@ MOD needed by timestamp module (no re-export). -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.filesystem; - -#ifdef __cpp_lib_modules_ts -import std.core; -#endif - -import butl.path; -import butl.optional; -import butl.timestamp; -import butl.path_pattern; // path_match_flags - -import butl.utility; // operator<<(ostream,exception), throw_generic_error() -#else -#include <libbutl/path.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/timestamp.mxx> -#include <libbutl/path-pattern.mxx> - -#include <libbutl/utility.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/timestamp.hxx> +#include <libbutl/path-pattern.hxx> // path_match_flags #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Return true if the path is to an existing regular file. Note that by // default this function follows symlinks. Underlying OS errors are reported @@ -780,7 +756,7 @@ LIBBUTL_MODEXPORT namespace butl // Wildcard pattern search (aka glob). // - // For details on the wildcard patterns see <libbutl/path-pattern.mxx> + // For details on the wildcard patterns see <libbutl/path-pattern.hxx> // Search for paths matching the pattern calling the specified function for // each matching path (see below for details). diff --git a/libbutl/filesystem.ixx b/libbutl/filesystem.ixx index 8cd8456..763d311 100644 --- a/libbutl/filesystem.ixx +++ b/libbutl/filesystem.ixx @@ -1,6 +1,9 @@ // file : libbutl/filesystem.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file +#include <libbutl/utility.hxx> // operator<<(ostream,exception), + // throw_generic_error() + namespace butl { inline bool diff --git a/libbutl/git.cxx b/libbutl/git.cxx index b9dd9bc..cc10c91 100644 --- a/libbutl/git.cxx +++ b/libbutl/git.cxx @@ -1,43 +1,11 @@ // file : libbutl/git.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/git.mxx> -#endif +#include <libbutl/git.hxx> -// C includes. - -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> - -#include <cstddef> // size_t -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.git; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.optional; -import butl.semantic_version -#endif - -import butl.utility; // digit() -import butl.filesystem; // entry_exists() -#else -#include <libbutl/utility.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/filesystem.mxx> -#include <libbutl/semantic-version.mxx> -#endif +#include <libbutl/optional.hxx> +#include <libbutl/filesystem.hxx> // entry_exists() +#include <libbutl/semantic-version.hxx> using namespace std; diff --git a/libbutl/git.mxx b/libbutl/git.hxx index 3f003be..add721e 100644 --- a/libbutl/git.mxx +++ b/libbutl/git.hxx @@ -1,35 +1,17 @@ -// file : libbutl/git.mxx -*- C++ -*- +// file : libbutl/git.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.git; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.optional; -import butl.semantic_version; -#else -#include <libbutl/path.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/semantic-version.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/semantic-version.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Return true if the specified directory is a git repository root (contains // the .git filesystem entry). diff --git a/libbutl/lz4-stream.cxx b/libbutl/lz4-stream.cxx index 9d0ac99..8001770 100644 --- a/libbutl/lz4-stream.cxx +++ b/libbutl/lz4-stream.cxx @@ -6,7 +6,7 @@ #include <cstring> // memcpy() #include <stdexcept> // invalid_argument -#include <libbutl/utility.mxx> // eof() +#include <libbutl/utility.hxx> // eof() using namespace std; diff --git a/libbutl/lz4-stream.hxx b/libbutl/lz4-stream.hxx index 5d25670..b11c0a2 100644 --- a/libbutl/lz4-stream.hxx +++ b/libbutl/lz4-stream.hxx @@ -12,7 +12,7 @@ #include <cassert> #include <libbutl/lz4.hxx> -#include <libbutl/optional.mxx> +#include <libbutl/optional.hxx> #include <libbutl/bufstreambuf.hxx> #include <libbutl/export.hxx> diff --git a/libbutl/lz4.cxx b/libbutl/lz4.cxx index a627b06..2db7af2 100644 --- a/libbutl/lz4.cxx +++ b/libbutl/lz4.cxx @@ -26,7 +26,7 @@ #include <cassert> #include <stdexcept> // invalid_argument, logic_error -#include <libbutl/utility.mxx> // eos() +#include <libbutl/utility.hxx> // eos() #if 0 #include <libbutl/lz4-stream.hxx> diff --git a/libbutl/lz4.hxx b/libbutl/lz4.hxx index cfe9967..7886788 100644 --- a/libbutl/lz4.hxx +++ b/libbutl/lz4.hxx @@ -6,8 +6,8 @@ #include <cstdint> #include <cstddef> -#include <libbutl/optional.mxx> -#include <libbutl/fdstream.mxx> +#include <libbutl/optional.hxx> +#include <libbutl/fdstream.hxx> #include <libbutl/export.hxx> diff --git a/libbutl/manifest-parser.cxx b/libbutl/manifest-parser.cxx index 9514bbd..c208eb1 100644 --- a/libbutl/manifest-parser.cxx +++ b/libbutl/manifest-parser.cxx @@ -1,39 +1,10 @@ // file : libbutl/manifest-parser.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/manifest-parser.mxx> -#endif +#include <libbutl/manifest-parser.hxx> #include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <vector> -#include <cstdint> -#include <utility> -#include <stdexcept> - #include <sstream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.manifest_parser; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.optional; -import butl.char_scanner; -import butl.manifest_types; -#endif - -#endif using namespace std; diff --git a/libbutl/manifest-parser.mxx b/libbutl/manifest-parser.hxx index 77addff..d53eb42 100644 --- a/libbutl/manifest-parser.mxx +++ b/libbutl/manifest-parser.hxx @@ -1,13 +1,8 @@ -// file : libbutl/manifest-parser.mxx -*- C++ -*- +// file : libbutl/manifest-parser.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <iosfwd> @@ -15,30 +10,15 @@ #include <utility> // pair, move() #include <stdexcept> // runtime_error #include <functional> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.manifest_parser; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.utf8; -import butl.optional; -import butl.char_scanner; -import butl.manifest_types; -#else -#include <libbutl/utf8.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/char-scanner.mxx> -#include <libbutl/manifest-types.mxx> -#endif + +#include <libbutl/utf8.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/char-scanner.hxx> +#include <libbutl/manifest-types.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { class LIBBUTL_SYMEXPORT manifest_parsing: public std::runtime_error { diff --git a/libbutl/manifest-rewriter.cxx b/libbutl/manifest-rewriter.cxx index 46bf239..3bddd37 100644 --- a/libbutl/manifest-rewriter.cxx +++ b/libbutl/manifest-rewriter.cxx @@ -1,41 +1,15 @@ // file : libbutl/manifest-rewriter.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/manifest-rewriter.mxx> -#endif +#include <libbutl/manifest-rewriter.hxx> -#include <cassert> - -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> +#include <cassert> #include <cstdint> // uint64_t #include <cstddef> // size_t -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.manifest_rewriter; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.fdstream; -import butl.manifest_types; -#endif - -import butl.utility; // utf8_length() -import butl.manifest_serializer; -#else -#include <libbutl/utility.mxx> -#include <libbutl/manifest-serializer.mxx> -#endif + +#include <libbutl/utility.hxx> // utf8_length() +#include <libbutl/manifest-serializer.hxx> using namespace std; diff --git a/libbutl/manifest-rewriter.mxx b/libbutl/manifest-rewriter.hxx index 907c990..02a533a 100644 --- a/libbutl/manifest-rewriter.mxx +++ b/libbutl/manifest-rewriter.hxx @@ -1,33 +1,15 @@ -// file : libbutl/manifest-rewriter.mxx -*- C++ -*- +// file : libbutl/manifest-rewriter.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.manifest_rewriter; -#ifdef __cpp_lib_modules_ts -#endif -import butl.path; -import butl.fdstream; -import butl.manifest_types; -#else -#include <libbutl/path.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/manifest-types.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/manifest-types.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Rewrite a hand-written manifest file preserving formatting, comments, // etc., of the unaffected parts. The general workflow is as follows: diff --git a/libbutl/manifest-serializer.cxx b/libbutl/manifest-serializer.cxx index 6a26a15..05cdae5 100644 --- a/libbutl/manifest-serializer.cxx +++ b/libbutl/manifest-serializer.cxx @@ -1,41 +1,12 @@ // file : libbutl/manifest-serializer.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/manifest-serializer.mxx> -#endif - -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <vector> -#include <cstddef> -#include <stdexcept> +#include <libbutl/manifest-serializer.hxx> #include <ostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.manifest_serializer; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.manifest_types; -#endif - -import butl.utf8; -import butl.utility; -#else -#include <libbutl/utf8.mxx> -#include <libbutl/utility.mxx> -#endif + +#include <libbutl/utf8.hxx> +#include <libbutl/utility.hxx> using namespace std; diff --git a/libbutl/manifest-serializer.mxx b/libbutl/manifest-serializer.hxx index b73c255..dfe37da 100644 --- a/libbutl/manifest-serializer.mxx +++ b/libbutl/manifest-serializer.hxx @@ -1,37 +1,20 @@ -// file : libbutl/manifest-serializer.mxx -*- C++ -*- +// file : libbutl/manifest-serializer.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <iosfwd> #include <cstddef> // size_t #include <stdexcept> // runtime_error #include <functional> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.manifest_serializer; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.manifest_types; -#else -#include <libbutl/manifest-types.mxx> -#endif +#include <libbutl/manifest-types.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { class LIBBUTL_SYMEXPORT manifest_serialization: public std::runtime_error { diff --git a/libbutl/manifest-types.mxx b/libbutl/manifest-types.hxx index 93f6fc6..23318f0 100644 --- a/libbutl/manifest-types.mxx +++ b/libbutl/manifest-types.hxx @@ -1,30 +1,14 @@ -// file : libbutl/manifest-types.mxx -*- C++ -*- +// file : libbutl/manifest-types.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> -#include <cstdint> // uint64_t -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.manifest_types; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#else -#endif +#include <cstdint> // uint64_t #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { class manifest_name_value { diff --git a/libbutl/multi-index.mxx b/libbutl/multi-index.hxx index d51bdfc..a6754cd 100644 --- a/libbutl/multi-index.mxx +++ b/libbutl/multi-index.hxx @@ -1,29 +1,14 @@ -// file : libbutl/multi-index.mxx -*- C++ -*- +// file : libbutl/multi-index.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <utility> // declval() #include <functional> // hash -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.multi_index; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Google the "Emulating Boost.MultiIndex with Standard Containers" blog // post for details. @@ -57,7 +42,7 @@ LIBBUTL_MODEXPORT namespace butl }; } -LIBBUTL_MODEXPORT namespace std +namespace std { template <typename T> struct hash<butl::map_key<T>>: hash<T> diff --git a/libbutl/openssl.cxx b/libbutl/openssl.cxx index 8741b35..f9df2e7 100644 --- a/libbutl/openssl.cxx +++ b/libbutl/openssl.cxx @@ -1,35 +1,10 @@ // file : libbutl/openssl.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/openssl.mxx> -#endif +#include <libbutl/openssl.hxx> #include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> - #include <utility> // move() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.openssl; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.process; -import butl.fdstream; -import butl.small_vector; -#endif - -#endif using namespace std; diff --git a/libbutl/openssl.mxx b/libbutl/openssl.hxx index 6a0907e..58e38f8 100644 --- a/libbutl/openssl.mxx +++ b/libbutl/openssl.hxx @@ -1,41 +1,19 @@ -// file : libbutl/openssl.mxx -*- C++ -*- +// file : libbutl/openssl.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <type_traits> -#include <cstddef> // size_t -#include <utility> // move(), forward() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.openssl; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.process; //@@ MOD TODO: should we re-export? -import butl.fdstream; -import butl.small_vector; -#else -#include <libbutl/path.mxx> -#include <libbutl/process.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/small-vector.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/process.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/small-vector.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Perform a crypto operation using the openssl(1) program. Throw // process_error and io_error (both derive from system_error) in case of diff --git a/libbutl/openssl.ixx b/libbutl/openssl.ixx index c685b65..1435dcb 100644 --- a/libbutl/openssl.ixx +++ b/libbutl/openssl.ixx @@ -1,7 +1,10 @@ // file : libbutl/openssl.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +#include <cstddef> // size_t +#include <utility> // forward() + +namespace butl { template <typename I, typename O, diff --git a/libbutl/openssl.txx b/libbutl/openssl.txx index 3a2c579..f198c22 100644 --- a/libbutl/openssl.txx +++ b/libbutl/openssl.txx @@ -1,7 +1,9 @@ // file : libbutl/openssl.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +#include <utility> // forward() + +namespace butl { template <typename I> typename std::enable_if<openssl::is_other<I>::value, I>::type openssl:: diff --git a/libbutl/optional.mxx b/libbutl/optional.hxx index d32e14b..28aa95a 100644 --- a/libbutl/optional.mxx +++ b/libbutl/optional.hxx @@ -1,11 +1,7 @@ -// file : libbutl/optional.mxx -*- C++ -*- +// file : libbutl/optional.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif - -// C includes. // Note: the Clang check must come before GCC since it also defines __GNUC__. // @@ -54,7 +50,6 @@ # endif #endif -#ifndef __cpp_lib_modules_ts #ifdef LIBBUTL_STD_OPTIONAL # include <optional> #else @@ -62,21 +57,11 @@ # include <functional> // hash # include <type_traits> // is_* #endif -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.optional; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> #ifdef LIBBUTL_STD_OPTIONAL -LIBBUTL_MODEXPORT namespace butl +namespace butl { template <typename T> using optional = std::optional<T>; @@ -86,7 +71,7 @@ LIBBUTL_MODEXPORT namespace butl } #else -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Simple optional class template while waiting for std::optional. // diff --git a/libbutl/pager.cxx b/libbutl/pager.cxx index 44aa83e..e647948 100644 --- a/libbutl/pager.cxx +++ b/libbutl/pager.cxx @@ -1,9 +1,7 @@ // file : libbutl/pager.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/pager.mxx> -#endif +#include <libbutl/pager.hxx> #include <errno.h> // E* @@ -14,46 +12,20 @@ # include <libbutl/win32-utility.hxx> #endif -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> -#include <iostream> - +#include <cstddef> // size_t #include <cstring> // strchr() #include <utility> // move() + #ifndef _WIN32 # include <chrono> # include <thread> // this_thread::sleep_for() #endif -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.pager; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.process; -import butl.fdstream; -#endif -#ifndef _WIN32 -import std.threading; -#endif - -import butl.utility; // operator<<(ostream, exception), throw_generic_error() -import butl.optional; -import butl.fdstream; // fdclose() -#else -#include <libbutl/utility.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/fdstream.mxx> -#endif +#include <libbutl/utility.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/fdstream.hxx> using namespace std; diff --git a/libbutl/pager.mxx b/libbutl/pager.hxx index a1f640f..12a6670 100644 --- a/libbutl/pager.mxx +++ b/libbutl/pager.hxx @@ -1,36 +1,18 @@ -// file : libbutl/pager.mxx -*- C++ -*- +// file : libbutl/pager.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <iostream> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.pager; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.process; -import butl.fdstream; -#else -#include <libbutl/process.mxx> -#include <libbutl/fdstream.mxx> -#endif +#include <libbutl/process.hxx> +#include <libbutl/fdstream.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Try to run the output through a pager program, such as more or less (no // pun intended, less is used by default). If the default pager program is diff --git a/libbutl/path-io.mxx b/libbutl/path-io.hxx index 6b6dbcf..a60527d 100644 --- a/libbutl/path-io.mxx +++ b/libbutl/path-io.hxx @@ -1,34 +1,16 @@ -// file : libbutl/path-io.mxx -*- C++ -*- +// file : libbutl/path-io.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif - -// C includes. #include <cassert> - -#ifndef __cpp_lib_modules_ts #include <ostream> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.path_io; -#ifdef __cpp_lib_modules_ts -import std.core; //@@ MOD TMP (should not be needed). -import std.io; -#endif -import butl.path; -#else -#include <libbutl/path.mxx> -#endif +#include <libbutl/path.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // This is the default path IO implementation. It is separate to allow // custom implementations. For example, we may want to print paths as diff --git a/libbutl/path-map.mxx b/libbutl/path-map.hxx index daaf0a4..a7b3870 100644 --- a/libbutl/path-map.mxx +++ b/libbutl/path-map.hxx @@ -1,33 +1,16 @@ -// file : libbutl/path-map.mxx -*- C++ -*- +// file : libbutl/path-map.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <algorithm> // min() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.path_map; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.prefix_map; -#else -#include <libbutl/path.mxx> -#include <libbutl/prefix-map.mxx> -#endif + +#include <libbutl/path.hxx> +#include <libbutl/prefix-map.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // prefix_map for filesystem paths // diff --git a/libbutl/path-pattern.cxx b/libbutl/path-pattern.cxx index cea5aa7..ed36eb5 100644 --- a/libbutl/path-pattern.cxx +++ b/libbutl/path-pattern.cxx @@ -1,41 +1,14 @@ // file : libbutl/path-pattern.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/path-pattern.mxx> -#endif +#include <libbutl/path-pattern.hxx> #include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <cstdint> -#include <cstddef> #include <iterator> // reverse_iterator - #include <algorithm> // find() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.path_pattern; -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.optional; -#endif - -import butl.utility; // lcase()[_WIN32] -import butl.filesystem; // path_search() -#else -#include <libbutl/utility.mxx> -#include <libbutl/filesystem.mxx> -#endif +#include <libbutl/utility.hxx> // lcase()[_WIN32] +#include <libbutl/filesystem.hxx> // path_search() using namespace std; diff --git a/libbutl/path-pattern.mxx b/libbutl/path-pattern.hxx index 6d9684a..f6e01be 100644 --- a/libbutl/path-pattern.mxx +++ b/libbutl/path-pattern.hxx @@ -1,37 +1,20 @@ -// file : libbutl/path-pattern.mxx -*- C++ -*- +// file : libbutl/path-pattern.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -#include <cassert> - -#ifndef __cpp_lib_modules_ts #include <string> +#include <cassert> #include <cstdint> // uint16_t #include <cstddef> // ptrdiff_t, size_t #include <iterator> // input_iterator_tag -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.path_pattern; - -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.optional; -#else -#include <libbutl/path.mxx> -#include <libbutl/optional.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/optional.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Wildcard pattern match (aka glob). // diff --git a/libbutl/path.cxx b/libbutl/path.cxx index 3b04730..e4f373e 100644 --- a/libbutl/path.cxx +++ b/libbutl/path.cxx @@ -1,9 +1,7 @@ // file : libbutl/path.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/path.mxx> -#endif +#include <libbutl/path.hxx> #ifdef _WIN32 # include <libbutl/win32-utility.hxx> @@ -25,32 +23,11 @@ #endif #include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <cstddef> -#include <utility> - #include <atomic> #include <cstring> // strcpy() -#endif - -#ifdef __cpp_modules_ts -module butl.path; -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif - -import butl.utility; // throw_*_error() -import butl.process; // process::current_id() -#else -#include <libbutl/utility.mxx> -#include <libbutl/process.mxx> -#endif +#include <libbutl/utility.hxx> // throw_*_error() +#include <libbutl/process.hxx> // process::current_id() #include <libbutl/export.hxx> diff --git a/libbutl/path.mxx b/libbutl/path.hxx index 5a41ddc..8276130 100644 --- a/libbutl/path.mxx +++ b/libbutl/path.hxx @@ -1,13 +1,8 @@ -// file : libbutl/path.mxx -*- C++ -*- +// file : libbutl/path.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif - -#include <cassert> -#ifndef __cpp_lib_modules_ts #include <string> #include <ostream> #include <cstddef> // ptrdiff_t @@ -21,31 +16,17 @@ #ifdef _WIN32 #include <algorithm> // replace() #endif -#endif -// Other includes. +#include <libbutl/optional.hxx> +#include <libbutl/small-vector.hxx> -#ifdef __cpp_modules_ts -export module butl.path; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.optional; -import butl.small_vector; #ifdef _WIN32 -import butl.utility; -#endif -#else -#include <libbutl/optional.mxx> -#include <libbutl/small-vector.mxx> -#ifdef _WIN32 -#include <libbutl/utility.mxx> // *case*() -#endif +#include <libbutl/utility.hxx> // *case*() #endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Wish list/ideas for improvements. // @@ -1516,7 +1497,7 @@ LIBBUTL_MODEXPORT namespace butl }; } -LIBBUTL_MODEXPORT namespace std +namespace std { template <typename C, typename K> struct hash<butl::basic_path<C, K>>: hash<basic_string<C>> diff --git a/libbutl/path.ixx b/libbutl/path.ixx index 9c96cfc..2e4df2c 100644 --- a/libbutl/path.ixx +++ b/libbutl/path.ixx @@ -1,7 +1,7 @@ // file : libbutl/path.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +namespace butl { // path_abnormality // diff --git a/libbutl/path.txx b/libbutl/path.txx index 84fc038..60e0f1a 100644 --- a/libbutl/path.txx +++ b/libbutl/path.txx @@ -1,7 +1,7 @@ // file : libbutl/path.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +namespace butl { template <typename C, typename K> basic_path<C, K> basic_path<C, K>:: diff --git a/libbutl/prefix-map.mxx b/libbutl/prefix-map.hxx index 634b8da..9706ebd 100644 --- a/libbutl/prefix-map.mxx +++ b/libbutl/prefix-map.hxx @@ -1,31 +1,16 @@ -// file : libbutl/prefix-map.mxx -*- C++ -*- +// file : libbutl/prefix-map.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <map> #include <string> #include <utility> // move() #include <algorithm> // min() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.prefix_map; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // A map of hierarchical "paths", e.g., 'foo.bar' or 'foo/bar' with the // ability to retrieve a range of entries that have a specific prefix as diff --git a/libbutl/prefix-map.txx b/libbutl/prefix-map.txx index edab8e1..502119a 100644 --- a/libbutl/prefix-map.txx +++ b/libbutl/prefix-map.txx @@ -1,7 +1,7 @@ // file : libbutl/prefix-map.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +namespace butl { template <typename M> auto prefix_map_common<M>:: diff --git a/libbutl/process-details.hxx b/libbutl/process-details.hxx index cf7624d..571c750 100644 --- a/libbutl/process-details.hxx +++ b/libbutl/process-details.hxx @@ -5,15 +5,10 @@ #include <libbutl/ft/shared_mutex.hxx> -#ifdef __cpp_lib_modules_ts -import std.core; //@@ MOD TMP (dummy std.threading). -import std.threading; -#else #include <mutex> #if defined(__cpp_lib_shared_mutex) || defined(__cpp_lib_shared_timed_mutex) # include <shared_mutex> #endif -#endif namespace butl { diff --git a/libbutl/process-io.cxx b/libbutl/process-io.cxx index c29bbc0..0be3a77 100644 --- a/libbutl/process-io.cxx +++ b/libbutl/process-io.cxx @@ -1,36 +1,11 @@ // file : libbutl/process-io.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/process-io.mxx> -#endif - -// C includes. - -#ifndef __cpp_lib_modules_ts -#include <ostream> +#include <libbutl/process-io.hxx> #include <cstring> // strchr() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.process_io; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.process; -#endif -import butl.path-io; -#else -#include <libbutl/path-io.mxx> -#endif +#include <libbutl/path-io.hxx> using namespace std; diff --git a/libbutl/process-io.mxx b/libbutl/process-io.hxx index d07a212..29d6d8b 100644 --- a/libbutl/process-io.mxx +++ b/libbutl/process-io.hxx @@ -1,32 +1,15 @@ -// file : libbutl/process-io.mxx -*- C++ -*- +// file : libbutl/process-io.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <ostream> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.process_io; -#ifdef __cpp_lib_modules_ts -import std.core; //@@ MOD TMP (should not be needed). -import std.io; -#endif -import butl.process; -#else -#include <libbutl/process.mxx> -#endif +#include <libbutl/process.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { inline std::ostream& operator<< (std::ostream& o, const process_path& p) diff --git a/libbutl/process-run.cxx b/libbutl/process-run.cxx index c26c20d..a5014f6 100644 --- a/libbutl/process-run.cxx +++ b/libbutl/process-run.cxx @@ -1,35 +1,12 @@ // file : libbutl/process-run.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/process.mxx> -#endif +#include <libbutl/process.hxx> -// C includes. - -#ifndef __cpp_lib_modules_ts #include <cstdlib> // exit() #include <iostream> // cerr -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.process; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -#endif -import butl.utility; // operator<<(ostream,exception) -#else -#include <libbutl/utility.mxx> -#endif +#include <libbutl/utility.hxx> // operator<<(ostream,exception) using namespace std; diff --git a/libbutl/process-run.txx b/libbutl/process-run.txx index aa1e381..8e6ca57 100644 --- a/libbutl/process-run.txx +++ b/libbutl/process-run.txx @@ -1,7 +1,9 @@ // file : libbutl/process-run.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +#include <utility> // forward(), index_sequence + +namespace butl { template <typename V> void process_env:: diff --git a/libbutl/process.cxx b/libbutl/process.cxx index f6433fb..92a70c4 100644 --- a/libbutl/process.cxx +++ b/libbutl/process.cxx @@ -1,9 +1,7 @@ // file : libbutl/process.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/process.mxx> -#endif +#include <libbutl/process.hxx> #include <errno.h> @@ -87,29 +85,19 @@ # endif // _MSC_VER #endif -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <vector> -#include <chrono> -#include <cstdint> -#include <cstddef> -#include <system_error> - #include <ios> // ios_base::failure #include <cstring> // strlen(), strchr(), strpbrk(), strncmp() #include <utility> // move() #include <ostream> +#include <cassert> #ifndef _WIN32 -#include <thread> // this_thread::sleep_for() +# include <thread> // this_thread::sleep_for() #else -#include <map> -#include <ratio> // milli -#include <cstdlib> // __argv[] -#include <algorithm> // find() -#endif +# include <map> +# include <ratio> // milli +# include <cstdlib> // __argv[] +# include <algorithm> // find() #endif #include <libbutl/process-details.hxx> @@ -119,32 +107,8 @@ namespace butl shared_mutex process_spawn_mutex; // Out of module purview. } -#ifdef __cpp_modules_ts -module butl.process; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -import std.threading; // Clang wants it in purview (see process-details.hxx). -#endif -import butl.path; -import butl.fdstream; -import butl.vector_view; -import butl.small_vector; -#endif - -#ifndef _WIN32 -import std.threading; -#endif - -import butl.utility; // icasecmp() -import butl.fdstream; // fdopen_null() -#else -#include <libbutl/utility.mxx> -#include <libbutl/fdstream.mxx> -#endif +#include <libbutl/utility.hxx> // icasecmp() +#include <libbutl/fdstream.hxx> // fdopen_null() using namespace std; @@ -1898,7 +1862,7 @@ namespace butl return PeekNamedPipe (h, &c, 1, &n, nullptr, nullptr) && n == 1; }; - // Hidden by butl::duration that is introduced via fdstream.mxx. + // Hidden by butl::duration that is introduced via fdstream.hxx. // using milli_duration = chrono::duration<DWORD, milli>; diff --git a/libbutl/process.mxx b/libbutl/process.hxx index 0677525..47cc507 100644 --- a/libbutl/process.mxx +++ b/libbutl/process.hxx @@ -1,17 +1,12 @@ -// file : libbutl/process.mxx -*- C++ -*- +// file : libbutl/process.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif #ifndef _WIN32 # include <sys/types.h> // pid_t #endif -#include <cassert> - -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <chrono> @@ -20,33 +15,15 @@ #include <cstdint> // uint32_t #include <system_error> -#include <utility> // move(), forward(), index_sequence -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.process; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.optional; -import butl.fdstream; // auto_fd, fdpipe -import butl.vector_view; -import butl.small_vector; -#else -#include <libbutl/path.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/vector-view.mxx> -#include <libbutl/small-vector.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/fdstream.hxx> // auto_fd, fdpipe +#include <libbutl/vector-view.hxx> +#include <libbutl/small-vector.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { struct process_error: std::system_error { diff --git a/libbutl/process.ixx b/libbutl/process.ixx index 7676ce3..256454b 100644 --- a/libbutl/process.ixx +++ b/libbutl/process.ixx @@ -1,6 +1,9 @@ // file : libbutl/process.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file +#include <cassert> +#include <utility> // move() + namespace butl { // process_path diff --git a/libbutl/project-name.cxx b/libbutl/project-name.cxx index 7a14b49..a7ed8a8 100644 --- a/libbutl/project-name.cxx +++ b/libbutl/project-name.cxx @@ -1,38 +1,16 @@ // file : libbutl/project-name.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/project-name.mxx> -#endif +#include <libbutl/project-name.hxx> -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <utility> // move() #include <algorithm> // find() #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.project_name; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.utility; -#endif - -import butl.path; // path::traits -import butl.utility; // alpha(), alnum() -#else -#include <libbutl/path.mxx> -#include <libbutl/utility.mxx> -#endif + +#include <libbutl/path.hxx> // path::traits +#include <libbutl/utility.hxx> // alpha(), alnum() using namespace std; diff --git a/libbutl/project-name.mxx b/libbutl/project-name.hxx index 1117e28..6e1f925 100644 --- a/libbutl/project-name.mxx +++ b/libbutl/project-name.hxx @@ -1,34 +1,17 @@ -// file : libbutl/project-name.mxx -*- C++ -*- +// file : libbutl/project-name.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <utility> // move() #include <ostream> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.project_name; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.utility; // icasecmp(), sanitize_identifier() -#else -#include <libbutl/utility.mxx> -#endif +#include <libbutl/utility.hxx> // icasecmp(), sanitize_identifier() #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Build system project name. // diff --git a/libbutl/prompt.cxx b/libbutl/prompt.cxx index 1c0820a..2e42dd5 100644 --- a/libbutl/prompt.cxx +++ b/libbutl/prompt.cxx @@ -1,33 +1,11 @@ // file : libbutl/prompt.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/prompt.mxx> -#endif - -#ifndef __cpp_lib_modules_ts -#include <string> +#include <libbutl/prompt.hxx> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.prompt; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif -import butl.diagnostics; -#else -#include <libbutl/diagnostics.mxx> // diag_stream -#endif +#include <libbutl/diagnostics.hxx> // diag_stream using namespace std; diff --git a/libbutl/prompt.mxx b/libbutl/prompt.hxx index 2489b2f..90b8dbf 100644 --- a/libbutl/prompt.mxx +++ b/libbutl/prompt.hxx @@ -1,28 +1,13 @@ -// file : libbutl/prompt.mxx -*- C++ -*- +// file : libbutl/prompt.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.prompt; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // The Y/N prompt. The def argument, if specified, should be either 'y' or // 'n'. It is used as the default answer, in case the user just hits enter. diff --git a/libbutl/regex.cxx b/libbutl/regex.cxx index 83e296c..34536f2 100644 --- a/libbutl/regex.cxx +++ b/libbutl/regex.cxx @@ -1,42 +1,17 @@ // file : libbutl/regex.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/regex.mxx> -#endif - -// C includes. - -#ifndef __cpp_lib_modules_ts -#include <regex> -#include <string> +#include <libbutl/regex.hxx> #include <ostream> #include <sstream> #include <stdexcept> // runtime_error + #if defined(_MSC_VER) && _MSC_VER < 2000 # include <cstring> // strstr() #endif -#endif - -// Other includes. -#ifdef __cpp_modules_ts -module butl.regex; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -import std.regex; -#endif -#endif - -import butl.utility; // operator<<(ostream, exception) -#else -#include <libbutl/utility.mxx> -#endif +#include <libbutl/utility.hxx> // operator<<(ostream, exception) namespace std { diff --git a/libbutl/regex.mxx b/libbutl/regex.hxx index b1ba1b9..9b31075 100644 --- a/libbutl/regex.mxx +++ b/libbutl/regex.hxx @@ -1,23 +1,13 @@ -// file : libbutl/regex.mxx -*- C++ -*- +// file : libbutl/regex.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif - -// C includes. -#ifndef __cpp_lib_modules_ts #include <regex> #include <iosfwd> #include <string> #include <utility> // pair - -#include <locale> -#include <cstddef> // size_t -#include <utility> // move(), make_pair() -#include <stdexcept> // invalid_argument -#endif +#include <cstddef> // size_t #if defined(__clang__) # if __has_include(<__config>) @@ -25,20 +15,9 @@ # endif #endif -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.regex; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -import std.regex; // @@ MOD TODO should probably be re-exported. -#endif -#endif - #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // The regex semantics for the following functions is like that of // std::regex_replace() extended the standard ECMA-262 substitution escape @@ -141,7 +120,7 @@ LIBBUTL_MODEXPORT namespace butl regex_replace_parse (const C*, size_t, size_t& end); } -LIBBUTL_MODEXPORT namespace std +namespace std { // Print regex error description but only if it is meaningful (this is also // why we have to print leading colon). diff --git a/libbutl/regex.ixx b/libbutl/regex.ixx index f55cb07..08962cf 100644 --- a/libbutl/regex.ixx +++ b/libbutl/regex.ixx @@ -1,7 +1,9 @@ // file : libbutl/regex.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +#include <utility> // move(), make_pair() + +namespace butl { template <typename C> inline std::pair<std::basic_string<C>, bool> diff --git a/libbutl/regex.txx b/libbutl/regex.txx index 8fe5308..214d949 100644 --- a/libbutl/regex.txx +++ b/libbutl/regex.txx @@ -1,7 +1,10 @@ // file : libbutl/regex.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +#include <locale> +#include <stdexcept> // invalid_argument + +namespace butl { template <typename C> std::basic_string<C> diff --git a/libbutl/semantic-version.cxx b/libbutl/semantic-version.cxx index 445890d..3be382f 100644 --- a/libbutl/semantic-version.cxx +++ b/libbutl/semantic-version.cxx @@ -1,38 +1,11 @@ // file : libbutl/semantic-version.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/semantic-version.mxx> -#endif - -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <cstddef> -#include <cstdint> -#include <ostream> +#include <libbutl/semantic-version.hxx> #include <cstring> // strchr() #include <utility> // move() #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.semantic_version; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.optional; -#endif -#else -#endif using namespace std; diff --git a/libbutl/semantic-version.mxx b/libbutl/semantic-version.hxx index 566d192..16f3d56 100644 --- a/libbutl/semantic-version.mxx +++ b/libbutl/semantic-version.hxx @@ -1,32 +1,15 @@ -// file : libbutl/semantic-version.mxx -*- C++ -*- +// file : libbutl/semantic-version.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif - -// C includes. -#ifndef __cpp_lib_modules_ts #include <string> #include <cstddef> // size_t #include <cstdint> // uint*_t #include <utility> // move() #include <ostream> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.semantic_version; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.optional; -#else -#include <libbutl/optional.mxx> -#endif +#include <libbutl/optional.hxx> #include <libbutl/export.hxx> @@ -40,7 +23,7 @@ import butl.optional; # undef minor #endif -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Semantic or semantic-like version. // diff --git a/libbutl/sendmail.cxx b/libbutl/sendmail.cxx index 1038cf4..5fec1a6 100644 --- a/libbutl/sendmail.cxx +++ b/libbutl/sendmail.cxx @@ -1,32 +1,7 @@ // file : libbutl/sendmail.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/sendmail.mxx> -#endif - -// C includes. - -#ifndef __cpp_lib_modules_ts -#include <string> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.sendmail; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.process; -import butl.fdstream; -import butl.small_vector; -#endif - -#endif +#include <libbutl/sendmail.hxx> using namespace std; diff --git a/libbutl/sendmail.mxx b/libbutl/sendmail.hxx index 0d5b239..97a4d82 100644 --- a/libbutl/sendmail.mxx +++ b/libbutl/sendmail.hxx @@ -1,38 +1,17 @@ -// file : libbutl/sendmail.mxx -*- C++ -*- +// file : libbutl/sendmail.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> -#include <cstddef> // size_t -#include <utility> // move(), forward() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.sendmail; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.process; -import butl.fdstream; -import butl.small_vector; -#else -#include <libbutl/process.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/small-vector.mxx> -#endif +#include <libbutl/process.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/small-vector.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Send email using the sendmail(1) program. // diff --git a/libbutl/sendmail.ixx b/libbutl/sendmail.ixx index 105c1af..35b5c47 100644 --- a/libbutl/sendmail.ixx +++ b/libbutl/sendmail.ixx @@ -1,7 +1,10 @@ // file : libbutl/sendmail.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +#include <cstddef> // size_t +#include <utility> // move(), forward() + +namespace butl { template <typename E, typename... O> inline sendmail:: diff --git a/libbutl/sha1.cxx b/libbutl/sha1.cxx index f4a6bad..e546922 100644 --- a/libbutl/sha1.cxx +++ b/libbutl/sha1.cxx @@ -1,9 +1,7 @@ // file : libbutl/sha1.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/sha1.mxx> -#endif +#include <libbutl/sha1.hxx> // C interface for sha1c. // @@ -42,29 +40,9 @@ extern "C" #define SHA1_Final(x, y) sha1_result((y), (char(&)[20])(x)) #include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <cstddef> -#include <cstdint> - #include <istream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.sha1; -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif -#else #include <libbutl/bufstreambuf.hxx> -#endif using namespace std; diff --git a/libbutl/sha1.mxx b/libbutl/sha1.hxx index f6fafc0..62710f4 100644 --- a/libbutl/sha1.mxx +++ b/libbutl/sha1.hxx @@ -1,32 +1,17 @@ -// file : libbutl/sha1.mxx -*- C++ -*- +// file : libbutl/sha1.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <iosfwd> // istream #include <string> #include <cstddef> // size_t #include <cstdint> #include <cstring> // strlen() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.sha1; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // SHA1 checksum calculator. // diff --git a/libbutl/sha256.cxx b/libbutl/sha256.cxx index 8a34402..95987ec 100644 --- a/libbutl/sha256.cxx +++ b/libbutl/sha256.cxx @@ -1,9 +1,7 @@ // file : libbutl/sha256.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/sha256.mxx> -#endif +#include <libbutl/sha256.hxx> // C interface for sha256c. // @@ -26,39 +24,13 @@ extern "C" #include "sha256c.c" } -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <cstddef> -#include <cstdint> - #include <cctype> // isxdigit() +#include <cassert> #include <istream> #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.sha256; - -// Only imports additional to interface. -#ifdef __cpp_lib_modules_ts -import std.io; -#endif - -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif -import butl.utility; // *case() -#else -#include <libbutl/utility.mxx> +#include <libbutl/utility.hxx> // *case() #include <libbutl/bufstreambuf.hxx> -#endif using namespace std; diff --git a/libbutl/sha256.mxx b/libbutl/sha256.hxx index d5128b1..566068f 100644 --- a/libbutl/sha256.mxx +++ b/libbutl/sha256.hxx @@ -1,33 +1,18 @@ -// file : libbutl/sha256.mxx -*- C++ -*- +// file : libbutl/sha256.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <iosfwd> // istream #include <cstddef> // size_t #include <cstdint> #include <cstring> // strlen(), memcpy() #include <type_traits> // enable_if, is_integral -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.sha256; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // SHA256 checksum calculator. // diff --git a/libbutl/small-allocator.mxx b/libbutl/small-allocator.hxx index 5ef74be..429ba41 100644 --- a/libbutl/small-allocator.mxx +++ b/libbutl/small-allocator.hxx @@ -1,30 +1,16 @@ -// file : libbutl/small-allocator.mxx -*- C++ -*- +// file : libbutl/small-allocator.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif #include <cassert> - -#ifndef __cpp_lib_modules_ts #include <cstddef> // size_t #include <utility> // move() #include <type_traits> // true_type, is_same -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.small_allocator; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Implementation of the allocator (and its buffer) for small containers. // diff --git a/libbutl/small-forward-list.mxx b/libbutl/small-forward-list.hxx index 6aa4986..1278dc2 100644 --- a/libbutl/small-forward-list.mxx +++ b/libbutl/small-forward-list.hxx @@ -1,31 +1,17 @@ -// file : libbutl/small-forward-list.mxx -*- C++ -*- +// file : libbutl/small-forward-list.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -#ifndef __cpp_lib_modules_ts #include <cstddef> // size_t #include <utility> // move() #include <forward_list> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.small_forward_list; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.small_allocator; -#else -#include <libbutl/small-allocator.mxx> -#endif +#include <libbutl/small-allocator.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Issues and limitations. // diff --git a/libbutl/small-list.mxx b/libbutl/small-list.hxx index ff62192..aaeef22 100644 --- a/libbutl/small-list.mxx +++ b/libbutl/small-list.hxx @@ -1,31 +1,17 @@ -// file : libbutl/small-list.mxx -*- C++ -*- +// file : libbutl/small-list.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -#ifndef __cpp_lib_modules_ts #include <list> -#include <cstddef> // size_t -#include <utility> // move() -#endif - -// Other includes. +#include <cstddef> // size_t +#include <utility> // move() -#ifdef __cpp_modules_ts -export module butl.small_list; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.small_allocator; -#else -#include <libbutl/small-allocator.mxx> -#endif +#include <libbutl/small-allocator.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Issues and limitations. // diff --git a/libbutl/small-vector-odb.hxx b/libbutl/small-vector-odb.hxx index af9d96c..289ca38 100644 --- a/libbutl/small-vector-odb.hxx +++ b/libbutl/small-vector-odb.hxx @@ -5,7 +5,7 @@ #include <odb/pre.hxx> -#include <libbutl/small-vector.mxx> +#include <libbutl/small-vector.hxx> #include <odb/container-traits.hxx> diff --git a/libbutl/small-vector.mxx b/libbutl/small-vector.hxx index 7f9bb1e..f0594b1 100644 --- a/libbutl/small-vector.mxx +++ b/libbutl/small-vector.hxx @@ -1,31 +1,17 @@ -// file : libbutl/small-vector.mxx -*- C++ -*- +// file : libbutl/small-vector.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -#ifndef __cpp_lib_modules_ts #include <vector> -#include <cstddef> // size_t -#include <utility> // move() -#endif - -// Other includes. +#include <cstddef> // size_t +#include <utility> // move() -#ifdef __cpp_modules_ts -export module butl.small_vector; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.small_allocator; -#else -#include <libbutl/small-allocator.mxx> -#endif +#include <libbutl/small-allocator.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Issues and limitations. // diff --git a/libbutl/standard-version.cxx b/libbutl/standard-version.cxx index 863cb29..36f4830 100644 --- a/libbutl/standard-version.cxx +++ b/libbutl/standard-version.cxx @@ -1,41 +1,14 @@ // file : libbutl/standard-version.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/standard-version.mxx> -#endif +#include <libbutl/standard-version.hxx> #include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <cstdint> -#include <cstddef> -#include <ostream> - #include <cstdlib> // strtoull() #include <utility> // move() #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.standard_version; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.optional; -#endif - -import butl.utility; -#else -#include <libbutl/utility.mxx> // alnum() -#endif + +#include <libbutl/utility.hxx> // alnum() using namespace std; diff --git a/libbutl/standard-version.mxx b/libbutl/standard-version.hxx index b86e3a9..5810e13 100644 --- a/libbutl/standard-version.mxx +++ b/libbutl/standard-version.hxx @@ -1,31 +1,14 @@ -// file : libbutl/standard-version.mxx -*- C++ -*- +// file : libbutl/standard-version.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif - -// C includes. -#ifndef __cpp_lib_modules_ts #include <string> #include <cstdint> // uint*_t #include <cstddef> // size_t #include <ostream> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.standard_version; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.optional; -#else -#include <libbutl/optional.mxx> -#endif +#include <libbutl/optional.hxx> #include <libbutl/export.hxx> @@ -39,7 +22,7 @@ import butl.optional; # undef minor #endif -LIBBUTL_MODEXPORT namespace butl +namespace butl { // The build2 "standard version" (normal, earliest, and stub): // diff --git a/libbutl/string-parser.cxx b/libbutl/string-parser.cxx index 5d5ec47..aea1338 100644 --- a/libbutl/string-parser.cxx +++ b/libbutl/string-parser.cxx @@ -1,33 +1,7 @@ // file : libbutl/string-parser.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/string-parser.mxx> -#endif - -// C includes. - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <vector> -#include <cstddef> -#include <utility> // move() -#include <stdexcept> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.string_parser; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif - -#endif +#include <libbutl/string-parser.hxx> using namespace std; diff --git a/libbutl/string-parser.mxx b/libbutl/string-parser.hxx index 4ff1590..9fc20c0 100644 --- a/libbutl/string-parser.mxx +++ b/libbutl/string-parser.hxx @@ -1,32 +1,17 @@ -// file : libbutl/string-parser.mxx -*- C++ -*- +// file : libbutl/string-parser.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <cstddef> // size_t #include <utility> // pair #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.string_parser; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { namespace string_parser { diff --git a/libbutl/string-table.mxx b/libbutl/string-table.hxx index 78c6cd6..010fb01 100644 --- a/libbutl/string-table.mxx +++ b/libbutl/string-table.hxx @@ -1,36 +1,18 @@ -// file : libbutl/string-table.mxx -*- C++ -*- +// file : libbutl/string-table.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -#include <cassert> - -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> +#include <cassert> #include <unordered_map> -#include <limits> // numeric_limits -#include <cstddef> // size_t -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.string_table; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.multi_index; -#else -#include <libbutl/multi-index.mxx> -#endif +#include <libbutl/multi-index.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // A pool of strings and, optionally, other accompanying data in which each // entry is assigned an individual index (or id) of type I (e.g., uint8_t, diff --git a/libbutl/string-table.txx b/libbutl/string-table.txx index 4db0a6b..8416b48 100644 --- a/libbutl/string-table.txx +++ b/libbutl/string-table.txx @@ -1,6 +1,9 @@ // file : libbutl/string-table.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file +#include <limits> // numeric_limits +#include <cstddef> // size_t + namespace butl { template <typename I, typename D> diff --git a/libbutl/tab-parser.cxx b/libbutl/tab-parser.cxx index cca2792..d7e5a14 100644 --- a/libbutl/tab-parser.cxx +++ b/libbutl/tab-parser.cxx @@ -1,39 +1,12 @@ // file : libbutl/tab-parser.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/tab-parser.mxx> -#endif - -#include <cassert> - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <vector> -#include <cstdint> -#include <stdexcept> +#include <libbutl/tab-parser.hxx> #include <istream> #include <sstream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.tab_parser; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif -import butl.string_parser; -#else -#include <libbutl/string-parser.mxx> -#endif +#include <libbutl/string-parser.hxx> using namespace std; diff --git a/libbutl/tab-parser.mxx b/libbutl/tab-parser.hxx index a7f7e01..2dc612b 100644 --- a/libbutl/tab-parser.mxx +++ b/libbutl/tab-parser.hxx @@ -1,33 +1,17 @@ -// file : libbutl/tab-parser.mxx -*- C++ -*- +// file : libbutl/tab-parser.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <iosfwd> #include <string> #include <vector> #include <cstdint> // uint64_t #include <stdexcept> // runtime_error -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.tab_parser; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { class LIBBUTL_SYMEXPORT tab_parsing: public std::runtime_error { diff --git a/libbutl/target-triplet.cxx b/libbutl/target-triplet.cxx index 611b758..209f75e 100644 --- a/libbutl/target-triplet.cxx +++ b/libbutl/target-triplet.cxx @@ -1,33 +1,9 @@ // file : libbutl/target-triplet.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/target-triplet.mxx> -#endif - -// C includes. - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <ostream> +#include <libbutl/target-triplet.hxx> #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.target_triplet; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif - -#endif using namespace std; diff --git a/libbutl/target-triplet.mxx b/libbutl/target-triplet.hxx index 3861809..45db457 100644 --- a/libbutl/target-triplet.mxx +++ b/libbutl/target-triplet.hxx @@ -1,30 +1,14 @@ -// file : libbutl/target-triplet.mxx -*- C++ -*- +// file : libbutl/target-triplet.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <ostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.target_triplet; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // This is the ubiquitous 'target triplet' that loosely has the CPU-VENDOR-OS // form which, these days, quite often takes the CPU-VENDOR-OS-ABI form. Plus @@ -164,7 +148,7 @@ LIBBUTL_MODEXPORT namespace butl explicit target_triplet (const std::string&); - target_triplet () {} // = default; @@ MOD VC + target_triplet () = default; }; inline bool diff --git a/libbutl/timestamp.cxx b/libbutl/timestamp.cxx index 589c29c..260fbef 100644 --- a/libbutl/timestamp.cxx +++ b/libbutl/timestamp.cxx @@ -1,9 +1,7 @@ // file : libbutl/timestamp.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/timestamp.mxx> -#endif +#include <libbutl/timestamp.hxx> #include <time.h> // localtime_{r,s}(), gmtime_{r,s}(), strptime(), timegm() #include <errno.h> // EINVAL @@ -25,17 +23,13 @@ #ifdef __GLIBCXX__ extern "C" { -#include "strptime.c" +# include "strptime.c" } #else -#include <locale.h> // LC_ALL +# include <locale.h> // LC_ALL #endif #endif -#ifndef __cpp_lib_modules_ts -#include <string> -#include <chrono> - #include <ctime> // tm, time_t, mktime(), strftime()[libstdc++] #include <cstdlib> // strtoull() #include <sstream> // ostringstream, stringstream[VC] @@ -49,31 +43,14 @@ extern "C" // #ifdef _WIN32 #ifndef __GLIBCXX__ -#include <ios> -#include <locale> -#include <clocale> -#include <iomanip> -#endif -#endif -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -module butl.timestamp; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; +# include <ios> +# include <locale> +# include <clocale> +# include <iomanip> #endif #endif -import butl.utility; -#else -#include <libbutl/utility.mxx> // throw_generic_error() -#endif +#include <libbutl/utility.hxx> // throw_generic_error() using namespace std; diff --git a/libbutl/timestamp.mxx b/libbutl/timestamp.hxx index 141e13d..2714a0d 100644 --- a/libbutl/timestamp.mxx +++ b/libbutl/timestamp.hxx @@ -1,34 +1,15 @@ -// file : libbutl/timestamp.mxx -*- C++ -*- +// file : libbutl/timestamp.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <iosfwd> #include <string> #include <chrono> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.timestamp; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif - -//@@ MOD TODO: should't we re-export chrono (for somparison operator, etc)? -// or ADL should kick in? #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // On all three main platforms that we target (GNU/Linux, Windows (both // VC++ and GCC/MinGW64), and MacOS X) with recent C++ runtimes, @@ -61,21 +42,12 @@ LIBBUTL_MODEXPORT namespace butl // unreal and all of them are less than any non-special value (strictly // speaking unreal is no greater (older) than any real value). // -#if defined(__cpp_modules_ts) && defined(__clang__) //@@ MOD Clang duplicate sym. - inline const timestamp::rep timestamp_unknown_rep = -1; - inline const timestamp timestamp_unknown = timestamp (duration (-1)); - inline const timestamp::rep timestamp_nonexistent_rep = 0; - inline const timestamp timestamp_nonexistent = timestamp (duration (0)); - inline const timestamp::rep timestamp_unreal_rep = 1; - inline const timestamp timestamp_unreal = timestamp (duration (1)); -#else const timestamp::rep timestamp_unknown_rep = -1; const timestamp timestamp_unknown = timestamp (duration (-1)); const timestamp::rep timestamp_nonexistent_rep = 0; const timestamp timestamp_nonexistent = timestamp (duration (0)); const timestamp::rep timestamp_unreal_rep = 1; const timestamp timestamp_unreal = timestamp (duration (1)); -#endif // Print human-readable representation of the timestamp. // diff --git a/libbutl/unicode.cxx b/libbutl/unicode.cxx index 4219846..294bb3f 100644 --- a/libbutl/unicode.cxx +++ b/libbutl/unicode.cxx @@ -1,32 +1,11 @@ // file : libbutl/unicode.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/unicode.mxx> -#endif - -#ifndef __cpp_lib_modules_ts -#include <string> -#include <ostream> -#include <cstdint> +#include <libbutl/unicode.hxx> #include <cstddef> // size_t #include <utility> // pair #include <algorithm> // lower_bound() -#endif - -#ifdef __cpp_modules_ts -module butl.unicode; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif - -#endif using namespace std; diff --git a/libbutl/unicode.mxx b/libbutl/unicode.hxx index b846476..8d99d0e 100644 --- a/libbutl/unicode.mxx +++ b/libbutl/unicode.hxx @@ -1,31 +1,15 @@ -// file : libbutl/unicode.mxx -*- C++ -*- +// file : libbutl/unicode.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <ostream> #include <cstdint> // uint16_t -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.unicode; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Note that the Unicode Standard requires the surrogates ([D800 DFFF]) to // only be used in the context of the UTF-16 character encoding form. Thus, diff --git a/libbutl/url.mxx b/libbutl/url.hxx index 713bc3e..5721cfd 100644 --- a/libbutl/url.mxx +++ b/libbutl/url.hxx @@ -1,50 +1,23 @@ -// file : libbutl/url.mxx -*- C++ -*- +// file : libbutl/url.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#include <cassert> - -#ifndef __cpp_lib_modules_ts #include <string> +#include <cassert> +#include <cstddef> // size_t #include <cstdint> // uint*_t #include <utility> // move() #include <ostream> #include <iterator> // back_inserter -#include <cstddef> // size_t -#include <stdexcept> // invalid_argument -#include <algorithm> // find(), find_if() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.url; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.utility; -import butl.optional; - -import butl.small_vector; -#else -#include <libbutl/path.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/optional.mxx> - -#include <libbutl/small-vector.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/utility.hxx> +#include <libbutl/optional.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // RFC3986 Uniform Resource Locator (URL). // diff --git a/libbutl/url.ixx b/libbutl/url.ixx index b823ee7..19d54c7 100644 --- a/libbutl/url.ixx +++ b/libbutl/url.ixx @@ -1,7 +1,7 @@ // file : libbutl/url.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +namespace butl { // url_traits // diff --git a/libbutl/url.txx b/libbutl/url.txx index 0951e80..b2caa37 100644 --- a/libbutl/url.txx +++ b/libbutl/url.txx @@ -1,7 +1,12 @@ // file : libbutl/url.txx -*- C++ -*- // license : MIT; see accompanying LICENSE file -LIBBUTL_MODEXPORT namespace butl //@@ MOD Clang needs this for some reason. +#include <stdexcept> // invalid_argument +#include <algorithm> // find(), find_if() + +#include <libbutl/small-vector.hxx> + +namespace butl { // Convenience functions. // diff --git a/libbutl/utf8.mxx b/libbutl/utf8.hxx index 15e8ded..697f77a 100644 --- a/libbutl/utf8.mxx +++ b/libbutl/utf8.hxx @@ -1,33 +1,17 @@ -// file : libbutl/utf8.mxx -*- C++ -*- +// file : libbutl/utf8.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <string> #include <cstdint> // uint8_t #include <utility> // pair -#endif - -// Other includes. -#ifdef __cpp_modules_ts -export module butl.utf8; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.unicode; -#else -#include <libbutl/unicode.mxx> -#endif +#include <libbutl/unicode.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Here and below we will refer to bytes that encode a singe Unicode // codepoint as "UTF-8 byte sequence" ("UTF-8 sequence" or "byte sequence" diff --git a/libbutl/utility.cxx b/libbutl/utility.cxx index a891fc2..78abbd8 100644 --- a/libbutl/utility.cxx +++ b/libbutl/utility.cxx @@ -1,9 +1,7 @@ // file : libbutl/utility.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts -#include <libbutl/utility.mxx> -#endif +#include <libbutl/utility.hxx> #ifdef _WIN32 #include <libbutl/win32-utility.hxx> @@ -11,35 +9,15 @@ #include <stdlib.h> // getenv(), setenv(), unsetenv(), _putenv() -#ifndef __cpp_lib_modules_ts -#include <string> -#include <cstddef> -#include <utility> - #include <cstring> // strncmp(), strlen() #include <ostream> #include <type_traits> // enable_if, is_base_of #include <system_error> -#endif #include <libbutl/ft/lang.hxx> #include <libbutl/ft/exception.hxx> -#ifdef __cpp_modules_ts -module butl.utility; - -// Only imports additional to interface. -#ifdef __clang__ -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -#endif - -import butl.utf8; -#else -#include <libbutl/utf8.mxx> -#endif +#include <libbutl/utf8.hxx> namespace butl { diff --git a/libbutl/utility.mxx b/libbutl/utility.hxx index bd24ffd..49b61b3 100644 --- a/libbutl/utility.mxx +++ b/libbutl/utility.hxx @@ -1,9 +1,7 @@ -// file : libbutl/utility.mxx -*- C++ -*- +// file : libbutl/utility.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif #ifndef _WIN32 # include <strings.h> // strcasecmp(), strncasecmp() @@ -11,7 +9,6 @@ # include <string.h> // _stricmp(), _strnicmp() #endif -#ifndef __cpp_lib_modules_ts #include <string> #include <iosfwd> // ostream #include <istream> @@ -20,29 +17,17 @@ #include <cstring> // strcmp(), strlen() #include <exception> // exception, uncaught_exception[s]() //#include <functional> // hash -#endif #include <libbutl/ft/lang.hxx> // thread_local #include <libbutl/ft/exception.hxx> // uncaught_exceptions -#ifdef __cpp_modules_ts -export module butl.utility; -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.utf8; -import butl.unicode; -import butl.optional; -#else -#include <libbutl/utf8.mxx> -#include <libbutl/unicode.mxx> -#include <libbutl/optional.mxx> -#endif +#include <libbutl/utf8.hxx> +#include <libbutl/unicode.hxx> +#include <libbutl/optional.hxx> #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // Throw std::system_error with generic_category or system_category, // respectively. @@ -540,7 +525,7 @@ LIBBUTL_MODEXPORT namespace butl #endif } -LIBBUTL_MODEXPORT namespace std +namespace std { // Sanitize the exception description before printing. This includes: // diff --git a/libbutl/utility.ixx b/libbutl/utility.ixx index 6501bf7..4180ad7 100644 --- a/libbutl/utility.ixx +++ b/libbutl/utility.ixx @@ -1,12 +1,10 @@ // file : libbutl/utility.ixx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <cctype> // toupper(), tolower(), is*() #include <cwctype> // isw*() #include <algorithm> // for_each() #include <stdexcept> // invalid_argument -#endif namespace butl { diff --git a/libbutl/uuid-linux.cxx b/libbutl/uuid-linux.cxx index 7689088..82af2e9 100644 --- a/libbutl/uuid-linux.cxx +++ b/libbutl/uuid-linux.cxx @@ -13,7 +13,7 @@ #include <utility> // move() #include <system_error> -#include <libbutl/utility.mxx> // function_cast() +#include <libbutl/utility.hxx> // function_cast() using namespace std; diff --git a/libbutl/vector-view.mxx b/libbutl/vector-view.hxx index 7924371..16ab08e 100644 --- a/libbutl/vector-view.mxx +++ b/libbutl/vector-view.hxx @@ -1,32 +1,17 @@ -// file : libbutl/vector-view.mxx -*- C++ -*- +// file : libbutl/vector-view.hxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_modules_ts #pragma once -#endif -// C includes. - -#ifndef __cpp_lib_modules_ts #include <vector> #include <cstddef> // size_t, ptrdiff_t #include <utility> // swap() #include <iterator> // reverse_iterator #include <stdexcept> // out_of_range -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -export module butl.vector_view; -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -#endif #include <libbutl/export.hxx> -LIBBUTL_MODEXPORT namespace butl +namespace butl { // In our version a const view allows the modification of the elements // unless T is made const (the same semantics as in smart pointers). diff --git a/libbutl/win32-utility.cxx b/libbutl/win32-utility.cxx index 3b44d60..c69842b 100644 --- a/libbutl/win32-utility.cxx +++ b/libbutl/win32-utility.cxx @@ -8,16 +8,9 @@ // #ifdef _WIN32 -#ifndef __cpp_lib_modules_ts -#include <string> #include <memory> // unique_ptr -#include <libbutl/utility.mxx> // throw_system_error() -#else -import std.core; - -import butl.utility; -#endif +#include <libbutl/utility.hxx> // throw_system_error() using namespace std; diff --git a/libbutl/win32-utility.hxx b/libbutl/win32-utility.hxx index b71eb1a..9bed647 100644 --- a/libbutl/win32-utility.hxx +++ b/libbutl/win32-utility.hxx @@ -31,11 +31,7 @@ # endif #endif -#ifndef __cpp_lib_modules_ts #include <string> -#else -import std.core; -#endif #include <libbutl/export.hxx> diff --git a/tests/b-info/driver.cxx b/tests/b-info/driver.cxx index 963d4e3..6832aaa 100644 --- a/tests/b-info/driver.cxx +++ b/tests/b-info/driver.cxx @@ -1,26 +1,12 @@ // file : tests/b-info/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.b; -import butl.path; -import butl.utility; // operator<<(ostream,exception) -#else -#include <libbutl/b.mxx> -#include <libbutl/path.mxx> -#include <libbutl/utility.mxx> -#endif + +#include <libbutl/b.hxx> +#include <libbutl/path.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream,exception) #undef NDEBUG #include <cassert> diff --git a/tests/backtrace/driver.cxx b/tests/backtrace/driver.cxx index a8ae99a..ecfa58e 100644 --- a/tests/backtrace/driver.cxx +++ b/tests/backtrace/driver.cxx @@ -5,29 +5,14 @@ # include <sys/resource.h> // setrlimit() #endif -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> #include <exception> // set_terminate(), terminate_handler #include <system_error> -#else -import std.io; -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.process; -import butl.fdstream; -import butl.backtrace; -#else -#include <libbutl/process.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/backtrace.mxx> -#endif +#include <libbutl/process.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/backtrace.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/base64/driver.cxx b/tests/base64/driver.cxx index d6a95b3..a37a238 100644 --- a/tests/base64/driver.cxx +++ b/tests/base64/driver.cxx @@ -1,23 +1,11 @@ // file : tests/base64/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <sstream> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.base64; -#else -#include <libbutl/base64.mxx> -#endif +#include <libbutl/base64.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/builtin/driver.cxx b/tests/builtin/driver.cxx index 7a32d8e..7a0193f 100644 --- a/tests/builtin/driver.cxx +++ b/tests/builtin/driver.cxx @@ -5,7 +5,6 @@ # include <libbutl/win32-utility.hxx> #endif -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <chrono> @@ -16,27 +15,12 @@ #ifndef _WIN32 # include <thread> // this_thread::sleep_for() #endif -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.utility; // eof() -import butl.builtin; -import butl.optional; -import butl.timestamp; // to_stream(duration) -#else -#include <libbutl/path.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/builtin.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/timestamp.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/utility.hxx> // eof() +#include <libbutl/builtin.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/timestamp.hxx> // to_stream(duration) #undef NDEBUG #include <cassert> diff --git a/tests/command/driver.cxx b/tests/command/driver.cxx index e2fe41a..9194c13 100644 --- a/tests/command/driver.cxx +++ b/tests/command/driver.cxx @@ -1,36 +1,19 @@ // file : tests/command/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <ios> #include <string> #include <vector> #include <iostream> #include <stdexcept> // invalid_argument #include <system_error> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.path_io; -import butl.process; // process::print() -import butl.command; -import butl.utility; -import butl.optional; -#else -#include <libbutl/path.mxx> -#include <libbutl/path-io.mxx> -#include <libbutl/process.mxx> -#include <libbutl/command.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/optional.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/path-io.hxx> +#include <libbutl/process.hxx> +#include <libbutl/command.hxx> +#include <libbutl/utility.hxx> +#include <libbutl/optional.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/cpfile/driver.cxx b/tests/cpfile/driver.cxx index 8891d58..fe01bdd 100644 --- a/tests/cpfile/driver.cxx +++ b/tests/cpfile/driver.cxx @@ -1,27 +1,13 @@ // file : tests/cpfile/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <ios> #include <string> #include <system_error> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.fdstream; -import butl.filesystem; -#else -#include <libbutl/path.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/filesystem.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/filesystem.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/curl/driver.cxx b/tests/curl/driver.cxx index 3b0ea43..72faf52 100644 --- a/tests/curl/driver.cxx +++ b/tests/curl/driver.cxx @@ -1,33 +1,14 @@ // file : tests/curl/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <iostream> #include <system_error> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -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 <libbutl/curl.mxx> -#include <libbutl/path.mxx> -#include <libbutl/process.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/fdstream.mxx> -#endif + +#include <libbutl/curl.hxx> +#include <libbutl/path.hxx> +#include <libbutl/process.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream, exception) +#include <libbutl/fdstream.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/default-options/driver.cxx b/tests/default-options/driver.cxx index 94ad189..766dca8 100644 --- a/tests/default-options/driver.cxx +++ b/tests/default-options/driver.cxx @@ -1,35 +1,19 @@ // file : tests/default-options/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <limits> #include <string> #include <vector> #include <iostream> #include <exception> #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.path_io; -import butl.optional; -import butl.fdstream; -import butl.default_options; -#else -#include <libbutl/path.mxx> -#include <libbutl/path-io.mxx> -#include <libbutl/utility.mxx> // eof() -#include <libbutl/optional.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/default-options.mxx> -#endif + +#include <libbutl/path.hxx> +#include <libbutl/path-io.hxx> +#include <libbutl/utility.hxx> // eof() +#include <libbutl/optional.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/default-options.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/dir-iterator/driver.cxx b/tests/dir-iterator/driver.cxx index 0c19037..4a2ff53 100644 --- a/tests/dir-iterator/driver.cxx +++ b/tests/dir-iterator/driver.cxx @@ -1,28 +1,13 @@ // file : tests/dir-iterator/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <cstddef> // size_t #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.path_io; -import butl.utility; -import butl.filesystem; -#else -#include <libbutl/path.mxx> -#include <libbutl/path-io.mxx> -#include <libbutl/utility.mxx> // operator<<(ostream, exception) -#include <libbutl/filesystem.mxx> -#endif + +#include <libbutl/path.hxx> +#include <libbutl/path-io.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream, exception) +#include <libbutl/filesystem.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/entry-time/driver.cxx b/tests/entry-time/driver.cxx index 0da7fe9..c29837d 100644 --- a/tests/entry-time/driver.cxx +++ b/tests/entry-time/driver.cxx @@ -1,29 +1,14 @@ // file : tests/entry-time/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <chrono> #include <iostream> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.filesystem; - -import butl.optional; // @@ MOD Clang should not be necessary. -#else -#include <libbutl/path.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/timestamp.mxx> -#include <libbutl/filesystem.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/timestamp.hxx> +#include <libbutl/filesystem.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/fdstream/driver.cxx b/tests/fdstream/driver.cxx index dc657e7..254a03e 100644 --- a/tests/fdstream/driver.cxx +++ b/tests/fdstream/driver.cxx @@ -5,7 +5,6 @@ # include <libbutl/win32-utility.hxx> #endif -#ifndef __cpp_lib_modules_ts #ifndef _WIN32 # include <chrono> #endif @@ -20,30 +19,12 @@ #include <utility> // move() #include <iostream> #include <exception> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#ifndef _WIN32 -import std.threading; -#endif -#endif -import butl.path; -import butl.process; -import butl.fdstream; -import butl.timestamp; -import butl.filesystem; -#else -#include <libbutl/path.mxx> -#include <libbutl/process.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/timestamp.mxx> -#include <libbutl/filesystem.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/process.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/timestamp.hxx> +#include <libbutl/filesystem.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/link/driver.cxx b/tests/link/driver.cxx index 6b898f5..db9c195 100644 --- a/tests/link/driver.cxx +++ b/tests/link/driver.cxx @@ -1,32 +1,16 @@ // file : tests/link/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <set> #include <utility> // pair #include <iostream> // cerr #include <system_error> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.path_io; -import butl.utility; -import butl.fdstream; -import butl.filesystem; -#else -#include <libbutl/path.mxx> -#include <libbutl/path-io.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/filesystem.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/path-io.hxx> +#include <libbutl/utility.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/filesystem.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/lz4/driver.cxx b/tests/lz4/driver.cxx index 9004b56..8139c34 100644 --- a/tests/lz4/driver.cxx +++ b/tests/lz4/driver.cxx @@ -5,8 +5,8 @@ #include <exception> #include <libbutl/lz4.hxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/filesystem.mxx> // entry_stat, path_entry() +#include <libbutl/fdstream.hxx> +#include <libbutl/filesystem.hxx> // entry_stat, path_entry() #undef NDEBUG #include <cassert> diff --git a/tests/manifest-parser/driver.cxx b/tests/manifest-parser/driver.cxx index 859e275..6924321 100644 --- a/tests/manifest-parser/driver.cxx +++ b/tests/manifest-parser/driver.cxx @@ -1,27 +1,14 @@ // file : tests/manifest-parser/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <vector> #include <string> #include <utility> // pair, move() #include <sstream> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.optional; -import butl.manifest_parser; -#else -#include <libbutl/optional.mxx> -#include <libbutl/manifest-parser.mxx> -#endif + +#include <libbutl/optional.hxx> +#include <libbutl/manifest-parser.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/manifest-rewriter/driver.cxx b/tests/manifest-rewriter/driver.cxx index d08a6c8..3e8fecb 100644 --- a/tests/manifest-rewriter/driver.cxx +++ b/tests/manifest-rewriter/driver.cxx @@ -1,34 +1,18 @@ // file : tests/manifest-rewriter/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <vector> #include <string> #include <cstdint> // uint64_t #include <utility> // move() #include <iostream> #include <exception> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.optional; -import butl.fdstream; -import butl.manifest_parser; -import butl.manifest_rewriter; -#else -#include <libbutl/path.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/manifest-parser.mxx> -#include <libbutl/manifest-rewriter.mxx> -#endif + +#include <libbutl/path.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/manifest-parser.hxx> +#include <libbutl/manifest-rewriter.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/manifest-roundtrip/driver.cxx b/tests/manifest-roundtrip/driver.cxx index d0bcab9..4cf35e9 100644 --- a/tests/manifest-roundtrip/driver.cxx +++ b/tests/manifest-roundtrip/driver.cxx @@ -1,28 +1,13 @@ // file : tests/manifest-roundtrip/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -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 <libbutl/utility.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/manifest-parser.mxx> -#include <libbutl/manifest-serializer.mxx> -#endif +#include <libbutl/utility.hxx> // operator<<(ostream, exception) +#include <libbutl/fdstream.hxx> +#include <libbutl/manifest-parser.hxx> +#include <libbutl/manifest-serializer.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/manifest-serializer/driver.cxx b/tests/manifest-serializer/driver.cxx index 59b8ddd..4c09038 100644 --- a/tests/manifest-serializer/driver.cxx +++ b/tests/manifest-serializer/driver.cxx @@ -1,25 +1,13 @@ // file : tests/manifest-serializer/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <vector> #include <string> #include <utility> // pair #include <sstream> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.manifest_serializer; -#else -#include <libbutl/manifest-serializer.mxx> -#endif + +#include <libbutl/manifest-serializer.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/mventry/driver.cxx b/tests/mventry/driver.cxx index dc2e2f7..e895ad6 100644 --- a/tests/mventry/driver.cxx +++ b/tests/mventry/driver.cxx @@ -1,26 +1,12 @@ // file : tests/mventry/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <iostream> #include <system_error> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.utility; // operator<<(ostream, exception) -import butl.filesystem; -#else -#include <libbutl/path.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/filesystem.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream, exception) +#include <libbutl/filesystem.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/openssl/driver.cxx b/tests/openssl/driver.cxx index 450a547..d671c00 100644 --- a/tests/openssl/driver.cxx +++ b/tests/openssl/driver.cxx @@ -1,34 +1,15 @@ // file : tests/openssl/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <vector> #include <iostream> #include <iterator> #include <system_error> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -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 - -import butl.optional; // @@ MOD Clang should not be necessary. -import butl.small_vector; // @@ MOD Clang should not be necessary. -#else -#include <libbutl/path.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/openssl.mxx> -#include <libbutl/fdstream.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream, exception) +#include <libbutl/openssl.hxx> +#include <libbutl/fdstream.hxx> // nullfd #undef NDEBUG #include <cassert> diff --git a/tests/optional/driver.cxx b/tests/optional/driver.cxx index e73f03e..da09cf5 100644 --- a/tests/optional/driver.cxx +++ b/tests/optional/driver.cxx @@ -1,21 +1,10 @@ // file : tests/optional/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <vector> #include <utility> // move() -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.optional; -#else -#include <libbutl/optional.mxx> -#endif + +#include <libbutl/optional.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/pager/driver.cxx b/tests/pager/driver.cxx index 0d6e1e6..c807ed0 100644 --- a/tests/pager/driver.cxx +++ b/tests/pager/driver.cxx @@ -1,26 +1,14 @@ // file : tests/pager/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <ios> // ios_base::failure #include <vector> #include <string> #include <utility> // move() #include <sstream> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.pager; -#else -#include <libbutl/pager.mxx> -#endif + +#include <libbutl/pager.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/path-entry/driver.cxx b/tests/path-entry/driver.cxx index 13914cd..d9ea2be 100644 --- a/tests/path-entry/driver.cxx +++ b/tests/path-entry/driver.cxx @@ -1,34 +1,17 @@ // file : tests/path-entry/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> #include <stdexcept> // invalid_argument #include <system_error> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.path-io; -import butl.utility; // operator<<(ostream, exception) -import butl.optional; -import butl.timestamp; -import butl.filesystem; -#else -#include <libbutl/path.mxx> -#include <libbutl/path-io.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/timestamp.mxx> -#include <libbutl/filesystem.mxx> -#endif + +#include <libbutl/path.hxx> +#include <libbutl/path-io.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream, exception) +#include <libbutl/optional.hxx> +#include <libbutl/timestamp.hxx> +#include <libbutl/filesystem.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/path/driver.cxx b/tests/path/driver.cxx index 9f85d6b..3124c13 100644 --- a/tests/path/driver.cxx +++ b/tests/path/driver.cxx @@ -1,25 +1,12 @@ // file : tests/path/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <sstream> #include <iostream> #include <type_traits> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -//import butl.path_io; -#else -#include <libbutl/path.mxx> -//#include <libbutl/path-io.mxx> -#endif +#include <libbutl/path.hxx> +//#include <libbutl/path-io.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/prefix-map/driver.cxx b/tests/prefix-map/driver.cxx index 0628abf..8ed35ea 100644 --- a/tests/prefix-map/driver.cxx +++ b/tests/prefix-map/driver.cxx @@ -1,22 +1,10 @@ // file : tests/prefix-map/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.prefix_map; -#else -#include <libbutl/prefix-map.mxx> -#endif + +#include <libbutl/prefix-map.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/process-run/driver.cxx b/tests/process-run/driver.cxx index c851666..032f890 100644 --- a/tests/process-run/driver.cxx +++ b/tests/process-run/driver.cxx @@ -1,29 +1,13 @@ // file : tests/process-run/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -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 <libbutl/path.mxx> -#include <libbutl/process.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/small-vector.mxx> -#endif + +#include <libbutl/path.hxx> +#include <libbutl/process.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/small-vector.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/process-term/driver.cxx b/tests/process-term/driver.cxx index 90afc96..799757c 100644 --- a/tests/process-term/driver.cxx +++ b/tests/process-term/driver.cxx @@ -10,7 +10,6 @@ # include <libbutl/win32-utility.hxx> #endif -#ifndef __cpp_lib_modules_ts #include <string> #include <cerrno> // ERANGE #include <utility> // move() @@ -21,23 +20,10 @@ #ifndef _WIN32 # include <chrono> #endif -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.process; -import butl.optional; -import butl.fdstream; -#else -#include <libbutl/process.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/fdstream.mxx> -#endif +#include <libbutl/process.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/fdstream.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/process/driver.cxx b/tests/process/driver.cxx index ab5006a..1ee5710 100644 --- a/tests/process/driver.cxx +++ b/tests/process/driver.cxx @@ -1,7 +1,6 @@ // file : tests/process/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <ios> #include <string> #include <vector> @@ -10,30 +9,14 @@ #include <iterator> // istreambuf_iterator, ostream_iterator #include <algorithm> // copy() #include <iostream> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.utility; // setenv(), getenv() -import butl.process; -import butl.optional; -import butl.fdstream; -import butl.timestamp; -#else -#include <libbutl/path.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/process.mxx> -#include <libbutl/process-io.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/timestamp.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/utility.hxx> // setenv(), getenv() +#include <libbutl/process.hxx> +#include <libbutl/process-io.hxx> +#include <libbutl/optional.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/timestamp.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/progress/driver.cxx b/tests/progress/driver.cxx index 68952a7..f1a257c 100644 --- a/tests/progress/driver.cxx +++ b/tests/progress/driver.cxx @@ -8,36 +8,16 @@ # include <io.h> //_write() #endif -#ifndef __cpp_lib_modules_ts #include <string> #include <cstddef> // size_t #include <iostream> #ifndef _WIN32 # include <thread> // this_thread::sleep_for() #endif -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#ifndef _WIN32 -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 <libbutl/process.mxx> -#include <libbutl/fdstream.mxx> // fdopen_null(), stderr_fd() -#include <libbutl/diagnostics.mxx> -#endif +#include <libbutl/process.hxx> +#include <libbutl/fdstream.hxx> // fdopen_null(), stderr_fd() +#include <libbutl/diagnostics.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/project-name/driver.cxx b/tests/project-name/driver.cxx index 8c5b206..ac1c898 100644 --- a/tests/project-name/driver.cxx +++ b/tests/project-name/driver.cxx @@ -1,26 +1,14 @@ // file : tests/project-name/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <ios> // ios::*bit #include <string> #include <iostream> #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.utility; // operator<<(ostream,exception), eof(), *case() -import butl.project_name; -#else -#include <libbutl/utility.mxx> -#include <libbutl/project-name.mxx> -#endif + +#include <libbutl/utility.hxx> // operator<<(ostream,exception), eof(), + // *case() +#include <libbutl/project-name.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/regex/driver.cxx b/tests/regex/driver.cxx index ce707b8..f8363e1 100644 --- a/tests/regex/driver.cxx +++ b/tests/regex/driver.cxx @@ -1,29 +1,15 @@ // file : tests/regex/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <regex> #include <string> #include <utility> // pair #include <iostream> #include <stdexcept> // invalid_argument #include <exception> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -import std.regex; // @@ MOD TODO: shouldn't be necessary (re-export). -#endif -import butl.regex; -import butl.utility; // operator<<(ostream, exception) -#else -#include <libbutl/regex.mxx> -#include <libbutl/utility.mxx> -#endif +#include <libbutl/regex.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream, exception) #undef NDEBUG #include <cassert> diff --git a/tests/semantic-version/driver.cxx b/tests/semantic-version/driver.cxx index ac6bf33..2bdd415 100644 --- a/tests/semantic-version/driver.cxx +++ b/tests/semantic-version/driver.cxx @@ -1,21 +1,9 @@ // file : tests/semantic-version/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <iostream> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.semantic_version; -#else -#include <libbutl/semantic-version.mxx> -#endif +#include <libbutl/semantic-version.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/sendmail/driver.cxx b/tests/sendmail/driver.cxx index a29650c..3b97202 100644 --- a/tests/sendmail/driver.cxx +++ b/tests/sendmail/driver.cxx @@ -1,32 +1,13 @@ // file : tests/sendmail/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <iostream> #include <system_error> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -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; - -import butl.optional; // @@ MOD Clang should not be necessary. -import butl.small_vector; // @@ MOD Clang should not be necessary. -#else -#include <libbutl/path.mxx> -#include <libbutl/process.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/sendmail.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/process.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream, exception) +#include <libbutl/sendmail.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/sha1/driver.cxx b/tests/sha1/driver.cxx index cb648db..1e8e254 100644 --- a/tests/sha1/driver.cxx +++ b/tests/sha1/driver.cxx @@ -1,27 +1,13 @@ // file : tests/sha1/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <cstddef> // size_t -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.sha1; -import butl.path; -import butl.fdstream; -import butl.filesystem; -#else -#include <libbutl/sha1.mxx> -#include <libbutl/path.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/filesystem.mxx> // auto_rmfile -#endif + +#include <libbutl/sha1.hxx> +#include <libbutl/path.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/filesystem.hxx> // auto_rmfile #undef NDEBUG #include <cassert> diff --git a/tests/sha256/driver.cxx b/tests/sha256/driver.cxx index 3d2f69e..30dfa49 100644 --- a/tests/sha256/driver.cxx +++ b/tests/sha256/driver.cxx @@ -1,27 +1,13 @@ // file : tests/sha256/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <cstddef> // size_t -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.path; -import butl.sha256; -import butl.fdstream; -import butl.filesystem; -#else -#include <libbutl/path.mxx> -#include <libbutl/sha256.mxx> -#include <libbutl/fdstream.mxx> -#include <libbutl/filesystem.mxx> // auto_rmfile -#endif + +#include <libbutl/path.hxx> +#include <libbutl/sha256.hxx> +#include <libbutl/fdstream.hxx> +#include <libbutl/filesystem.hxx> // auto_rmfile #undef NDEBUG #include <cassert> diff --git a/tests/small-forward-list/driver.cxx b/tests/small-forward-list/driver.cxx index 1b8a14f..1cfea77 100644 --- a/tests/small-forward-list/driver.cxx +++ b/tests/small-forward-list/driver.cxx @@ -1,22 +1,10 @@ // file : tests/small-forward-list/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.small_forward_list; -#else -#include <libbutl/small-forward-list.mxx> -#endif + +#include <libbutl/small-forward-list.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/small-list/driver.cxx b/tests/small-list/driver.cxx index cced91d..8e2fb6e 100644 --- a/tests/small-list/driver.cxx +++ b/tests/small-list/driver.cxx @@ -1,22 +1,10 @@ // file : tests/small-list/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.small_list; -#else -#include <libbutl/small-list.mxx> -#endif +#include <libbutl/small-list.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/small-vector/driver.cxx b/tests/small-vector/driver.cxx index be8e6d8..cc012fc 100644 --- a/tests/small-vector/driver.cxx +++ b/tests/small-vector/driver.cxx @@ -1,22 +1,10 @@ // file : tests/small-vector/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.small_vector; -#else -#include <libbutl/small-vector.mxx> -#endif + +#include <libbutl/small-vector.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/standard-version/driver.cxx b/tests/standard-version/driver.cxx index dbd24fc..29cad54 100644 --- a/tests/standard-version/driver.cxx +++ b/tests/standard-version/driver.cxx @@ -1,29 +1,15 @@ // file : tests/standard-version/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <ios> // ios::failbit, ios::badbit #include <string> #include <cstdint> // uint*_t #include <iostream> #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.utility; // operator<<(ostream,exception), eof() -import butl.optional; -import butl.standard_version; -#else -#include <libbutl/utility.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/standard-version.mxx> -#endif + +#include <libbutl/utility.hxx> // operator<<(ostream,exception), eof() +#include <libbutl/optional.hxx> +#include <libbutl/standard-version.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/strcase/driver.cxx b/tests/strcase/driver.cxx index 48e77f2..8e964a6 100644 --- a/tests/strcase/driver.cxx +++ b/tests/strcase/driver.cxx @@ -1,20 +1,9 @@ // file : tests/strcase/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.utility; -#else -#include <libbutl/utility.mxx> -#endif +#include <libbutl/utility.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/string-parser/driver.cxx b/tests/string-parser/driver.cxx index 2e47e4a..8cba912 100644 --- a/tests/string-parser/driver.cxx +++ b/tests/string-parser/driver.cxx @@ -1,25 +1,12 @@ // file : tests/string-parser/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <vector> #include <iostream> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.utility; // operator<<(ostream,exception) -import butl.string_parser; -#else -#include <libbutl/utility.mxx> -#include <libbutl/string-parser.mxx> -#endif + +#include <libbutl/utility.hxx> // operator<<(ostream,exception) +#include <libbutl/string-parser.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/tab-parser/driver.cxx b/tests/tab-parser/driver.cxx index e9cd36f..99c19d9 100644 --- a/tests/tab-parser/driver.cxx +++ b/tests/tab-parser/driver.cxx @@ -1,24 +1,11 @@ // file : tests/tab-parser/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> -#endif -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.utility; // operator<<(ostream,exception) -import butl.tab_parser; -#else -#include <libbutl/utility.mxx> -#include <libbutl/tab-parser.mxx> -#endif +#include <libbutl/utility.hxx> // operator<<(ostream,exception) +#include <libbutl/tab-parser.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/target-triplet/driver.cxx b/tests/target-triplet/driver.cxx index 9cd7c2b..6dcb77e 100644 --- a/tests/target-triplet/driver.cxx +++ b/tests/target-triplet/driver.cxx @@ -1,23 +1,11 @@ // file : tests/target-triplet/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <iostream> #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.target_triplet; -#else -#include <libbutl/target-triplet.mxx> -#endif + +#include <libbutl/target-triplet.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/timestamp/driver.cxx b/tests/timestamp/driver.cxx index 0ea2b38..11f328a 100644 --- a/tests/timestamp/driver.cxx +++ b/tests/timestamp/driver.cxx @@ -3,26 +3,14 @@ #include <time.h> // tzset() (POSIX), _tzset() (Windows) -#ifndef __cpp_lib_modules_ts #include <chrono> #include <locale> #include <clocale> #include <sstream> #include <iomanip> #include <system_error> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.timestamp; -#else -#include <libbutl/timestamp.mxx> -#endif +#include <libbutl/timestamp.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/url/driver.cxx b/tests/url/driver.cxx index 02bb5b8..869eed5 100644 --- a/tests/url/driver.cxx +++ b/tests/url/driver.cxx @@ -1,27 +1,14 @@ // file : tests/url/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> #include <utility> // move() #include <iostream> #include <iterator> // back_inserter #include <stdexcept> // invalid_argument -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.url; -import butl.utility; // operator<<(ostream, exception) -#else -#include <libbutl/url.mxx> -#include <libbutl/utility.mxx> -#endif + +#include <libbutl/url.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream, exception) #undef NDEBUG #include <cassert> diff --git a/tests/utf8/driver.cxx b/tests/utf8/driver.cxx index db98aa6..ccc2870 100644 --- a/tests/utf8/driver.cxx +++ b/tests/utf8/driver.cxx @@ -1,22 +1,10 @@ // file : tests/utf8/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <string> -#endif - -// Other includes. - -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -#endif -import butl.utf8; -import butl.utility; -#else -#include <libbutl/utf8.mxx> -#include <libbutl/utility.mxx> -#endif + +#include <libbutl/utf8.hxx> +#include <libbutl/utility.hxx> #undef NDEBUG #include <cassert> diff --git a/tests/wildcard/driver.cxx b/tests/wildcard/driver.cxx index bd6a00d..9419a79 100644 --- a/tests/wildcard/driver.cxx +++ b/tests/wildcard/driver.cxx @@ -1,34 +1,18 @@ // file : tests/wildcard/driver.cxx -*- C++ -*- // license : MIT; see accompanying LICENSE file -#ifndef __cpp_lib_modules_ts #include <map> #include <string> #include <vector> #include <algorithm> // sort() #include <exception> #include <iostream> -#endif - -// Other includes. -#ifdef __cpp_modules_ts -#ifdef __cpp_lib_modules_ts -import std.core; -import std.io; -#endif -import butl.path; -import butl.utility; // operator<<(ostream, exception) -import butl.optional; -import butl.filesystem; -import butl.path_pattern; -#else -#include <libbutl/path.mxx> -#include <libbutl/utility.mxx> -#include <libbutl/optional.mxx> -#include <libbutl/filesystem.mxx> -#include <libbutl/path-pattern.mxx> -#endif +#include <libbutl/path.hxx> +#include <libbutl/utility.hxx> // operator<<(ostream, exception) +#include <libbutl/optional.hxx> +#include <libbutl/filesystem.hxx> +#include <libbutl/path-pattern.hxx> #undef NDEBUG #include <cassert> |