summaryrefslogtreecommitdiff
path: root/libgcompat/math.c
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-01-14 18:40:59 -0600
committerSamuel Holland <samuel@sholland.org>2018-01-14 18:57:52 -0600
commitdfafb0735f09d65a392d03a2d1ad3d0b934981da (patch)
treef5a1c49f22df2e72494cd114785763b111d6924a /libgcompat/math.c
parentd40369b0e09e4e2228ebff305067ec2d99220848 (diff)
downloadgcompat-dfafb0735f09d65a392d03a2d1ad3d0b934981da.tar.gz
gcompat-dfafb0735f09d65a392d03a2d1ad3d0b934981da.tar.bz2
gcompat-dfafb0735f09d65a392d03a2d1ad3d0b934981da.tar.xz
gcompat-dfafb0735f09d65a392d03a2d1ad3d0b934981da.zip
libgcompat: Add and use a macro for defining symbol aliases
* Prefer providing the underscore-prefixed symbol as the strong definition. * Do not use a weak alias if the alias is also underscore-prefixed. * Make libgcompat objects depend on the new header. [NOTE: I originally took the weak_alias macro from musl's libc.h, but it's trivial and the same pattern already in use. If desired, I can add the musl copyright notice.] Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'libgcompat/math.c')
-rw-r--r--libgcompat/math.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libgcompat/math.c b/libgcompat/math.c
index 42ed032..2982116 100644
--- a/libgcompat/math.c
+++ b/libgcompat/math.c
@@ -1,26 +1,27 @@
#include <math.h> /* isinf, isnan */
+#include "alias.h" /* weak_alias */
+
int __isinff(float number)
{
return isinf(number);
}
+weak_alias(__isinff, isinff);
int __isinf(double number)
{
return isinf(number);
}
+weak_alias(__isinf, isinf);
int __isnanf(float number)
{
return isnan(number);
}
+weak_alias(__isnanf, isnanf);
int __isnan(double number)
{
return isnan(number);
}
-
-extern __typeof(__isnanf) isnanf __attribute__((weak, alias("__isnanf")));
-extern __typeof(__isnan) isnan __attribute__((weak, alias("__isnan")));
-extern __typeof(__isinff) isinff __attribute__((weak, alias("__isinff")));
-extern __typeof(__isinf) isinf __attribute__((weak, alias("__isinf")));
+weak_alias(__isnan, isnan);