llvm-project/libcxx/test/std/depr
Eric Fiselier 1670772adc Fix implementation of ::abs and std::abs LWG 2192.
Summary:
All overloads of `::abs` and `std::abs` must be present in both `<cmath>` and `<cstdlib>`. This is problematic to implement because C defines `fabs` in `math.h` and `labs` in `stdlib.h`. This introduces a circular dependency between the two headers. 

This patch implements that requirement by moving `abs` into `math.h` and making `stdlib.h` include `math.h`. In order to get the underlying C declarations from the "real" `stdlib.h` inside our `math.h` we need some trickery. Specifically we need to make `stdlib.h` include next itself.

Suggestions for a cleaner implementation are welcome.

Reviewers: mclow.lists, ldionne

Reviewed By: ldionne

Subscribers: krytarowski, fedor.sergeev, dexonsmith, jdoerfert, jsji, libcxx-commits

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

llvm-svn: 359020
2019-04-23 18:01:58 +00:00
..
depr.auto.ptr [libc++] Enable deprecation warnings by default 2019-03-12 20:10:06 +00:00
depr.c.headers Fix implementation of ::abs and std::abs LWG 2192. 2019-04-23 18:01:58 +00:00
depr.function.objects [libc++] Enable deprecation warnings by default 2019-03-12 20:10:06 +00:00
depr.ios.members Support tests in freestanding 2019-02-04 20:31:13 +00:00
depr.lib.binders [libc++] Enable deprecation warnings by default 2019-03-12 20:10:06 +00:00
depr.str.strstreams Support tests in freestanding 2019-02-04 20:31:13 +00:00
exception.unexpected Support tests in freestanding 2019-02-04 20:31:13 +00:00
nothing_to_do.pass.cpp Support tests in freestanding 2019-02-04 20:31:13 +00:00