Browse Source

math.h: fix libm_hidden_proto leak into sanitized headers
libm/s_nextafterf.c: use /* */ comments

Denis Vlasenko 16 years ago
parent
commit
44d44d807e
2 changed files with 27 additions and 20 deletions
  1. 23 16
      include/math.h
  2. 4 4
      libm/s_nextafterf.c

+ 23 - 16
include/math.h

@@ -46,9 +46,6 @@ __BEGIN_DECLS
 /* Get general and ISO C99 specific information.  */
 /* Get general and ISO C99 specific information.  */
 #include <bits/mathdef.h>
 #include <bits/mathdef.h>
 
 
-#if !(defined _LIBC && (defined NOT_IN_libc && defined IS_IN_libm))
-# define libm_hidden_proto(name, attrs...)
-#endif
 
 
 /* The file <bits/mathcalls.h> contains the prototypes for all the
 /* The file <bits/mathcalls.h> contains the prototypes for all the
    actual math functions.  These macros are used for those prototypes,
    actual math functions.  These macros are used for those prototypes,
@@ -59,13 +56,15 @@ __BEGIN_DECLS
   __MATHDECL (_Mdouble_,function,suffix, args)
   __MATHDECL (_Mdouble_,function,suffix, args)
 #define __MATHDECL(type, function,suffix, args) \
 #define __MATHDECL(type, function,suffix, args) \
   __MATHDECL_1(type, function,suffix, args);
   __MATHDECL_1(type, function,suffix, args);
+
 #define __MATHCALLX(function,suffix, args, attrib)	\
 #define __MATHCALLX(function,suffix, args, attrib)	\
   __MATHDECLX (_Mdouble_,function,suffix, args, attrib)
   __MATHDECLX (_Mdouble_,function,suffix, args, attrib)
+#define __MATHDECL_1(type, function,suffix, args) \
+  extern type __MATH_PRECNAME(function,suffix) args __THROW
 #define __MATHDECLX(type, function,suffix, args, attrib) \
 #define __MATHDECLX(type, function,suffix, args, attrib) \
   __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \
   __MATHDECL_1(type, function,suffix, args) __attribute__ (attrib); \
   __MATHDECLI_MAINVARIANT(function)
   __MATHDECLI_MAINVARIANT(function)
-#define __MATHDECL_1(type, function,suffix, args) \
+
-  extern type __MATH_PRECNAME(function,suffix) args __THROW
 /* Decls which are also used internally in libm.
 /* Decls which are also used internally in libm.
    Only the main variant is used internally, no need to try to avoid relocs
    Only the main variant is used internally, no need to try to avoid relocs
    for the {l,f} variants.  */
    for the {l,f} variants.  */
@@ -76,16 +75,24 @@ __BEGIN_DECLS
   __MATHDECLI_MAINVARIANT(function)
   __MATHDECLI_MAINVARIANT(function)
 /* Private helpers for purely macro impls below.
 /* Private helpers for purely macro impls below.
    Only make __foo{,f,l} visible but not (the macro-only) foo.  */
    Only make __foo{,f,l} visible but not (the macro-only) foo.  */
-#define __MATHDECL_PRIV(type, function,suffix, args, attrib) \
+#if defined _LIBC
-  __MATHDECL_1(type, __CONCAT(__,function),suffix, args) \
+# define __MATHDECL_PRIV(type, function,suffix, args, attrib) \
-						__attribute__ (attrib); \
+  __MATHDECL_1(type, __CONCAT(__,function),suffix, args) __attribute__ (attrib); \
   libm_hidden_proto(__MATH_PRECNAME(__##function,suffix))
   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);
+#endif
 
 
-#define __MATHDECLI_MAINVARIANT libm_hidden_proto
+#if defined _LIBC
-#define _Mdouble_		double
+# define __MATHDECLI_MAINVARIANT(x) libm_hidden_proto(x)
-#define __MATH_PRECNAME(name,r)	__CONCAT(name,r)
+#else
-# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
+# define __MATHDECLI_MAINVARIANT(x)
-# define _Mdouble_END_NAMESPACE   __END_NAMESPACE_STD
+#endif
+#define _Mdouble_		 double
+#define __MATH_PRECNAME(name,r)  __CONCAT(name,r)
+#define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
+#define _Mdouble_END_NAMESPACE   __END_NAMESPACE_STD
 #include <bits/mathcalls.h>
 #include <bits/mathcalls.h>
 #undef	_Mdouble_
 #undef	_Mdouble_
 #undef _Mdouble_BEGIN_NAMESPACE
 #undef _Mdouble_BEGIN_NAMESPACE
@@ -94,8 +101,8 @@ __BEGIN_DECLS
 #undef __MATHDECLI_MAINVARIANT
 #undef __MATHDECLI_MAINVARIANT
 #define __MATHDECLI_MAINVARIANT(x)
 #define __MATHDECLI_MAINVARIANT(x)
 
 
-#if defined __USE_MISC || defined __USE_ISOC99
 
 
+#if defined __USE_MISC || defined __USE_ISOC99
 
 
 /* Include the file of declarations again, this time using `float'
 /* Include the file of declarations again, this time using `float'
    instead of `double' and appending f to each function name.  */
    instead of `double' and appending f to each function name.  */
@@ -160,8 +167,8 @@ extern long double __REDIRECT_NTH (nexttowardl,
 #  define _Mdouble_END_NAMESPACE   __END_NAMESPACE_C99
 #  define _Mdouble_END_NAMESPACE   __END_NAMESPACE_C99
 #  include <bits/mathcalls.h>
 #  include <bits/mathcalls.h>
 #  undef _Mdouble_
 #  undef _Mdouble_
-# undef _Mdouble_BEGIN_NAMESPACE
+#  undef _Mdouble_BEGIN_NAMESPACE
-# undef _Mdouble_END_NAMESPACE
+#  undef _Mdouble_END_NAMESPACE
 #  undef __MATH_PRECNAME
 #  undef __MATH_PRECNAME
 
 
 # endif /* __STDC__ || __GNUC__ */
 # endif /* __STDC__ || __GNUC__ */

+ 4 - 4
libm/s_nextafterf.c

@@ -33,12 +33,12 @@ float nextafterf(float x, float y)
 		return y;
 		return y;
 
 
 	if (ix == 0) { /* x == 0? */
 	if (ix == 0) { /* x == 0? */
-// glibc 2.4 does not seem to set underflow?
+/* glibc 2.4 does not seem to set underflow? */
-//		float u;
+/*		float u; */
 		/* return +-minsubnormal */
 		/* return +-minsubnormal */
 		SET_FLOAT_WORD(x, (hy & 0x80000000) | 1);
 		SET_FLOAT_WORD(x, (hy & 0x80000000) | 1);
-//		u = x * x; /* raise underflow flag */
+/*		u = x * x;     raise underflow flag */
-//		math_force_eval(u);
+/*		math_force_eval(u); */
 		return x;
 		return x;
 	}
 	}