[libcxx-commits] [libcxx] b490c8a - [libc++][format] Updates feature-test macros.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 7 09:39:49 PDT 2022


Author: Mark de Wever
Date: 2022-09-07T18:39:39+02:00
New Revision: b490c8a6623c6a32cebf45567c467d38c3285fb9

URL: https://github.com/llvm/llvm-project/commit/b490c8a6623c6a32cebf45567c467d38c3285fb9
DIFF: https://github.com/llvm/llvm-project/commit/b490c8a6623c6a32cebf45567c467d38c3285fb9.diff

LOG: [libc++][format] Updates feature-test macros.

During the discussion on the SG-10 mailinglist regarding the format
feature-test macros voted in during the last plenary it turns out libc++
can't mark the format feature-test macro as implemented.

According to
  https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#__cpp_lib_format
the not yet implemented paper
  P1361R2 Integration of chrono with text formatting
affects the feature test macro.

Note that P1361R2 doesn't mention the feature-test macro nor is there an
LWG-issue to address the issue. The reporter of the issue didn't recall
where this requirement exactly has been decided.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D133271

Added: 
    

Modified: 
    libcxx/docs/FeatureTestMacroTable.rst
    libcxx/include/version
    libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
    libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
    libcxx/utils/generate_feature_test_macro_components.py

Removed: 
    


################################################################################
diff  --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 8d38beb3e9adc..11bff15b66b74 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -234,7 +234,7 @@ Status
     ------------------------------------------------- -----------------
     ``__cpp_lib_execution``                           *unimplemented*
     ------------------------------------------------- -----------------
-    ``__cpp_lib_format``                              ``202106L``
+    ``__cpp_lib_format``                              *unimplemented*
     ------------------------------------------------- -----------------
     ``__cpp_lib_generic_unordered_lookup``            ``201811L``
     ------------------------------------------------- -----------------

diff  --git a/libcxx/include/version b/libcxx/include/version
index 858f8849fe623..99b94ff874ae4 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -335,7 +335,7 @@ __cpp_lib_void_t                                        201411L <type_traits>
 # undef  __cpp_lib_execution
 // # define __cpp_lib_execution                            201902L
 # if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
-#   define __cpp_lib_format                             202106L
+// #   define __cpp_lib_format                             202106L
 # endif
 # define __cpp_lib_generic_unordered_lookup             201811L
 # define __cpp_lib_int_pow2                             202002L

diff  --git a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
index 39d0166b88204..7e183311bceca 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp
@@ -44,31 +44,31 @@
 
 #elif TEST_STD_VER == 20
 
-# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
+# if !defined(_LIBCPP_VERSION)
 #   ifndef __cpp_lib_format
 #     error "__cpp_lib_format should be defined in c++20"
 #   endif
 #   if __cpp_lib_format != 202106L
 #     error "__cpp_lib_format should have the value 202106L in c++20"
 #   endif
-# else
+# else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_format
-#     error "__cpp_lib_format should not be defined when the requirement '!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)' is not met!"
+#     error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
 #   endif
 # endif
 
 #elif TEST_STD_VER > 20
 
-# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
+# if !defined(_LIBCPP_VERSION)
 #   ifndef __cpp_lib_format
 #     error "__cpp_lib_format should be defined in c++2b"
 #   endif
 #   if __cpp_lib_format != 202106L
 #     error "__cpp_lib_format should have the value 202106L in c++2b"
 #   endif
-# else
+# else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_format
-#     error "__cpp_lib_format should not be defined when the requirement '!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)' is not met!"
+#     error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
 #   endif
 # endif
 

diff  --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index ca84e43ee2a7c..d3e84d04183a8 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -2848,16 +2848,16 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
+# if !defined(_LIBCPP_VERSION)
 #   ifndef __cpp_lib_format
 #     error "__cpp_lib_format should be defined in c++20"
 #   endif
 #   if __cpp_lib_format != 202106L
 #     error "__cpp_lib_format should have the value 202106L in c++20"
 #   endif
-# else
+# else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_format
-#     error "__cpp_lib_format should not be defined when the requirement '!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)' is not met!"
+#     error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
 #   endif
 # endif
 
@@ -4090,16 +4090,16 @@
 #   endif
 # endif
 
-# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
+# if !defined(_LIBCPP_VERSION)
 #   ifndef __cpp_lib_format
 #     error "__cpp_lib_format should be defined in c++2b"
 #   endif
 #   if __cpp_lib_format != 202106L
 #     error "__cpp_lib_format should have the value 202106L in c++2b"
 #   endif
-# else
+# else // _LIBCPP_VERSION
 #   ifdef __cpp_lib_format
-#     error "__cpp_lib_format should not be defined when the requirement '!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)' is not met!"
+#     error "__cpp_lib_format should not be defined because it is unimplemented in libc++!"
 #   endif
 # endif
 

diff  --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 41e85980bc8ff..37860a731d299 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -313,15 +313,17 @@ def add_version_header(tc):
     "libcxx_guard": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem)"
   }, {
     "name": "__cpp_lib_format",
-    # P2508, P2286, and P2419 were accepted in the same plenary and modify this
-    # feature-test macro. We expect to see an LWG issue soon. For now keep the
-    # value as is.
-    # TODO FMT Set P2508's feature-test macro.
-    #"values": { "c++20": 202106, "c++23": 202207" },
-    "values": { "c++20": 202106 },
+    "values": {
+        # "c++20": 201907 Not implemented P1361R2 Integration of chrono with text formatting
+        # "c++20": 202106 Fully implemented
+        # "c++20": 202110 Not implemented P2372R3 Fixing locale handling in chrono formatters
+        "c++20": 202106,
+        # "c++23": 202207, Not implemented P2419R2 Clarify handling of encodings in localized formatting of chrono types
+        },
     "headers": ["format"],
     "test_suite_guard": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
     "libcxx_guard": "!defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)",
+    "unimplemented": True,
   }, {
     "name": "__cpp_lib_forward_like",
     "values": { "c++2b": 202207 },


        


More information about the libcxx-commits mailing list