From d4e45e3b99bd14e4253246518fced5eb5a8bcd58 Mon Sep 17 00:00:00 2001 From: Chris Sutcliffe Date: Sat, 18 Jul 2009 15:19:03 +0000 Subject: [PATCH] 2009-07-18 Gregory McGarry * include/inttypes.h include/math.h include/stdio.h include/stdlib.h include/string.h include/unistd.h include/wchar.h: Add __NO_INLINE__ guard to all inline functions. --- winsup/mingw/ChangeLog | 6 ++++++ winsup/mingw/include/inttypes.h | 3 +++ winsup/mingw/include/math.h | 30 ++++++++++++++++++++++++++++-- winsup/mingw/include/stdio.h | 2 ++ winsup/mingw/include/stdlib.h | 6 +++++- winsup/mingw/include/string.h | 10 ++++++++-- winsup/mingw/include/unistd.h | 2 ++ winsup/mingw/include/wchar.h | 4 ++++ 8 files changed, 58 insertions(+), 5 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index 0ab0dc306..08cc01898 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,9 @@ +2009-07-18 Gregory McGarry + + * include/inttypes.h include/math.h include/stdio.h include/stdlib.h + include/string.h include/unistd.h include/wchar.h: Add __NO_INLINE__ guard + to all inline functions. + 2009-07-18 Gregory McGarry * CRT_fp8.c: Add PCC alternative to GCC-specific constructs. diff --git a/winsup/mingw/include/inttypes.h b/winsup/mingw/include/inttypes.h index aff072585..2d2bb8d80 100644 --- a/winsup/mingw/include/inttypes.h +++ b/winsup/mingw/include/inttypes.h @@ -255,8 +255,11 @@ typedef struct { #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ +intmax_t __cdecl __MINGW_NOTHROW imaxabs (intmax_t j); +#ifndef __NO_INLINE__ __CRT_INLINE intmax_t __cdecl __MINGW_NOTHROW imaxabs (intmax_t j) {return (j >= 0 ? j : -j);} +#endif imaxdiv_t __cdecl __MINGW_NOTHROW imaxdiv (intmax_t numer, intmax_t denom); /* 7.8.2 Conversion functions for greatest-width integer types */ diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h index 0577d0cc2..82cd1ba43 100644 --- a/winsup/mingw/include/math.h +++ b/winsup/mingw/include/math.h @@ -354,11 +354,13 @@ typedef long double double_t; extern int __cdecl __fpclassifyf (float); extern int __cdecl __fpclassify (double); +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __fpclassifyl (long double x){ unsigned short sw; __asm__ ("fxam; fstsw %%ax;" : "=a" (sw): "t" (x)); return sw & (FP_NAN | FP_NORMAL | FP_ZERO ); } +#endif #define fpclassify(x) (sizeof (x) == sizeof (float) ? __fpclassifyf (x) \ : sizeof (x) == sizeof (double) ? __fpclassify (x) \ @@ -373,7 +375,7 @@ __CRT_INLINE int __cdecl __fpclassifyl (long double x){ /* 7.12.3.4 */ /* We don't need to worry about truncation here: A NaN stays a NaN. */ - +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __isnan (double _x) { unsigned short sw; @@ -400,7 +402,7 @@ __CRT_INLINE int __cdecl __isnanl (long double _x) return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) == FP_NAN; } - +#endif #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) \ : sizeof (x) == sizeof (double) ? __isnan (x) \ @@ -410,6 +412,7 @@ __CRT_INLINE int __cdecl __isnanl (long double _x) #define isnormal(x) (fpclassify(x) == FP_NORMAL) /* 7.12.3.6 The signbit macro */ +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __signbit (double x) { unsigned short stw; __asm__ ( "fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); @@ -427,6 +430,7 @@ __CRT_INLINE int __cdecl __signbitl (long double x) { __asm__ ("fxam; fstsw %%ax;": "=a" (stw) : "t" (x)); return (stw & 0x0200) != 0; } +#endif #define signbit(x) (sizeof (x) == sizeof (float) ? __signbitf (x) \ : sizeof (x) == sizeof (double) ? __signbit (x) \ @@ -455,16 +459,22 @@ extern float __cdecl atan2f (float, float); extern long double __cdecl atan2l (long double, long double); /* 7.12.5 Hyperbolic functions: Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl sinhf (float x) {return (float) sinh (x);} +#endif extern long double __cdecl sinhl (long double); +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl coshf (float x) {return (float) cosh (x);} +#endif extern long double __cdecl coshl (long double); +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl tanhf (float x) {return (float) tanh (x);} +#endif extern long double __cdecl tanhl (long double); /* Inverse hyperbolic trig functions */ @@ -485,8 +495,10 @@ extern long double __cdecl atanhl (long double); /* Exponentials and logarithms */ /* 7.12.6.1 Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl expf (float x) {return (float) exp (x);} +#endif extern long double __cdecl expl (long double); /* 7.12.6.2 */ @@ -501,8 +513,10 @@ extern float __cdecl expm1f(float); extern long double __cdecl expm1l(long double); /* 7.12.6.4 Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl frexpf (float x, int* expn) {return (float) frexp (x, expn);} +#endif extern long double __cdecl frexpl (long double, int*); /* 7.12.6.5 */ @@ -513,8 +527,10 @@ extern int __cdecl ilogbf (float); extern int __cdecl ilogbl (long double); /* 7.12.6.6 Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl ldexpf (float x, int expn) {return (float) ldexp (x, expn);} +#endif extern long double __cdecl ldexpl (long double, int); /* 7.12.6.7 Double in C89 */ @@ -542,6 +558,7 @@ extern long double __cdecl logbl (long double); /* Inline versions. GCC-4.0+ can do a better fast-math optimization with __builtins. */ +#ifndef __NO_INLINE__ #if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ ) __CRT_INLINE double __cdecl logb (double x) { @@ -567,6 +584,7 @@ __CRT_INLINE long double __cdecl logbl (long double x) return res; } #endif /* !defined __FAST_MATH__ || !__MINGW_GNUC_PREREQ (4, 0) */ +#endif /* !defined __NO_INLINE__ */ /* 7.12.6.12 Double in C89 */ extern float __cdecl modff (float, float*); @@ -593,13 +611,17 @@ extern long double __cdecl fabsl (long double x); /* 7.12.7.3 */ extern double __cdecl hypot (double, double); /* in libmoldname.a */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl hypotf (float x, float y) { return (float) hypot (x, y);} +#endif extern long double __cdecl hypotl (long double, long double); /* 7.12.7.4 The pow functions. Double in C89 */ +#ifndef __NO_INLINE__ __CRT_INLINE float __cdecl powf (float x, float y) {return (float) pow (x, y);} +#endif extern long double __cdecl powl (long double, long double); /* 7.12.7.5 The sqrt functions. Double in C89. */ @@ -656,6 +678,7 @@ extern long long __cdecl llrintl (long double); /* Inline versions of above. GCC 4.0+ can do a better fast-math job with __builtins. */ +#ifndef __NO_INLINE__ #if !(__MINGW_GNUC_PREREQ (4, 0) && defined __FAST_MATH__ ) __CRT_INLINE double __cdecl rint (double x) { @@ -726,6 +749,7 @@ __CRT_INLINE long long __cdecl llrintl (long double x) return retval; } #endif /* !__FAST_MATH__ || !__MINGW_GNUC_PREREQ (4,0) */ +#endif /* !defined __NO_INLINE */ /* 7.12.9.6 */ /* round away from zero, regardless of fpu control word settings */ @@ -836,6 +860,7 @@ extern long double __cdecl fmal (long double, long double, long double); #else /* helper */ +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __fp_unordered_compare (long double x, long double y){ unsigned short retval; @@ -843,6 +868,7 @@ __fp_unordered_compare (long double x, long double y){ "fnstsw;": "=a" (retval) : "t" (x), "u" (y)); return retval; } +#endif #define isgreater(x, y) ((__fp_unordered_compare(x, y) \ & 0x4500) == 0) diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h index 1765bed9d..163bbb2f2 100644 --- a/winsup/mingw/include/stdio.h +++ b/winsup/mingw/include/stdio.h @@ -601,9 +601,11 @@ _CRTIMP FILE* __cdecl __MINGW_NOTHROW _wpopen (const wchar_t*, const wchar_t*); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ int __cdecl __MINGW_NOTHROW snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...); +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __MINGW_NOTHROW vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg) { return _vsnwprintf ( s, n, format, arg);} +#endif int __cdecl __MINGW_NOTHROW vwscanf (const wchar_t * __restrict__, __VALIST); int __cdecl __MINGW_NOTHROW vfwscanf (FILE * __restrict__, const wchar_t * __restrict__, __VALIST); diff --git a/winsup/mingw/include/stdlib.h b/winsup/mingw/include/stdlib.h index ae36ebe0c..014bc0a27 100644 --- a/winsup/mingw/include/stdlib.h +++ b/winsup/mingw/include/stdlib.h @@ -503,7 +503,7 @@ _CRTIMP char* __cdecl __MINGW_NOTHROW gcvt (double, int, char*); /* C99 name for _exit */ void __cdecl __MINGW_NOTHROW _Exit(int) __MINGW_ATTRIB_NORETURN; -#ifndef __STRICT_ANSI__ /* inline using non-ansi functions */ +#ifndef __NO_INLINE__ __CRT_INLINE void __cdecl __MINGW_NOTHROW _Exit(int __status) { _exit (__status); } #endif @@ -513,8 +513,10 @@ typedef struct { long long quot, rem; } lldiv_t; lldiv_t __cdecl __MINGW_NOTHROW lldiv (long long, long long) __MINGW_ATTRIB_CONST; long long __cdecl __MINGW_NOTHROW llabs(long long); +#ifndef __NO_INLINE__ __CRT_INLINE long long __cdecl __MINGW_NOTHROW llabs(long long _j) {return (_j >= 0 ? _j : -_j);} +#endif long long __cdecl __MINGW_NOTHROW strtoll (const char* __restrict__, char** __restrict, int); unsigned long long __cdecl __MINGW_NOTHROW strtoull (const char* __restrict__, char** __restrict__, int); @@ -530,6 +532,7 @@ wchar_t* __cdecl __MINGW_NOTHROW lltow (long long, wchar_t *, int); wchar_t* __cdecl __MINGW_NOTHROW ulltow (unsigned long long, wchar_t *, int); /* inline using non-ansi functions */ +#ifndef __NO_INLINE__ __CRT_INLINE long long __cdecl __MINGW_NOTHROW atoll (const char * _c) { return _atoi64 (_c); } __CRT_INLINE char* __cdecl __MINGW_NOTHROW lltoa (long long _n, char * _c, int _i) @@ -542,6 +545,7 @@ __CRT_INLINE wchar_t* __cdecl __MINGW_NOTHROW lltow (long long _n, wchar_t * _w { return _i64tow (_n, _w, _i); } __CRT_INLINE wchar_t* __cdecl __MINGW_NOTHROW ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); } +#endif /* (__NO_INLINE__) */ #endif /* (__STRICT_ANSI__) */ #endif /* __MSVCRT__ */ diff --git a/winsup/mingw/include/string.h b/winsup/mingw/include/string.h index 62bdb3f10..2680d0a95 100644 --- a/winsup/mingw/include/string.h +++ b/winsup/mingw/include/string.h @@ -92,17 +92,21 @@ _CRTIMP int __cdecl __MINGW_NOTHROW memicmp (const void*, const void*, size_t); _CRTIMP char* __cdecl __MINGW_NOTHROW strdup (const char*) __MINGW_ATTRIB_MALLOC; _CRTIMP int __cdecl __MINGW_NOTHROW strcmpi (const char*, const char*); _CRTIMP int __cdecl __MINGW_NOTHROW stricmp (const char*, const char*); -__CRT_INLINE int __cdecl __MINGW_NOTHROW strcasecmp (const char*, const char *); +int __cdecl __MINGW_NOTHROW strcasecmp (const char*, const char *); +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __MINGW_NOTHROW strcasecmp (const char * __sz1, const char * __sz2) {return _stricmp (__sz1, __sz2);} +#endif _CRTIMP int __cdecl __MINGW_NOTHROW stricoll (const char*, const char*); _CRTIMP char* __cdecl __MINGW_NOTHROW strlwr (char*); _CRTIMP int __cdecl __MINGW_NOTHROW strnicmp (const char*, const char*, size_t); -__CRT_INLINE int __cdecl __MINGW_NOTHROW strncasecmp (const char *, const char *, size_t); +int __cdecl __MINGW_NOTHROW strncasecmp (const char *, const char *, size_t); +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __MINGW_NOTHROW strncasecmp (const char * __sz1, const char * __sz2, size_t __sizeMaxCompare) {return _strnicmp (__sz1, __sz2, __sizeMaxCompare);} +#endif _CRTIMP char* __cdecl __MINGW_NOTHROW strnset (char*, int, size_t); _CRTIMP char* __cdecl __MINGW_NOTHROW strrev (char*); _CRTIMP char* __cdecl __MINGW_NOTHROW strset (char*, int); @@ -167,9 +171,11 @@ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW __wcserror(const wchar_t*); #ifndef _NO_OLDNAMES /* NOTE: There is no _wcscmpi, but this is for compatibility. */ int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2); +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) {return _wcsicmp (__ws1, __ws2);} +#endif _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*); _CRTIMP int __cdecl __MINGW_NOTHROW wcsicmp (const wchar_t*, const wchar_t*); _CRTIMP int __cdecl __MINGW_NOTHROW wcsicoll (const wchar_t*, const wchar_t*); diff --git a/winsup/mingw/include/unistd.h b/winsup/mingw/include/unistd.h index 3e7f2364a..f84379732 100644 --- a/winsup/mingw/include/unistd.h +++ b/winsup/mingw/include/unistd.h @@ -38,11 +38,13 @@ int __cdecl __MINGW_NOTHROW usleep(useconds_t useconds); /* This is defined as a real library function to allow autoconf to verify its existence. */ +#ifndef __NO_INLINE__ int ftruncate(int, off_t); __CRT_INLINE int ftruncate(int __fd, off_t __length) { return _chsize (__fd, __length); } +#endif #ifdef __cplusplus } diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h index be769527b..86bb999b3 100644 --- a/winsup/mingw/include/wchar.h +++ b/winsup/mingw/include/wchar.h @@ -144,9 +144,11 @@ _CRTIMP FILE* __cdecl __MINGW_NOTHROW _wpopen (const wchar_t*, const wchar_t*); #ifndef __NO_ISOCEXT /* externs in libmingwex.a */ int __cdecl __MINGW_NOTHROW snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...); +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __MINGW_NOTHROW vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg) { return _vsnwprintf ( s, n, format, arg);} +#endif int __cdecl __MINGW_NOTHROW vwscanf (const wchar_t * __restrict__, __VALIST); int __cdecl __MINGW_NOTHROW vfwscanf (FILE * __restrict__, const wchar_t * __restrict__, __VALIST); @@ -247,9 +249,11 @@ _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW __wcserror(const wchar_t*); #ifndef _NO_OLDNAMES /* NOTE: There is no _wcscmpi, but this is for compatibility. */ +#ifndef __NO_INLINE__ __CRT_INLINE int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2) {return _wcsicmp (__ws1, __ws2);} +#endif _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsdup (const wchar_t*); _CRTIMP int __cdecl __MINGW_NOTHROW wcsicmp (const wchar_t*, const wchar_t*); _CRTIMP int __cdecl __MINGW_NOTHROW wcsicoll (const wchar_t*, const wchar_t*);