Continuing from r229281, this adds version guards and test cases.
Details
Diff Detail
Event Timeline
Remove the _LIBCPP_BUILDING_NEW guard. If people want the useless C++14 declarations, they can build in C++14 mode...
src/new.cpp | ||
---|---|---|
134 | Remove this #if/#endif pair and define the weak version unconditionally. The contents of the standard library should not depend on the -std= flag passed when bulding it. Because this function is weak, this won't break valid C++11 and earlier code that happens to be defining such a function. | |
164 | Likewise. | |
test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array.pass.cpp | ||
54 | This is not guaranteed to work; your calls to operator new and operator delete are elidable. Directly call operator delete here. (That also lets you run this test in all language modes, not just C++14 mode.) | |
test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_nothrow.pass.cpp | ||
30 | It's questionable to assume that memory allocated by libc++'s operator new can be freed by std::free. I would suggest either replacing operator new[] too, or just leaking the memory. |
src/new.cpp | ||
---|---|---|
134 | Exactly correct. There should be no requirement to coordinate the -std= flag used to build the library and the flag used to build programs that use the library. | |
test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_nothrow.pass.cpp | ||
30 | I would prefer replacing operator new[] as well. | |
49 | Shouldn't this be A* ap = new (std::nothrow) A [3]; ?? |
I am uploading an update in a few minutes...
src/new.cpp | ||
---|---|---|
134 | Done. | |
134 | Ok. | |
164 | Done. | |
test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array.pass.cpp | ||
54 | Ok, on the extension of the test in all language modes. This incidentally highlights something we may have missed in the standard on sized nothrow deallocation (see FIXMEs on related test cases below). | |
test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_nothrow.pass.cpp | ||
30 | For the reasons I gave above, I would rather provide a new handler, similarly to the current tests' design, than replace new. | |
49 | Right. I find it strange that the libcxx test system did not catch this error, and several others below. I actually took a closer and replaced the value of 'config.std' in my test/lit.site.cfg file from "c++11" to "c++1y". Failing Tests (11): libc++ :: std/experimental/string.view/string.view.find/find_last_not_of_char_size.pass.cpp libc++ :: std/experimental/string.view/string.view.find/find_last_not_of_pointer_size.pass.cpp libc++ :: std/experimental/string.view/string.view.find/find_last_not_of_pointer_size_size.pass.cpp libc++ :: std/experimental/string.view/string.view.find/find_last_of_pointer_size.pass.cpp libc++ :: std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp libc++ :: std/experimental/string.view/string.view.find/rfind_pointer_size.pass.cpp libc++ :: std/experimental/string.view/string.view.find/rfind_pointer_size_size.pass.cpp libc++ :: std/experimental/string.view/string.view.find/rfind_string_view_size.pass.cpp libc++ :: std/experimental/string.view/string.view.ops/compare.pointer_size.pass.cpp libc++ :: std/experimental/string.view/string.view.ops/compare.size_size_sv_pointer_size.pass.cpp libc++ :: std/experimental/utilities/time/header.chrono.synop/treat_as_floating_point_v.pass.cpp |
I need to push this in for now, for some time-pressing tests.
This should be safe since it is passing all regression tests and not breaking anything.
We can always roll back later if anything else comes up.
Remove this #if/#endif pair and define the weak version unconditionally. The contents of the standard library should not depend on the -std= flag passed when bulding it. Because this function is weak, this won't break valid C++11 and earlier code that happens to be defining such a function.