OSDN Git Service

test: Fix math .c dependency
[uclinux-h8/uClibc.git] / include / math.h
index 0060d77..ecb9aa6 100644 (file)
@@ -14,9 +14,8 @@
    Lesser General Public License for more details.
 
    You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 /*
  *     ISO C99 Standard: 7.12 Mathematics      <math.h>
@@ -53,49 +52,49 @@ __BEGIN_DECLS
    and can declare the float versions `namef' and `__namef'.  */
 
 #define __MATHDECL_1(type,function,suffix,args) \
-  extern type __MATH_PRECNAME(function,suffix) args __THROW
+       extern type __MATH_PRECNAME(function,suffix) args __THROW
 
 #define __MATHDECL(type,function,suffix,args) \
-  __MATHDECL_1(type,function,suffix,args);
+       __MATHDECL_1(type,function,suffix,args);
 
-#define __MATHCALL(function,suffix,args)       \
-  __MATHDECL(_Mdouble_,function,suffix,args)
+#define __MATHCALL(function,suffix,args) \
+       __MATHDECL(_Mdouble_,function,suffix,args)
 
 #define __MATHDECLX(type,function,suffix,args,attrib) \
-  __MATHDECL_1(type,function,suffix,args) __attribute__ (attrib); \
-  __MATHDECLI_MAINVARIANT(function)
+       __MATHDECL_1(type,function,suffix,args) __attribute__ (attrib); \
+       __MATH_maybe_libm_hidden_proto(function)
 
-#define __MATHCALLX(function,suffix,args,attrib)       \
-  __MATHDECLX(_Mdouble_,function,suffix,args,attrib)
+#define __MATHCALLX(function,suffix,args,attrib) \
+       __MATHDECLX(_Mdouble_,function,suffix,args,attrib)
 
 /* Decls which are also used internally in libm.
    Only the main variant is used internally, no need to try to avoid relocs
    for the {l,f} variants.  */
 #define __MATHDECLI(type,function,suffix,args) \
-  __MATHDECL_1(type,function,suffix,args); \
-  __MATHDECLI_MAINVARIANT(function)
+       __MATHDECL_1(type,function,suffix,args); \
+       __MATH_maybe_libm_hidden_proto(function)
 
-#define __MATHCALLI(function,suffix,args)      \
-  __MATHDECLI(_Mdouble_,function,suffix,args)
+#define __MATHCALLI(function,suffix,args) \
+       __MATHDECLI(_Mdouble_,function,suffix,args)
 
 /* Private helpers for purely macro impls below.
    Only make __foo{,f,l} visible but not (the macro-only) foo.  */
 #if defined _LIBC
 # define __MATHDECL_PRIV(type,function,suffix,args,attrib) \
-  __MATHDECL_1(type,__CONCAT(__,function),suffix,args) __attribute__ (attrib); \
-  libm_hidden_proto(__MATH_PRECNAME(__##function,suffix))
+       __MATHDECL_1(type,__CONCAT(__,function),suffix,args) __attribute__ (attrib); \
+       libm_hidden_proto(__MATH_PRECNAME(__##function,suffix))
 #else
 # define __MATHDECL_PRIV(type,function,suffix,args,attrib) \
-  __MATHDECL_1(type,__CONCAT(__,function),suffix,args) __attribute__ (attrib);
+       __MATHDECL_1(type,__CONCAT(__,function),suffix,args) __attribute__ (attrib);
 #endif
 
 
-/* Include the file of declarations, declaring souble versions */
+/* Include the file of declarations, declaring double versions */
 
 #if defined _LIBC
-# define __MATHDECLI_MAINVARIANT(x) libm_hidden_proto(x)
+# define __MATH_maybe_libm_hidden_proto(x) libm_hidden_proto(x)
 #else
-# define __MATHDECLI_MAINVARIANT(x)
+# define __MATH_maybe_libm_hidden_proto(x)
 #endif
 #define _Mdouble_               double
 #define __MATH_PRECNAME(name,r)  __CONCAT(name,r)
@@ -106,8 +105,7 @@ __BEGIN_DECLS
 #undef _Mdouble_BEGIN_NAMESPACE
 #undef _Mdouble_END_NAMESPACE
 #undef __MATH_PRECNAME
-#undef __MATHDECLI_MAINVARIANT
-#define __MATHDECLI_MAINVARIANT(x)
+#undef __MATH_maybe_libm_hidden_proto
 
 
 #if defined __USE_MISC || defined __USE_ISOC99
@@ -115,6 +113,7 @@ __BEGIN_DECLS
 /* Include the file of declarations again, this time using `float'
    instead of `double' and appending f to each function name.  */
 
+# define __MATH_maybe_libm_hidden_proto(x)
 # ifndef _Mfloat_
 #  define _Mfloat_             float
 # endif
@@ -131,24 +130,23 @@ __BEGIN_DECLS
 # undef _Mdouble_BEGIN_NAMESPACE
 # undef _Mdouble_END_NAMESPACE
 # undef        __MATH_PRECNAME
+# undef __MATH_maybe_libm_hidden_proto
 
 
 # if (defined __STDC__ || defined __GNUC__) \
-     && (defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ || defined __LDBL_COMPAT)
+     && (!defined __NO_LONG_DOUBLE_MATH || defined __LDBL_COMPAT)
 #  ifdef __LDBL_COMPAT
 
 #   ifdef __USE_ISOC99
-extern float __nldbl_nexttowardf (float __x, long double __y)
-                                 __THROW __attribute__ ((__const__));
+extern float __nldbl_nexttowardf (float __x, long double __y) __THROW
+                       __attribute__ ((__const__));
 #    ifdef __REDIRECT_NTH
-extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y),
-                            __nldbl_nexttowardf)
-     __attribute__ ((__const__));
-extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
-                             nextafter) __attribute__ ((__const__));
-extern long double __REDIRECT_NTH (nexttowardl,
-                                  (long double __x, long double __y),
-                                  nextafter) __attribute__ ((__const__));
+extern float __REDIRECT_NTH (nexttowardf, (float __x, long double __y), __nldbl_nexttowardf)
+                       __attribute__ ((__const__));
+extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y), nextafter)
+                       __attribute__ ((__const__));
+extern long double __REDIRECT_NTH (nexttowardl, (long double __x, long double __y), nextafter)
+                       __attribute__ ((__const__));
 #    endif
 #   endif
 
@@ -157,11 +155,12 @@ extern long double __REDIRECT_NTH (nexttowardl,
 
 #   undef __MATHDECL_1
 #   define __MATHDECL_2(type,function,suffix,args,alias) \
-  extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix),args,alias)
+       extern type __REDIRECT_NTH(__MATH_PRECNAME(function,suffix),args,alias)
 #   define __MATHDECL_1(type,function,suffix,args) \
-  __MATHDECL_2(type,function,suffix,args,__CONCAT(function,suffix))
+       __MATHDECL_2(type,function,suffix,args,__CONCAT(function,suffix))
 #  endif
 
+#  define __MATH_maybe_libm_hidden_proto(x)
 #  ifndef _Mlong_double_
 #   define _Mlong_double_      long double
 #  endif
@@ -178,6 +177,7 @@ extern long double __REDIRECT_NTH (nexttowardl,
 #  undef _Mdouble_BEGIN_NAMESPACE
 #  undef _Mdouble_END_NAMESPACE
 #  undef __MATH_PRECNAME
+#  undef __MATH_maybe_libm_hidden_proto
 
 # endif /* __STDC__ || __GNUC__ */
 
@@ -190,7 +190,6 @@ extern long double __REDIRECT_NTH (nexttowardl,
 #if defined __USE_MISC || defined __USE_XOPEN
 /* This variable is used by `gamma' and `lgamma'.  */
 extern int signgam;
-libm_hidden_proto(signgam)
 #endif
 
 
@@ -246,7 +245,7 @@ enum
   };
 
 /* Return number of classification appropriate for X.  */
-# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
+# ifdef __NO_LONG_DOUBLE_MATH
 #  define fpclassify(x) \
      (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassify (x))
 # else
@@ -258,7 +257,7 @@ enum
 # endif
 
 /* Return nonzero value if sign of X is negative.  */
-# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
+# ifdef __NO_LONG_DOUBLE_MATH
 #  define signbit(x) \
      (sizeof (x) == sizeof (float) ? __signbitf (x) : __signbit (x))
 # else
@@ -270,7 +269,7 @@ enum
 # endif
 
 /* Return nonzero value if X is not +-Inf or NaN.  */
-# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
+# ifdef __NO_LONG_DOUBLE_MATH
 #  define isfinite(x) \
      (sizeof (x) == sizeof (float) ? __finitef (x) : __finite (x))
 # else
@@ -286,7 +285,7 @@ enum
 
 /* Return nonzero value if X is a NaN.  We could use `fpclassify' but
    we already have this functions `__isnan' and it is faster.  */
-# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
+# ifdef __NO_LONG_DOUBLE_MATH
 #  define isnan(x) \
      (sizeof (x) == sizeof (float) ? __isnanf (x) : __isnan (x))
 # else
@@ -298,7 +297,7 @@ enum
 # endif
 
 /* Return nonzero value is X is positive or negative infinity.  */
-# ifndef __UCLIBC_HAS_LONG_DOUBLE_MATH__
+# ifdef __NO_LONG_DOUBLE_MATH
 #  define isinf(x) \
      (sizeof (x) == sizeof (float) ? __isinff (x) : __isinf (x))
 # else
@@ -374,8 +373,10 @@ extern int matherr (struct exception *__exc);
 #else  /* !SVID */
 
 # ifdef __USE_XOPEN
+#  ifdef __UCLIBC_SUSV4_LEGACY__
 /* X/Open wants another strange constant.  */
 #  define MAXFLOAT     3.40282347e+38F
+#  endif
 # endif
 
 #endif /* SVID */