[PATCH] D23926: [libcxx] Don't use C99 math ops in -std=c++03 mode
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 5 12:33:57 PDT 2016
EricWF added a comment.
In https://reviews.llvm.org/D23926#531226, @rmaprath wrote:
> Simplified the patch a little bit more.
> Now, library vendors should be able to define `_LIBCPP_STRICT_C99_COMPATIBILITY` and `libc++` will not use/test C99 math functions in `C++03/98` modes. Currently it's only the math functions, we can extend this approach to other affected areas if the approach is OK. Not 100% sure about the namings, can change them as needed.
> @EricWF: Gentle ping.
Currently we rely on C++11, C99, BSD, XOPEN, and GNU extensions in all dialects in the headers. We have to do so to safely and correctly implement locales and IO. In order to support this clang++ and g++ explicitly enable the C99 standard library by defining `-D_GNU_SOURCE` in the driver (Heres a 10yo libstdc++ bug about it <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11196>).
"strict C95 compatibly" is not a feature for our C++ users. If your C library support C99 you should enable it, not make libc++ conforming. If we have to disable a couple of `<math.h>` functions to make that work that's OK. However I view that as a defect not a feature.
Comment at: test/std/depr/depr.c.headers/math_h.pass.cpp:753
@@ -752,1 +752,3 @@
Tests should be as portable as across standard libraries and not enabled by libc++ specific macros.
Disabling tests is OK though. ex `#ifndef _LIBCPP_HAS_NO_C99_MATH`.
More information about the cfe-commits