OSDN Git Service

More JMPSTUB rationalization of inline functions.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Sun, 30 Nov 2014 22:34:46 +0000 (22:34 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Sun, 30 Nov 2014 22:34:46 +0000 (22:34 +0000)
mingwrt/ChangeLog
mingwrt/Makefile.in
mingwrt/include/stdlib.h
mingwrt/mingwex/_Exit.c [deleted file]
mingwrt/mingwex/atoll.c [deleted file]
mingwrt/mingwex/lltoa.c [deleted file]
mingwrt/mingwex/lltow.c [deleted file]
mingwrt/mingwex/ulltoa.c [deleted file]
mingwrt/mingwex/ulltow.c [deleted file]
mingwrt/mingwex/wtoll.c [deleted file]

index 42912fe..7f6df43 100644 (file)
@@ -1,3 +1,21 @@
+2014-11-30  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       More JMPSTUB rationalization of inline functions.
+
+       * include/stdlib.h (_Exit, atoll, lltoa, ulltoa, wtoll, lltow)
+       (ulltow): Add __JMPSTUB__ declarations; each is REMAPPED to its
+       appropriate MSVCRT.DLL equivalent entry point.
+
+       * mingwex/_Exit.c: File is now redundant; delete it.
+       * mingwex/atoll.c mingwex/lltoa.c mingwex/ulltoa: Likewise.
+       * mingwex/wtoll.c mingwex/lltow.c mingwex/ulltow: Likewise.
+
+       * Makefile.in (jmpstub_awk_script): Add support for...
+       [__JMPSTUB__((REMAPPED))]: ...this stub function attribute.
+       (libmingwex.a): Remove dependencies on deleted files, namely...
+       (_Exit.$OBJEXT, atoll.$OBJEXT, lltoa.$OBJEXT, ulltoa.$OBJEXT)
+       (wtoll.$OBJEXT, lltow.$OBJEXT, ulltow.$OBJEXT): ...these.
+
 2014-11-29  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Correct omission of complex conjugate functions from libmingwex.a
index 4eef297..a711605 100644 (file)
@@ -447,9 +447,6 @@ libmingwex.a: $(addsuffix .$(OBJEXT), getopt basename dirname ftruncate usleep)
 
 libmingwex.a: $(addsuffix .$(OBJEXT), tdelete tfind tsearch twalk)
 
-libmingwex.a: $(addsuffix .$(OBJEXT), _Exit atoll lltoa lltow \
-  ulltoa ulltow wtoll)
-
 libmingwex.a: gettimeofday.$(OBJEXT)
 libmingwex.a: $(addsuffix .$(OBJEXT), dirent wdirent dlfcn)
 
@@ -517,6 +514,8 @@ jmpstub_awk_script = test -z "$1" || awk '\
     FUNCTION = gensub( ".*[ ,(:]FUNCTION *= *"symbol".*", "\\1", 1 ); \
     OBJNAME = gensub( "_*(.*)_*", "\\1", 1, FUNCTION )".jmpstub.$$(OBJEXT)"; \
     OBJNAME_CFLAGS = "-D FUNCTION="FUNCTION; \
+    if( match( $$0, ".*[ ,(:]REMAPPED *= *"symbol, alias ) ) \
+      OBJNAME_CFLAGS = OBJNAME_CFLAGS" -D REMAPPED="alias[1]; \
     printf fmt, LIB, OBJNAME, OBJNAME, OBJNAME_CFLAGS; \
   } \
   END { \
index 13790e0..01fb7a8 100644 (file)
@@ -17,6 +17,7 @@
 #define __need_size_t
 #define __need_wchar_t
 #define __need_NULL
+
 #ifndef RC_INVOKED
 #include <stddef.h>
 #endif /* RC_INVOKED */
@@ -56,9 +57,7 @@
 
 #ifndef RC_INVOKED
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+_BEGIN_C_DECLS
 
 #if !defined (__STRICT_ANSI__)
 
@@ -496,8 +495,8 @@ _CRTIMP char* __cdecl __MINGW_NOTHROW       gcvt (double, int, char*);
 /* C99 name for _exit */
 void __cdecl __MINGW_NOTHROW _Exit(int) __MINGW_ATTRIB_NORETURN;
 #if !defined __NO_INLINE__ && !defined __STRICT_ANSI__
-__CRT_INLINE void __cdecl __MINGW_NOTHROW _Exit(int __status)
-       {  _exit (__status); }
+__CRT_INLINE __JMPSTUB__(( FUNCTION = _Exit, REMAPPED = _exit ))
+void __cdecl __MINGW_NOTHROW _Exit( int __status ){ _exit (__status); }
 #endif
 
 typedef struct { long long quot, rem; } lldiv_t;
@@ -506,8 +505,12 @@ lldiv_t    __cdecl __MINGW_NOTHROW lldiv (long long, long long) __MINGW_ATTRIB_CONS
 
 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);}
+__CRT_INLINE
+/* No JMPSTUB or LIBIMPL reference here -- we provide a free-standing
+ * implementation, along with imaxabs(), in mingwex/imaxabs.c
+ */
+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);
@@ -523,33 +526,40 @@ char* __cdecl __MINGW_NOTHROW ulltoa (unsigned long long , char *, int);
 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)
-       { return _i64toa (_n, _c, _i); }
-__CRT_INLINE char*  __cdecl __MINGW_NOTHROW ulltoa (unsigned long long _n, char * _c, int _i)
-       { return _ui64toa (_n, _c, _i); }
-__CRT_INLINE long long  __cdecl __MINGW_NOTHROW wtoll (const wchar_t * _w)
-       { return _wtoi64 (_w); }
-__CRT_INLINE wchar_t*  __cdecl __MINGW_NOTHROW lltow (long long _n, wchar_t * _w, int _i)
-       { 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); }
+#ifndef __NO_INLINE__ /* inline support for non-ansi functions */
+
+__CRT_INLINE __JMPSTUB__(( FUNCTION = atoll, REMAPPED = _atoi64 ))
+long long __cdecl __MINGW_NOTHROW atoll (const char * _c){ return _atoi64 (_c); }
+
+__CRT_INLINE __JMPSTUB__(( FUNCTION = lltoa, REMAPPED = _i64toa ))
+char* __cdecl __MINGW_NOTHROW lltoa (long long _n, char * _c, int _i)
+{ return _i64toa (_n, _c, _i); }
+
+__CRT_INLINE __JMPSTUB__(( FUNCTION = ulltoa, REMAPPED = _ui64toa ))
+char* __cdecl __MINGW_NOTHROW ulltoa (unsigned long long _n, char * _c, int _i)
+{ return _ui64toa (_n, _c, _i); }
+
+__CRT_INLINE __JMPSTUB__(( FUNCTION = wtoll, REMAPPED = _wtoi64 ))
+long long __cdecl __MINGW_NOTHROW wtoll (const wchar_t * _w){ return _wtoi64 (_w); }
+
+__CRT_INLINE __JMPSTUB__(( FUNCTION = lltow, REMAPPED = _i64tow ))
+wchar_t* __cdecl __MINGW_NOTHROW lltow (long long _n, wchar_t * _w, int _i)
+{ return _i64tow (_n, _w, _i); }
+
+__CRT_INLINE __JMPSTUB__(( FUNCTION = ulltow, REMAPPED = _ui64tow ))
+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__ */
-
 #endif /* !__NO_ISOCEXT */
 
 
-#ifdef __cplusplus
-}
 #endif
 
-#endif /* Not RC_INVOKED */
+_END_C_DECLS
 
+#endif /* Not RC_INVOKED */
 #endif /* Not _STDLIB_H_ */
-
diff --git a/mingwrt/mingwex/_Exit.c b/mingwrt/mingwex/_Exit.c
deleted file mode 100644 (file)
index 38f7e18..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-void _Exit(int status)
-       {  _exit(status); }
diff --git a/mingwrt/mingwex/atoll.c b/mingwrt/mingwex/atoll.c
deleted file mode 100644 (file)
index 97920b4..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-long long atoll (const char * _c)
-       { return _atoi64 (_c); }
diff --git a/mingwrt/mingwex/lltoa.c b/mingwrt/mingwex/lltoa.c
deleted file mode 100644 (file)
index 28248a8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-char* lltoa(long long _n, char * _c, int _i)
-       { return _i64toa (_n, _c, _i); }
diff --git a/mingwrt/mingwex/lltow.c b/mingwrt/mingwex/lltow.c
deleted file mode 100644 (file)
index 55ef126..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-wchar_t* lltow(long long _n, wchar_t * _w, int _i)
-       { return _i64tow (_n, _w, _i); }
diff --git a/mingwrt/mingwex/ulltoa.c b/mingwrt/mingwex/ulltoa.c
deleted file mode 100644 (file)
index 8e90de7..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-char* ulltoa(unsigned long long _n, char * _c, int _i)
-       { return _ui64toa (_n, _c, _i); }
diff --git a/mingwrt/mingwex/ulltow.c b/mingwrt/mingwex/ulltow.c
deleted file mode 100644 (file)
index 8e4f228..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-wchar_t* ulltow(unsigned long long _n, wchar_t * _w, int _i)
-       { return _ui64tow (_n, _w, _i); }
diff --git a/mingwrt/mingwex/wtoll.c b/mingwrt/mingwex/wtoll.c
deleted file mode 100644 (file)
index 0bff278..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <stdlib.h>
-long long wtoll(const wchar_t * _w)
-       { return _wtoi64 (_w); }