[libcxx-commits] [PATCH] D73351: [libcxx] Define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR using feature test macro

Sergej Jaskiewicz via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jan 24 07:08:19 PST 2020


broadwaylamb created this revision.
broadwaylamb added reviewers: EricWF, mehdi_amini, mclow.lists, CaseyCarter.
broadwaylamb added a project: libc++.
Herald added subscribers: libcxx-commits, ldionne, christof.

Feature test macro for the spaceship operator has landed in
bc633a42dd409dbeb456263e3388b8caa4680aa0 <https://reviews.llvm.org/rGbc633a42dd409dbeb456263e3388b8caa4680aa0>, now we can use it in libc++.

I don't know how the buildbots are green, but without this change I have failing tests, for example, this <https://github.com/llvm/llvm-project/blob/1d0972ff5eab544579c400ee674d5c9c60391ee1/libcxx/test/std/language.support/cmp/cmp.partialord/partialord.pass.cpp#L46-L51>: the thing is that `TEST_HAS_NO_SPACESHIP_OPERATOR` is already defined based on the feature test macro (see 1f92d8b5449f6fd17360421e2e4da3fb7bff5c5a), but the `_LIBCPP_HAS_NO_SPACESHIP_OPERATOR ` that is used in libc++ for deciding if we want to declare the `<=>` functions seems to still be defined uncondititionally, so this test file won't compile because of missing `<=>` declarations.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73351

Files:
  libcxx/include/__config


Index: libcxx/include/__config
===================================================================
--- libcxx/include/__config
+++ libcxx/include/__config
@@ -1359,10 +1359,9 @@
 #define _LIBCPP_HAS_NO_COROUTINES
 #endif
 
-// FIXME: Correct this macro when either (A) a feature test macro for the
-// spaceship operator is provided, or (B) a compiler provides a complete
-// implementation.
+#if !defined(__cpp_impl_three_way_comparison)
 #define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
+#endif
 
 // Decide whether to use availability macros.
 #if !defined(_LIBCPP_BUILDING_LIBRARY) &&                                      \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73351.240180.patch
Type: text/x-patch
Size: 621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200124/14b4ef9e/attachment.bin>


More information about the libcxx-commits mailing list