bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 04/11] math: better 'inline'


From: Paul Eggert
Subject: [PATCH 04/11] math: better 'inline'
Date: Mon, 29 Oct 2012 00:15:16 -0700
User-agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1

* 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.
---
 ChangeLog     | 11 +++++++++++
 lib/math.c    |  3 +++
 lib/math.in.h | 13 +++++++++----
 m4/math_h.m4  |  3 +--
 modules/math  |  3 +++
 5 files changed, 27 insertions(+), 6 deletions(-)
 create mode 100644 lib/math.c

diff --git a/ChangeLog b/ChangeLog
index eae370e..5ffa31d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2012-10-28  Paul Eggert  <address@hidden>
 
+       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 0000000..ddb2ded
--- /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 0625777..252e205 100644
--- a/lib/math.in.h
+++ b/lib/math.in.h
@@ -28,6 +28,10 @@
 #ifndef address@hidden@_MATH_H
 #define address@hidden@_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 /* address@hidden@_MATH_H */
 #endif /* address@hidden@_MATH_H */
diff --git a/m4/math_h.m4 b/m4/math_h.m4
index 90d248a..338e80d 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(address@hidden:@include <math.h>]],
diff --git a/modules/math b/modules/math
index 57f223e..6f924fd 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.
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]