Commit graph

25 commits

Author SHA1 Message Date
Elliott Hughes
655e430b28 Remove the always-true __INTRODUCED_IN() annotations.
The NDK no longer supports API levels earlier than 21.

This *doesn't* include <ctype.h> because I have a separate change
rewriting that (that's blocked on the upcoming libc++ update).

Test: treehugger
Change-Id: I53e915f27011dfc0513e0c78d8799377e183ceca
2023-06-16 12:39:33 -07:00
Elliott Hughes
ab2d3e1049 Remove __RENAME_LDBL.
Discussion of this during my recent minor cleanup convinced me that we
should just remove __RENAME_LDBL. There's no obvious benefit to being
able to build something for 32-bit if you can't build the same code for
64-bit, given that most new hardware (and entire verticals such as Auto)
are 64-bit-only, and the Play Store requires any app with 32-bit code to
also ship 64-bit code.

Test: treehugger
Change-Id: I1c5503b968ca66925d7bd125bd3630c41ec1bfd0
2023-06-07 17:20:53 +00:00
Elliott Hughes
e17ebfd51a <math.h>: more use of __RENAME_LDBL.
Now the NDK doesn't support API levels below 21, we don't actually need
weird x86-specific annotations. In general we haven't been removing
this historical information because it might be interesting to someone,
and there's no real reason to remove it, but we've had versioner bugs
recently with these more complex cases.

Test: treehugger
Change-Id: Ia457bb338ecf55af8e319e411ec3bf48a03f3c03
2023-05-26 13:00:51 -07:00
zijunzhao
195b90b83f Nullability check for math module
Bugs: b/245972273
Test: adb shell
Change-Id: I46bf02e1ed3d6e6143c780e30f95fa3af2745216
2023-02-09 00:25:29 +00:00
Dan Albert
eae41f8eeb Fix __VERSIONER_NO_GUARD cases for availability.
libc++ still depends on these being declared even if they are
unavailable. This results in a worse error message (a link error
rather than a compiler diagnostic) if these functions end up being
used, but without the decl headers like libc++'s math.h can't be
included because it refers to an undeclared function.

For the cases where weak symbols aren't being used, don't annotate
these functions with their availability information.

Also need to avoid using __builtin_available for this case because the
NDK doesn't have __isOSVersionAtLeast yet.

__ANDROID_UNGUARDED_AVAILABILITY__ is being used as a proxy for
"building for the NDK" here because we don't have a good signal for
that which works for both the NDK proper and the NDK-in-the-platform
case.

Test: imported into the NDK, built and tested NDK
Bug: None
Change-Id: I9ef3e19a8fa083bca0be47b80dfef7ba52a94866
2021-02-01 12:53:22 -08:00
Elliott Hughes
fee514e714 Make it clearer that math.h isn't fdlibm.
It was originally based on fdlibm, but it's been through two different
projects since then, and `git blame` shows basically nothing remaining
from those days. Seems worth leaving something to explain the unusual
copyright header though!

Test: treehugger
Change-Id: I8e7252a755704b866e7f36c8e97adc021fa3cdad
2020-09-17 11:57:50 -07:00
Elliott Hughes
f106a391d3 Remove __INTRODUCED_IN for obsolete API levels.
The NDK only supports >= 16, so remove anything older than that to avoid
giving the misleading impression that such old targets are still
supported.

(This change doesn't touch <unistd.h>. I'll follow up with that once the
outstanding FORTIFY changes to that file are in.)

Test: builds
Change-Id: I6cc6ecdb99fe228a4afa71f78e5fd45309ba9786
2019-10-03 16:09:04 -07:00
Elliott Hughes
ab52807685 Update to FreeBSD libm r336665.
This reverts commit 253a830631 and moves
us forward to a revision that contains fixes for the problem with the
previous attempt.

This also makes sincos(3)/sincosf(3)/sincosl(3) available to `_BSD_SOURCE`
as well as `_GNU_SOURCE`.

The new FreeBSD libm code requires the FreeBSD `__CONCAT` macro, and all
our existing callers are FreeBSD too, so update that.

There's also an assumption that <complex.h> drags in <math.h> which isn't
true for us, so work around that with `-include` in the makefile. This
then causes clang to recognize a bug -- returning from a void function --
in our fake (LP32) sincosl(3), so fix that too.

Bug: http://b/111710419
Change-Id: I84703ad844f8afde6ec6b11604ab3c096ccb62c3
Test: ran tests
2018-07-24 10:36:00 -07:00
Elliott Hughes
5c6a7bf0dc Remove some legacy declarations from <math.h>.
These are still needed for backwards compatibility with code built by old
versions of the NDK, but we don't need to pollute the headers with them.

Also lose the hand-written code for these. The compiler-generated code
is either the same or better, and no new code is calling these functions
anyway.

Bug: N/A
Test: ran tests
Change-Id: Ib01ad9805034433e0105aec882608cc8e6526f78
2017-10-19 14:15:31 -07:00
Elliott Hughes
d6541c2a97 Make <math.h> renames compatible with GCC.
GCC is fussy about the order in which attributes and renames occur.

Bug: N/A
Test: builds
Change-Id: Icee5ec00aa4626ddad0d89d2d7cee5ec6891c368
2017-09-18 16:22:32 -07:00
Elliott Hughes
50cda38f1d Use __RENAME for long double functions.
We can cut a lot of stuff out of the NDK's libandroid_support with this,
and reduce unnecessary relocations for all LP32 code. LP64 code should
be unaffected.

Bug: https://issuetracker.google.com/64450768
Bug: https://github.com/android-ndk/ndk/issues/507
Test: ran tests, plus manual readelf on the _test.o files
Change-Id: I3de6015921195304ea9c829ef31665cd34664066
2017-09-14 16:10:43 -07:00
Elliott Hughes
684c31a267 Name function arguments in libc headers for Studio.
Third batch of headers...

Bug: http://b/64613623
Test: builds
Change-Id: I32d8467a0bd22ba94d76476397f4f7dc51003886
2017-08-18 15:07:41 -07:00
Dan Albert
284c8f1baf Revert "isnan and isinf aren't functions."
While this change is correct, GNU libstdc++ 4.9 isn't able to handle a
standard compliant C library. Its <cmath> will `#undef isnan` from
math.h and only adds the function overloads to the std namespace,
making it impossible to use both <cmath> (which gets included by a
lot of other standard headers) and ::isnan.

We're going to have to revert this until we can start turning down
support for gnustl.

This reverts commit e76ee993ff.

Bug: https://code.google.com/p/android/issues/detail?id=271629
Test: make checkbuild
Change-Id: I394f50271430e78ab801d85c3ee4e87019eda6af
2017-03-30 17:18:31 -07:00
Elliott Hughes
e76ee993ff isnan and isinf aren't functions.
isnan was a function in POSIX in 1997, but changed to a macro only in 2004
to align with the C standard. isinf wasn't in POSIX until 2004, where it
appeared as a macro only (but other C libraries already had it as a
function).

Now the C++ standard has added ::isnan and ::isinf functions with different
signatures from the historical ones, so we need to move our historical cruft
out of the way.

We'll keep the implementations for backwards compatibility.

Bug: http://b/34724220
Test: ran tests
Change-Id: Id665f0344af6fe6ed245106e60231f4ef2027f41
2017-02-02 14:02:49 -08:00
Elliott Hughes
95fa061678 Rename __pure, __pure2, and __purefunc.
These names were pretty misleading (aka "backwards"), so switch to the
same obvious names glibc uses.

Test: build.
Change-Id: Ia98c9dbbccd0820386116562347654e84669034a
2016-09-28 12:36:38 -07:00
Dan Albert
31d7037f2a Expose some more function decls.
Test: make checkbuild tests # for x86-eng this time
Bug: http://b/30465923
Change-Id: I98c5a8d09463e85ac22b05035c87edab04eaa200
2016-09-13 14:16:14 -07:00
Dan Albert
cb0b14385b Provide fake definitions for libstdc++.
libstdc++ needs to be able to `using ::foo` these in the various C++
wrapper headers for the C library. The NDK long ago added fake
definitions. We need to keep the same.

Test: make checkbuild
Bug: http://b/30465923
Change-Id: Id513b72a59eafcc823080631e07b21290d5e3b24
2016-09-08 16:13:28 -07:00
Elliott Hughes
c1929e4452 Move some POSIX math functions out of _USE_GNU/_USE_BSD.
The signgam global and the j0/j1/jn and y0/y1/yn functions are POSIX.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html

Change-Id: I802997a2060a011a777c2b641f28c1d58dfe49ed
2016-08-12 16:25:40 -07:00
Elliott Hughes
9c8d711aa5 Don't expose all BSD extensions.
Just expose the ones that bionic historically leaked.

Also, many of the M_* constants in <math.h> are actually POSIX.

Change-Id: I6275df84c5866b872b71f1c8ed14e2aada12b793
2016-06-13 14:14:43 -07:00
Elliott Hughes
3ba55f8022 Rationalize visibility.
If it's C or POSIX, it's in. If it's BSD or GNU, it's guarded by __USE_BSD
or __USE_GNU.

Bug: https://code.google.com/p/android/issues/detail?id=194631
Change-Id: Ife51a21c2b37b060db56780d29c929805b199cb6
2016-06-09 17:40:19 -07:00
Josh Gao
46b44160e9 Update header versions for NDK platform fixes.
Bug: http://b/28178111
Change-Id: Icd638673b409aa43a91490f77c6b4d79c9ea20d9
2016-06-02 13:40:35 -07:00
Josh Gao
d51bc71294 Add platform specific version tags.
Some functions were added at different times on different platforms.
This should hopefully get most of them.

Bug: http://b/28178111
Change-Id: I85fdf92779a2f3277e9b537c6bfc7216790c607a
2016-04-29 16:39:50 -07:00
Josh Gao
14adff1cfa Add versioning information to symbols.
Bug: http://b/28178111
Change-Id: I46bf95accd819f4521afb1173d8badcc5e9df31c
2016-04-29 16:39:50 -07:00
Josh Gao
a588f905ab Remove fabs, fabsf, fabsl inlines from <math.h>.
These inline definitions appear to be a workaround for a compiler bug
that either never existed, or has been resolved since then.

Bug: http://b/28067717
Change-Id: Ic1cd0f26403f234a6ab1fa273a9dd23e7f9fee8f
2016-04-08 21:09:52 +00:00
Elliott Hughes
afe835d540 Move math headers in with the other headers.
Keeping them separate is a pain for the NDK, and doesn't help the platform.

Change-Id: I96b8beef307d4a956e9c0a899ad9315adc502582
2016-04-02 08:36:33 -07:00
Renamed from libm/include/math.h (Browse further)