summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog11
-rw-r--r--lib/math.c3
-rw-r--r--lib/math.in.h13
-rw-r--r--m4/math_h.m43
-rw-r--r--modules/math3
5 files changed, 27 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 409c074fcb..6a8732d7be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2012-11-29 Paul Eggert <eggert@cs.ucla.edu>
+ math: better 'inline'
+ * lib/math.c: New file.
+ * lib/math.in.h (_GL_MATH_INLINE):
+ New macro. Replace all uses of 'static inline' with it.
+ Use _GL_INLINE_HEADER_BEGIN, _GL_INLINE_HEADER_END.
+ * m4/math_h.m4 (gl_MATH_H):
+ Do not require AC_C_INLINE.
+ * modules/math (Files, lib_SOURCES):
+ Add lib/math.c.
+ (Depends-on): Add extern-inline.
+
count-one-bits: better 'inline'
* lib/count-one-bits.c: New file.
* lib/count-one-bits.h (COUNT_ONE_BITS_INLINE):
diff --git a/lib/math.c b/lib/math.c
new file mode 100644
index 0000000000..ddb2ded530
--- /dev/null
+++ b/lib/math.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_MATH_INLINE _GL_EXTERN_INLINE
+#include "math.h"
diff --git a/lib/math.in.h b/lib/math.in.h
index 0625777acc..252e205340 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -28,6 +28,10 @@
#ifndef _@GUARD_PREFIX@_MATH_H
#define _@GUARD_PREFIX@_MATH_H
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_MATH_INLINE
+# define _GL_MATH_INLINE _GL_INLINE
+#endif
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
@@ -78,17 +82,17 @@ func (long double l) \
classification macros with an argument of real-floating (that is,
one of float, double, or long double). */
#define _GL_WARN_REAL_FLOATING_DECL(func) \
-static inline int \
+_GL_MATH_INLINE int \
rpl_ ## func ## f (float f) \
{ \
return func (f); \
} \
-static inline int \
+_GL_MATH_INLINE int \
rpl_ ## func ## d (double d) \
{ \
return func (d); \
} \
-static inline int \
+_GL_MATH_INLINE int \
rpl_ ## func ## l (long double l) \
{ \
return func (l); \
@@ -124,7 +128,7 @@ static void (*_gl_math_fix_itold) (long double *, int) = _Qp_itoq;
/* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler
choke on the expression 0.0 / 0.0. */
# if defined __DECC || defined _MSC_VER
-static float
+_GL_MATH_INLINE float
_NaN ()
{
static float zero = 0.0f;
@@ -2265,6 +2269,7 @@ _GL_WARN_REAL_FLOATING_DECL (signbit);
# endif
#endif
+_GL_INLINE_HEADER_END
#endif /* _@GUARD_PREFIX@_MATH_H */
#endif /* _@GUARD_PREFIX@_MATH_H */
diff --git a/m4/math_h.m4 b/m4/math_h.m4
index 90d248aecc..338e80dd15 100644
--- a/m4/math_h.m4
+++ b/m4/math_h.m4
@@ -1,4 +1,4 @@
-# math_h.m4 serial 113
+# math_h.m4 serial 114
dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -8,7 +8,6 @@ AC_DEFUN([gl_MATH_H],
[
AC_REQUIRE([gl_MATH_H_DEFAULTS])
gl_CHECK_NEXT_HEADERS([math.h])
- AC_REQUIRE([AC_C_INLINE])
AC_CACHE_CHECK([whether NAN macro works], [gl_cv_header_math_nan_works],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <math.h>]],
diff --git a/modules/math b/modules/math
index 57f223e1d2..6f924fd053 100644
--- a/modules/math
+++ b/modules/math
@@ -3,9 +3,11 @@ A GNU-like <math.h>.
Files:
lib/math.in.h
+lib/math.c
m4/math_h.m4
Depends-on:
+extern-inline
include_next
snippet/arg-nonnull
snippet/c++defs
@@ -17,6 +19,7 @@ gl_MATH_H
Makefile.am:
BUILT_SOURCES += math.h
+lib_SOURCES += math.c
# We need the following in order to create <math.h> when the system
# doesn't have one that works with the given compiler.