[libcxx-commits] [PATCH] D134938: [libc++] Add option to disable long double math support in libc++

Michael Platings via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 29 22:54:17 PDT 2022


michaelplatings created this revision.
michaelplatings added a reviewer: ldionne.
michaelplatings added a project: libc++.
Herald added a project: All.
michaelplatings requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Some platforms do not support the C library long double math functions. For example Newlib [1].

It makes sense for libc++ to work properly on those platforms, so this change adds a carve-out of functionality for long double math, enabled via a LIBCXX_ENABLE_LONG_DOUBLE_MATH CMake option.

I also considered adding an option to disable long double support entirely (not just math) but this doesn't work well since certain parts of the C++ library are defined in terms of long double and no other numeric type e.g. get_money. Therefore limiting the scope of the option to math.h and cmath seems to be the pragmatic option.

Inspired by https://reviews.llvm.org/D111265

[1] https://github.com/mirror/newlib-cygwin/blob/58e981a5a42cd46ff52591d0394deeea9d3f01f0/newlib/libc/include/math.h#L443


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134938

Files:
  libcxx/CMakeLists.txt
  libcxx/docs/BuildingLibcxx.rst
  libcxx/include/__config_site.in
  libcxx/include/cmath
  libcxx/include/math.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134938.464141.patch
Type: text/x-patch
Size: 27665 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220930/a1956103/attachment-0001.bin>


More information about the libcxx-commits mailing list