aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xChangeLog12
-rw-r--r--debug.c6
-rw-r--r--nonposix.h6
-rw-r--r--pc/ChangeLog5
-rw-r--r--pc/gawkmisc.pc2
5 files changed, 29 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index b1727e73..1007bb88 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2019-02-02 Eli Zaretskii <eliz@gnu.org>
+
+ * nonposix.h: If setlocale is already a defined macro, #undef it
+ before redefining. This avoids compilation warnings if someone
+ tries to compile Gawk with Gettext's libintl.h, which redirects
+ setlocale to its own function.
+ Reported by Budi <budikusasi@gmail.com>.
+
+ * debug.c [__MINGW32__]: Prototype for w32_execvp.
+ (restart) [__MINGW32__]: Call w32_execvp instead of execvp. Don't
+ type-cast d_argv anymore.
+
2019-01-27 Arnold D. Robbins <arnold@skeeve.com>
* awkgram.y (qualify_name): Return duplicated strings.
diff --git a/debug.c b/debug.c
index c60cc5aa..981f95b2 100644
--- a/debug.c
+++ b/debug.c
@@ -30,6 +30,10 @@
#include <fcntl.h> /* open() */
#endif
+#ifdef __MINGW32__
+int w32_execvp(const char *, char **);
+#endif
+
extern bool exiting;
extern SRCFILE *srcfiles;
extern INSTRUCTION *rule_list;
@@ -2915,7 +2919,7 @@ restart(bool run)
/* start a new process replacing the current process */
#ifdef __MINGW32__
- execvp(d_argv[0], (const char * const *)d_argv);
+ w32_execvp(d_argv[0], d_argv);
#else
execvp(d_argv[0], d_argv);
#endif
diff --git a/nonposix.h b/nonposix.h
index 26ef32b9..52fb21f2 100644
--- a/nonposix.h
+++ b/nonposix.h
@@ -57,6 +57,12 @@ int unsetenv (const char *);
int setenv (const char *, const char *, int);
void w32_maybe_set_errno (void);
char *w32_setlocale (int, const char *);
+/* libintl.h from GNU gettext defines setlocale to redirect that to
+ its own function. Note: this will have to be revisited if MinGW
+ Gawk will support ENABLE_NLS at some point. */
+#ifdef setlocale
+# undef setlocale
+#endif
#define setlocale(c,v) w32_setlocale(c,v)
#endif /* __MINGW32__ */
diff --git a/pc/ChangeLog b/pc/ChangeLog
index 3e63e209..18bbbf15 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,5 +1,10 @@
2019-02-02 Eli Zaretskii <eliz@gnu.org>
+ * gawkmisc.pc (w32_execvp) [__MINGW32__]: Renamed from execvp, to
+ avoid compiler errors with MinGW64, which stupidly defined a
+ deviant prototype for execvp, because GCC's built-in does.
+ Reported by Budi <budikusasi@gmail.com>.
+
* Makefile.tst (typedregex4):
* GenMakefileTst.awk (substitutions): Replace a literal slash with
$(SLASH) in the typedregex4 test.
diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc
index 7c4436ef..2e581011 100644
--- a/pc/gawkmisc.pc
+++ b/pc/gawkmisc.pc
@@ -794,7 +794,7 @@ nl_langinfo (int item)
*
* This will need work if we ever need a real version of execvp.
*/
-int execvp(const char *file, const char *const *argv)
+int w32_execvp(const char *file, char **argv)
{
if (_spawnvp(_P_WAIT, file, (const char * const *)argv) != -1)
exit(EXIT_SUCCESS);