OSDN Git Service

Remove duplicate libmingwex.a entries.
authorKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 30 Jan 2017 10:53:24 +0000 (10:53 +0000)
committerKeith Marshall <keithmarshall@users.sourceforge.net>
Mon, 30 Jan 2017 10:53:24 +0000 (10:53 +0000)
mingwrt/ChangeLog
mingwrt/Makefile.in
mingwrt/include/stdio.h
mingwrt/mingwex/jmpstub.sx
mingwrt/mingwex/stdio/snwprintf.c [deleted file]
mingwrt/mingwex/stdio/vsnwprintf.c [deleted file]

index 19d884c..a1ffb6e 100644 (file)
@@ -1,3 +1,20 @@
+2017-01-30  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       Remove duplicate libmingwex.a entries.
+
+       * mingwex/jmpstub.sx (DLLENTRY): Interpret it.
+
+       * Makefile.in (jmpstub_awk_script): Handle DLLENTRY.
+       (libmingwex.a): Remove explicit object file references to...
+       (snwprintf, vsnwprintf): ...these.
+
+       * include/stdio.h (snwprintf, vsnwprintf): Map them as __JMPSTUB__
+       references to MSVCRT.DLL entry points, via DLLENTRY references to...
+       (_snwprintf, _vsnwprintf): ...these, respectively.
+
+       * mingwex/snwprintf.c: Redundant file; delete it.
+       * mingwex/vsnwprintf.c: Likewise.
+
 2017-01-29  Keith Marshall  <keithmarshall@users.sourceforge.net>
 
        Clean up <limits.h> header file.
index 6b7afca..20fd2c5 100644 (file)
@@ -469,8 +469,8 @@ libmingwex.a: $(addsuffix .$(OBJEXT), cosf cosl acosf acosl sinf sinl asinf \
 #
 vpath %.c ${mingwrt_srcdir}/mingwex/stdio
 libmingwex.a: $(addsuffix .$(OBJEXT), btowc fprintf fseeko64 ofmtctl pformat \
-  printf snprintf snwprintf sprintf vfprintf vfscanf vfwscanf vprintf vscanf \
-  vsnprintf vsnwprintf vsprintf vsscanf vswscanf vwscanf)
+  printf snprintf sprintf vfprintf vfscanf vfwscanf vprintf vscanf vsnprintf \
+  vsprintf vsscanf vswscanf vwscanf)
 
 # pformat.$(OBJEXT) needs an explicit build rule, since we need to
 # specify an additional header file path.
@@ -583,7 +583,9 @@ jmpstub_awk_script = test -z "$1" || awk '\
     LIB = match( $$0, ".*[ ,(:]LIB *= *"symbol, altlib ) ? altlib[1] : "mingwex"; \
     OBJNAME = gensub( "_*(.*)_*", "\\1", 1, FUNCTION )".jmpstub.$$(OBJEXT)"; \
     OBJNAME_CFLAGS = "-D FUNCTION="FUNCTION; \
-    if( match( $$0, ".*[ ,(:]REMAPPED *= *"symbol, alias ) ) \
+    if( match( $$0, ".*[ ,(:]DLLENTRY *= *"symbol, alias ) ) \
+      OBJNAME_CFLAGS = OBJNAME_CFLAGS" -D DLLENTRY="alias[1]; \
+    else if( match( $$0, ".*[ ,(:]REMAPPED *= *"symbol, alias ) ) \
       OBJNAME_CFLAGS = OBJNAME_CFLAGS" -D REMAPPED="alias[1]; \
     printf fmt, LIB, OBJNAME, OBJNAME, OBJNAME_CFLAGS; \
   } \
index 252c210..9e2ccab 100644 (file)
@@ -7,7 +7,7 @@
  * $Id$
  *
  * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
- * Copyright (C) 1997-2005, 2007-2010, 2014-2016, MinGW.org Project.
+ * Copyright (C) 1997-2005, 2007-2010, 2014-2017, MinGW.org Project.
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -950,12 +950,13 @@ _CRTIMP __cdecl __MINGW_NOTHROW  FILE    * _wpopen (const wchar_t *, const wchar
 #endif /* __MSVCRT__ */
 
 #ifdef _ISOC99_SOURCE
+__JMPSTUB__(( FUNCTION = snwprintf, DLLENTRY = _snwprintf ))
 __cdecl __MINGW_NOTHROW  int snwprintf (wchar_t *, size_t, const wchar_t *, ...);
 __cdecl __MINGW_NOTHROW  int vsnwprintf (wchar_t *, size_t, const wchar_t *, __VALIST);
 
 #ifndef __NO_INLINE__
 __CRT_INLINE __cdecl __MINGW_NOTHROW
-__JMPSTUB__(( FUNCTION = vsnwprintf, REMAPPED = _vsnwprintf ))
+__JMPSTUB__(( FUNCTION = vsnwprintf, DLLENTRY = _vsnwprintf ))
 int vsnwprintf (wchar_t *__s, size_t __n, const wchar_t *__fmt, __VALIST __arg)
 { return _vsnwprintf ( __s, __n, __fmt, __arg); }
 #endif
index aa57975..200a120 100644 (file)
@@ -7,7 +7,7 @@
  * $Id$
  *
  * Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2013, 2014, MinGW.org Project
+ * Copyright (C) 2013, 2014, 2017, MinGW.org Project
  *
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * an additional "-D REMAPPED=entryname" option, resulting in redirection
  * of "funcname()" calls to the "entryname()" function entry point.
  *
+ * Alternatively, calls to "funcname()" may be redirected to a DLL entry point,
+ * via its importable name within the DLL's export table, by specification of
+ * the "-D DLLENTRY=entryname" option, instead of "-D REMAPPED=entryname".
+ *
  */
 #define __entry__(__suffix__)  __label__(_,__suffix__)
 #define __label__(__prefix__,__suffix__)  __prefix__##__suffix__
 
-#ifndef REMAPPED
-# define __mingw__(__suffix__)  __label__(__mingw_,__suffix__)
-# define REMAPPED  __mingw__(FUNCTION)
+#if defined LLENTRY && ! defined DLLENTRY
+/* This is a convenience for users; it allows specification of a DLLENTRY
+ * option as simply "-DLLENTRY=entryname", as an alternative to specifying
+ * it fully, as "-D DLLENTRY=entryname".
+ */
+#define DLLENTRY  LLENTRY
 #endif
 
 .text
+#ifdef DLLENTRY
+ /* This represents the case of redirection to a function implementation
+  * residing within a DLL...
+  */
+# define __dllentry__(__suffix__)  __label__(__imp__,__suffix__)
+# define __redirect__  *__dllentry__(DLLENTRY)
+
+#else
+ /* ...whereas this redirection to an alternative static library function,
+  * or to a DLL implementation accessed via an import library trampoline.
+  */
+# ifndef REMAPPED
+  /* No explicit entry point redirection specified; use the default entry
+   * point name, within the "__mingw_" pseudo-namespace.
+   */
+#  define __mingw__(__suffix__)  __label__(__mingw_,__suffix__)
+#  define REMAPPED  __mingw__(FUNCTION)
+# endif
+# define __redirect__  __entry__(REMAPPED)
+.def   __entry__(REMAPPED); .scl 2; .type 32; .endef
+#endif
+
 .global __entry__(FUNCTION)
 .def   __entry__(FUNCTION); .scl 2; .type 32; .endef
-.def   __entry__(REMAPPED); .scl 2; .type 32; .endef
 
-__entry__(FUNCTION): jmp __entry__(REMAPPED)
+__entry__(FUNCTION): jmp __redirect__
 
 /* $RCSfile$: end of file */
diff --git a/mingwrt/mingwex/stdio/snwprintf.c b/mingwrt/mingwex/stdio/snwprintf.c
deleted file mode 100644 (file)
index d69892e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdarg.h>
-#include <wchar.h>
-
-int  snwprintf(wchar_t* buffer, size_t n, const wchar_t* format, ...)
-{
-    int retval;
-    va_list argptr;
-
-    va_start( argptr, format );
-    retval = _vsnwprintf( buffer, n, format, argptr );
-    va_end( argptr );
-    return retval;
-}
diff --git a/mingwrt/mingwex/stdio/vsnwprintf.c b/mingwrt/mingwex/stdio/vsnwprintf.c
deleted file mode 100644 (file)
index 1b59a07..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdarg.h>
-#include <wchar.h>
-
-int  vsnwprintf(wchar_t *buffer,  size_t n, const wchar_t * format, va_list argptr)
-  { return _vsnwprintf( buffer, n, format, argptr );}