[PATCH] D50205: [libc++] Add availability markup for aligned new/delete

2018-08-06 Thread Louis Dionne via Phabricator via cfe-commits
ldionne abandoned this revision.
ldionne added a comment.

Nevermind, it looks like this patch is not necessary anymore since 
https://reviews.llvm.org/D45015 landed.


Repository:
  rCXX libc++

https://reviews.llvm.org/D50205



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50205: [libc++] Add availability markup for aligned new/delete

2018-08-06 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

In https://reviews.llvm.org/D50205#1188454, @EricWF wrote:

> How does this work when a user provides their own definitions? Does the 
> attribute from the declaration still produce a warning? If so, then I think 
> an in-compiler approach is better.


Yes. I do agree that not warning when the user provides their own definition is 
a better user experience, however I think that is already the behavior we have 
for sized new/delete (with `_LIBCPP_AVAILABILITY_SIZED_NEW_DELETE`). Is it any 
different?

If we were to go for an in-compiler approach, what would be the behavior we 
want? Any TU that uses the operator but defines it would not get a warning, but 
any TU that uses it without defining it would still get a warning, right? If 
so, it doesn't seem like such a huge improvement.


Repository:
  rCXX libc++

https://reviews.llvm.org/D50205



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50205: [libc++] Add availability markup for aligned new/delete

2018-08-03 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

How does this work when a user provides their own definitions? Does the 
attribute from the declaration still produce a warning? If so, then I think an 
in-compiler approach is better.


Repository:
  rCXX libc++

https://reviews.llvm.org/D50205



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50205: [libc++] Add availability markup for aligned new/delete

2018-08-03 Thread Louis Dionne via Phabricator via cfe-commits
ldionne updated this revision to Diff 159110.
ldionne added a comment.

Only include availability markup in this patch, do not change whether and when 
aligned allocation functions are used by the library. This will be handled in a 
separate patch.


Repository:
  rCXX libc++

https://reviews.llvm.org/D50205

Files:
  libcxx/include/__config
  libcxx/include/new
  
libcxx/test/libcxx/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp
  
libcxx/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp

Index: libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
===
--- libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
+++ libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
@@ -13,6 +13,13 @@
 // NOTE: GCC doesn't provide a -faligned-allocation flag
 // XFAIL: no-aligned-allocation && !gcc
 
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
 // test operator new replacement
 
 #include 
Index: libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
===
--- libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
+++ libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
@@ -17,6 +17,13 @@
 // XFAIL: with_system_cxx_lib=macosx10.7
 // XFAIL: with_system_cxx_lib=macosx10.8
 
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
 // NOTE: gcc doesn't provide -faligned-allocation flag to test for
 // XFAIL: no-aligned-allocation && !gcc
 
Index: libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
===
--- libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
+++ libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
@@ -16,6 +16,13 @@
 // XFAIL: with_system_cxx_lib=macosx10.7
 // XFAIL: with_system_cxx_lib=macosx10.8
 
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
 // asan and msan will not call the new handler.
 // UNSUPPORTED: sanitizer-new-delete
 
Index: libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
===
--- libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
+++ libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
@@ -16,6 +16,13 @@
 // XFAIL: with_system_cxx_lib=macosx10.7
 // XFAIL: with_system_cxx_lib=macosx10.8
 
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
 // asan and msan will not call the new handler.
 // UNSUPPORTED: sanitizer-new-delete
 

[PATCH] D50205: [libc++] Add availability markup for aligned new/delete

2018-08-02 Thread Louis Dionne via Phabricator via cfe-commits
ldionne added a comment.

In https://reviews.llvm.org/D50205#1186419, @ahatanak wrote:

> I just wanted to make sure that this doesn't have the same problem as 
> https://reviews.llvm.org/D34556. Is that correct?
>
> The patch was reverted in r306859. https://reviews.llvm.org/D34574#791158 
> explains why the approach taken in the patch was wrong.


I was neither aware of https://reviews.llvm.org/D34574 nor 
https://reviews.llvm.org/D34556, but that changes the picture quite a bit. So, 
IIUC, we want to predicate our use of the aligned allocation functions on 
whether `__cpp_aligned_new` is defined, which will be defined correctly because 
of https://reviews.llvm.org/D45015. Since we're already predicated on that, 
there's really not much to do in libc++.

I think it's still a good idea to have the availability markup, though.


Repository:
  rCXX libc++

https://reviews.llvm.org/D50205



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50205: [libc++] Add availability markup for aligned new/delete

2018-08-02 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak added a comment.

I just wanted to make sure that this doesn't have the same problem as 
https://reviews.llvm.org/D34556. Is that correct?

The patch was reverted in r306859. https://reviews.llvm.org/D34574#791158 
explains why the approach taken in the patch was wrong.


Repository:
  rCXX libc++

https://reviews.llvm.org/D50205



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D50205: [libc++] Add availability markup for aligned new/delete

2018-08-02 Thread Louis Dionne via Phabricator via cfe-commits
ldionne created this revision.
ldionne added reviewers: EricWF, vsapsai.
Herald added subscribers: cfe-commits, dexonsmith, christof.

The aligned allocation and deallocation functions were added in the dylib
in Mac OSX 10.13. This commit does two things: first, it adds availability
markup to those functions such that clients targetting older OSes get a
compiler error instead of a link error if they try to use these functions.

Secondly, it makes sure that the library itself does not use these functions
when targetting older OSes.

rdar://problem/34223934
rdar://problem/42826941


Repository:
  rCXX libc++

https://reviews.llvm.org/D50205

Files:
  libcxx/include/__config
  libcxx/include/memory
  libcxx/include/new
  
libcxx/test/libcxx/language.support/support.dynamic/new_faligned_allocation.sh.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
  
libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
  libcxx/test/support/test_macros.h

Index: libcxx/test/support/test_macros.h
===
--- libcxx/test/support/test_macros.h
+++ libcxx/test/support/test_macros.h
@@ -182,7 +182,7 @@
 #define TEST_NORETURN [[noreturn]]
 #endif
 
-#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || \
+#if defined(_LIBCPP_DONT_USE_ALIGNED_ALLOCATION) || \
   (!(TEST_STD_VER > 14 || \
 (defined(__cpp_aligned_new) && __cpp_aligned_new >= 201606L)))
 #define TEST_HAS_NO_ALIGNED_ALLOCATION
Index: libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
===
--- libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
+++ libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp
@@ -13,6 +13,13 @@
 // NOTE: GCC doesn't provide a -faligned-allocation flag
 // XFAIL: no-aligned-allocation && !gcc
 
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
 // test operator new replacement
 
 #include 
Index: libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
===
--- libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
+++ libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp
@@ -17,6 +17,13 @@
 // XFAIL: with_system_cxx_lib=macosx10.7
 // XFAIL: with_system_cxx_lib=macosx10.8
 
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
 // NOTE: gcc doesn't provide -faligned-allocation flag to test for
 // XFAIL: no-aligned-allocation && !gcc
 
Index: libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
===
--- libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
+++ libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow.pass.cpp
@@ -16,6 +16,13 @@
 // XFAIL: with_system_cxx_lib=macosx10.7
 // XFAIL: with_system_cxx_lib=macosx10.8
 
+// XFAIL: availability=macosx10.12
+// XFAIL: availability=macosx10.11
+// XFAIL: availability=macosx10.10
+// XFAIL: availability=macosx10.9
+// XFAIL: availability=macosx10.8
+// XFAIL: availability=macosx10.7
+
 // asan and msan will not call the new handler.
 // UNSUPPORTED: sanitizer-new-delete
 
Index: