diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 43daeeb4d390..74fc8485e44c 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -530,7 +530,7 @@ inline std::tm gmtime( return gmtime(std::chrono::system_clock::to_time_t(time_point)); } -FMT_BEGIN_DETAIL_NAMESPACE +namespace detail { // DEPRECATED! template @@ -1997,7 +1997,7 @@ struct chrono_formatter { } }; -FMT_END_DETAIL_NAMESPACE +} // namespace detail #if defined(__cpp_lib_chrono) && __cpp_lib_chrono >= 201907 using weekday = std::chrono::weekday; @@ -2142,8 +2142,8 @@ struct formatter, epoch - std::chrono::duration_cast(epoch)); if (subsecs.count() < 0) { - auto second = std::chrono::duration_cast( - std::chrono::seconds(1)); + auto second = + std::chrono::duration_cast(std::chrono::seconds(1)); if (epoch.count() < ((Duration::min)() + second).count()) FMT_THROW(format_error("duration is too small")); subsecs += second; diff --git a/include/fmt/color.h b/include/fmt/color.h index d175448ab6af..8697e1ca0bad 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -203,7 +203,7 @@ struct rgb { uint8_t b; }; -FMT_BEGIN_DETAIL_NAMESPACE +namespace detail { // color is a struct of either a rgb color or a terminal color. struct color_type { @@ -225,8 +225,7 @@ struct color_type { uint32_t rgb_color; } value; }; - -FMT_END_DETAIL_NAMESPACE +} // namespace detail /** A text style consisting of foreground and background colors and emphasis. */ class text_style { @@ -323,7 +322,7 @@ FMT_CONSTEXPR inline text_style operator|(emphasis lhs, emphasis rhs) noexcept { return text_style(lhs) | rhs; } -FMT_BEGIN_DETAIL_NAMESPACE +namespace detail { template struct ansi_color_escape { FMT_CONSTEXPR ansi_color_escape(detail::color_type text_color, @@ -457,7 +456,7 @@ void vformat_to(buffer& buf, const text_style& ts, if (has_style) detail::reset_color(buf); } -FMT_END_DETAIL_NAMESPACE +} // namespace detail inline void vprint(std::FILE* f, const text_style& ts, string_view fmt, format_args args) { diff --git a/include/fmt/format.h b/include/fmt/format.h index 00a090d568d7..67d9caffde64 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -48,11 +48,6 @@ #include "core.h" -#ifndef FMT_BEGIN_DETAIL_NAMESPACE -# define FMT_BEGIN_DETAIL_NAMESPACE namespace detail { -# define FMT_END_DETAIL_NAMESPACE } -#endif - #if defined __cpp_inline_variables && __cpp_inline_variables >= 201606L # define FMT_INLINE_VARIABLE inline #else @@ -1126,7 +1121,7 @@ template class format_facet : public Locale::facet { } }; -FMT_BEGIN_DETAIL_NAMESPACE +namespace detail { // Returns true if value is negative, false otherwise. // Same as `value < 0` but doesn't produce warnings if T is an unsigned type. @@ -3893,7 +3888,7 @@ FMT_API void format_error_code(buffer& out, int error_code, FMT_API void report_error(format_func func, int error_code, const char* message) noexcept; -FMT_END_DETAIL_NAMESPACE +} // namespace detail FMT_API auto vsystem_error(int error_code, string_view format_str, format_args args) -> std::system_error; @@ -4264,7 +4259,7 @@ FMT_NODISCARD auto to_string(const basic_memory_buffer& buf) return std::basic_string(buf.data(), size); } -FMT_BEGIN_DETAIL_NAMESPACE +namespace detail { template void vformat_to(buffer& buf, basic_string_view fmt, @@ -4347,7 +4342,7 @@ extern template FMT_API auto decimal_point_impl(locale_ref) -> char; extern template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; #endif // FMT_HEADER_ONLY -FMT_END_DETAIL_NAMESPACE +} // namespace detail #if FMT_USE_USER_DEFINED_LITERALS inline namespace literals { diff --git a/include/fmt/os.h b/include/fmt/os.h index ec290402103b..2126424d39cb 100644 --- a/include/fmt/os.h +++ b/include/fmt/os.h @@ -123,10 +123,10 @@ using wcstring_view = basic_cstring_view; #ifdef _WIN32 FMT_API const std::error_category& system_category() noexcept; -FMT_BEGIN_DETAIL_NAMESPACE +namespace detail { FMT_API void format_windows_error(buffer& out, int error_code, const char* message) noexcept; -FMT_END_DETAIL_NAMESPACE +} FMT_API std::system_error vwindows_error(int error_code, string_view format_str, format_args args); @@ -328,7 +328,7 @@ class FMT_API file { // Returns the memory page size. long getpagesize(); -FMT_BEGIN_DETAIL_NAMESPACE +namespace detail { struct buffer_size { buffer_size() = default; @@ -387,7 +387,7 @@ class file_buffer final : public buffer { } }; -FMT_END_DETAIL_NAMESPACE +} // namespace detail // Added {} below to work around default constructor error known to // occur in Xcode versions 7.2.1 and 8.2.1. diff --git a/include/fmt/printf.h b/include/fmt/printf.h index 5d1aeb71e14c..adef6adf837e 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -52,7 +52,7 @@ template class basic_printf_context { } }; -FMT_BEGIN_DETAIL_NAMESPACE +namespace detail { // Checks if a value fits in int - used to avoid warnings about comparing // signed and unsigned integers. @@ -553,7 +553,7 @@ void vprintf(buffer& buf, basic_string_view format, } write(out, basic_string_view(start, to_unsigned(it - start))); } -FMT_END_DETAIL_NAMESPACE +} // namespace detail using printf_context = basic_printf_context; using wprintf_context = basic_printf_context;