OSDN Git Service

Another CRT_INLINE function implementation rationalization.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Thu, 11 Dec 2014 22:40:07 +0000 (22:40 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Thu, 11 Dec 2014 22:40:07 +0000 (22:40 +0000)
mingwrt/ChangeLog
mingwrt/Makefile.in
mingwrt/include/inttypes.h
mingwrt/mingwex/imaxabs.c [deleted file]

index 41a6fb0..dff360f 100644 (file)
@@ -1,5 +1,19 @@
 2014-12-11  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
+       Another CRT_INLINE function implementation rationalization.
+
+       * include/inttypes.h (imaxabs): Specify as __LIBIMPL__; declare...
+       (llabs): ...this, to be implemented as its __LIBIMPL__ alias.
+       [__cplusplus] (_BEGIN_C_DECLS, _END_C_DECLS): Use these.
+
+       * Makefile.in (libimpl_sed_script): Handle ALIAS attribute.
+       (libmingwex.a): Delete obsolete dependency on...
+       (imaxabs.$OBJEXT): ...this.
+
+       * mingwex/imaxabs.c: File is now redundant; delete it.
+
+2014-12-11  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
        More rationalization of CRT_INLINE function implementations.
 
        * include/stdio.h (fopen64): Add __JMPSTUP__ specification.
@@ -9,7 +23,7 @@
        * mingwex/stdio/fopen64.c: File is now redundant; delete it.
        * mingwex/stdio/ftell064.c: Likewise.
 
-       * Makefile.in (libmingwex.a): Delete obsolete dependencies...
+       * Makefile.in (libmingwex.a): Delete obsolete dependencies on...
        (fopen64.$OBJEXT, ftello64.$OBJEXT): ...these.
 
 2014-12-11  Keith Marshall  <keithmarshall@users.sourceforge.net>
index 6bb20a0..79c829e 100644 (file)
@@ -392,7 +392,7 @@ libmingwex.a: $(addsuffix .$(OBJEXT), g__fmt gethex strtopx g_dfmt gdtoa \
 # "inttypes" conversion routines, provided in libmingwex.a
 #
 libmingwex.a: $(addsuffix .$(OBJEXT), \
-  imaxabs imaxdiv strtoimax strtoumax wcstoimax wcstoumax)
+  imaxdiv strtoimax strtoumax wcstoimax wcstoumax)
 
 # Additional math functions, augmenting Microsoft's paltry
 # selection, also delivered in libmingwex.a, (FIXME: and yet
@@ -550,9 +550,10 @@ libimpl_awk_script = test -z "$1" || awk '\
 # which identifies the originating file as a system header).
 #
 libimpl_sed_script = sed \
-  -e '/__CRT_ALIAS  *__LIBIMPL.*FUNCTION *= *$1[ ,)].*)/d' \
+  -e '/pragma .* system_header/d' \
   -e '/__CRT_INLINE  *__LIBIMPL.*FUNCTION *= *$1[ ,)].*)/d' \
-  -e '/pragma .* system_header/d'
+  -e 's/__LIBIMPL.*ALIAS *= *$1[ ,)].*)/__attribute__((__alias__("$1")))/' \
+  -e '/__CRT_ALIAS  *__LIBIMPL.*FUNCTION *= *$1[ ,)].*)/d'
 
 LIBIMPL_CFLAGS = $(CFLAGS) $(INCLUDES) -fno-align-functions
 
index 723d3b4..e5e5d5b 100644 (file)
@@ -8,9 +8,7 @@
 #define __need_wchar_t
 #include <stddef.h>
 
-#ifdef __cplusplus
-extern "C"     {
-#endif
+_BEGIN_C_DECLS
 
 typedef struct {
        intmax_t quot;
@@ -257,9 +255,19 @@ typedef struct {
 
 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);}
+__CRT_INLINE __LIBIMPL__(( FUNCTION = imaxabs ))
+intmax_t __cdecl __MINGW_NOTHROW imaxabs (intmax_t __j)
+{ return __j >= 0 ? __j : -__j; }
+
+/* Since intmax_t is effectively analogous to long long, the preceding
+ * implementation will serve admirably as the external representation of
+ * both imaxabs() and llabs(); declare so here, by providing a prototype
+ * only, with the corresponding inline implementation in stdlib.h
+ */
+__CRT_INLINE __LIBIMPL__(( ALIAS = imaxabs ))
+long long llabs (long long);
 #endif
+
 imaxdiv_t __cdecl __MINGW_NOTHROW imaxdiv (intmax_t numer, intmax_t denom);
 
 /* 7.8.2 Conversion functions for greatest-width integer types */
@@ -274,8 +282,6 @@ intmax_t __cdecl __MINGW_NOTHROW wcstoimax (const wchar_t* __restrict__ nptr,
 uintmax_t __cdecl __MINGW_NOTHROW wcstoumax (const wchar_t* __restrict__ nptr,
                             wchar_t** __restrict__ endptr, int base);
 
-#ifdef __cplusplus
-}
-#endif
+_END_C_DECLS
 
 #endif /* ndef _INTTYPES_H */
diff --git a/mingwrt/mingwex/imaxabs.c b/mingwrt/mingwex/imaxabs.c
deleted file mode 100644 (file)
index df15673..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
-    This source code was extracted from the Q8 package created and
-    placed in the PUBLIC DOMAIN by Doug Gwyn <gwyn@arl.mil>
-    last edit: 1999/11/05      gwyn@arl.mil
-
-       Implements subclause 7.8.2 of ISO/IEC 9899:1999 (E).
-
-       This particular implementation requires the matching <inttypes.h>.
-*/
-
-#include       <inttypes.h>
-
-intmax_t
-imaxabs (intmax_t _j)
-  { return     _j >= 0 ? _j : -_j; }
-
-long long __attribute__ ((alias ("imaxabs")))  llabs (long long);