From ff37e41625713c8b51990d971bbccb0cec267591 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 29 May 2021 09:37:17 -0700 Subject: [PATCH] wchar.h -> xchar.h because it handles other code unit types too --- CMakeLists.txt | 2 +- include/fmt/format.h | 4 ++-- include/fmt/locale.h | 4 ++-- include/fmt/{wchar.h => xchar.h} | 2 +- src/fmt.cc | 14 ++++++-------- test/enforce-checks-test.cc | 2 +- test/wchar-test.cc | 3 +-- 7 files changed, 14 insertions(+), 17 deletions(-) rename include/fmt/{wchar.h => xchar.h} (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7958b1d6..ae9c5692 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -227,7 +227,7 @@ endfunction() # Define the fmt library, its includes and the needed defines. add_headers(FMT_HEADERS args.h chrono.h color.h compile.h core.h format.h format-inl.h locale.h os.h ostream.h printf.h ranges.h - wchar.h) + xchar.h) if (FMT_MODULE) set(FMT_SOURCES src/fmt.cc) elseif (FMT_OS) diff --git a/include/fmt/format.h b/include/fmt/format.h index c7ed6cc3..4dedd956 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2889,8 +2889,8 @@ inline auto formatted_size(const S& fmt, Args&&... args) -> size_t { FMT_MODULE_EXPORT_END FMT_END_NAMESPACE -#ifdef FMT_DEPRECATED_INCLUDE_WCHAR -# include "wchar.h" +#ifdef FMT_DEPRECATED_INCLUDE_XCHAR +# include "xchar.h" #endif #ifdef FMT_HEADER_ONLY diff --git a/include/fmt/locale.h b/include/fmt/locale.h index 6c3b1e11..7571b526 100644 --- a/include/fmt/locale.h +++ b/include/fmt/locale.h @@ -1,2 +1,2 @@ -#include "wchar.h" -#warning fmt/locale.h is deprecated, include fmt/format.h or fmt/wchar.h instead +#include "xchar.h" +#warning fmt/locale.h is deprecated, include fmt/format.h or fmt/xchar.h instead diff --git a/include/fmt/wchar.h b/include/fmt/xchar.h similarity index 98% rename from include/fmt/wchar.h rename to include/fmt/xchar.h index cb669588..d4b0a1cc 100644 --- a/include/fmt/wchar.h +++ b/include/fmt/xchar.h @@ -1,4 +1,4 @@ -// Formatting library for C++ - optional wchar_t support +// Formatting library for C++ - optional wchar_t and exotic character support // // Copyright (c) 2012 - present, Victor Zverovich // All rights reserved. diff --git a/src/fmt.cc b/src/fmt.cc index 7309f62d..728436ff 100644 --- a/src/fmt.cc +++ b/src/fmt.cc @@ -8,8 +8,10 @@ module; # define WIN32_LEAN_AND_MEAN #endif +#include #include #include +#include #include #include #include @@ -21,9 +23,6 @@ module; #include #include #include - -#include -#include #include #include #include @@ -76,17 +75,16 @@ export module fmt; #define FMT_END_DETAIL_NAMESPACE \ } \ export { - // all library-provided declarations and definitions // must be in the module purview to be exported -#include "fmt/format.h" #include "fmt/args.h" +#include "fmt/chrono.h" #include "fmt/color.h" #include "fmt/compile.h" -#include "fmt/chrono.h" -#include "fmt/printf.h" -#include "fmt/wchar.h" +#include "fmt/format.h" #include "fmt/os.h" +#include "fmt/printf.h" +#include "fmt/xchar.h" module : private; diff --git a/test/enforce-checks-test.cc b/test/enforce-checks-test.cc index 4f5fd361..5e63e163 100644 --- a/test/enforce-checks-test.cc +++ b/test/enforce-checks-test.cc @@ -13,7 +13,7 @@ #include "fmt/format.h" #include "fmt/ostream.h" #include "fmt/ranges.h" -#include "fmt/wchar.h" +#include "fmt/xchar.h" // Exercise the API to verify that everything we expect to can compile. void test_format_api() { diff --git a/test/wchar-test.cc b/test/wchar-test.cc index ca776414..8c834c48 100644 --- a/test/wchar-test.cc +++ b/test/wchar-test.cc @@ -5,10 +5,9 @@ // // For the license information refer to format.h. -#include "fmt/wchar.h" - #include +#include "fmt/xchar.h" #include "gtest/gtest.h" using fmt::detail::max_value;