gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4359-gf77e131


From: Arnold Robbins
Subject: [SCM] gawk branch, gawk-5.1-stable, updated. gawk-4.1.0-4359-gf77e131
Date: Wed, 1 Dec 2021 15:42:35 -0500 (EST)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-5.1-stable has been updated
       via  f77e1318c515d495ac9c08bdfdf2dadf79a9649f (commit)
       via  4285d605b8c0cbe4e0b15724af1b4bd223f25403 (commit)
      from  9eb357e008385176a44b695e6117f95b2ea104a7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=f77e1318c515d495ac9c08bdfdf2dadf79a9649f

commit f77e1318c515d495ac9c08bdfdf2dadf79a9649f
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Dec 1 22:42:07 2021 +0200

    Convert w32_maybe_set_errno to os_maybe_set_errno.

diff --git a/ChangeLog b/ChangeLog
index daba4ea..04ca6d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,15 @@
        returning void. It works, but is funky, and I think some
        compilers will complain.
 
+       Unrelated. Clean up the calls to w32_maybe_set_errno.
+
+       * awk.h (os_maybe_set_errno): Add declaration.
+       * builtin.c (wrerror): Replaced ifdef'ed code calling
+       w32_maybe_set_errno() with simple call to os_maybe_set_errno().
+       * io.c (non_fatal_flush_std_file, close_io): Ditto.
+       * main.c (usage, copyleft): Ditto.
+       * nonposix.h (w32_maybe_set_errno): Remove declaration.
+
 2021-11-30         Andrew J. Schorr      <aschorr@telemetry-investments.com>
 
        Improve output redirection error handling for problems not detected
diff --git a/awk.h b/awk.h
index ab088f1..9b09eab 100644
--- a/awk.h
+++ b/awk.h
@@ -1607,6 +1607,7 @@ extern int os_isreadable(const awk_input_buf_t *iobuf, 
bool *isdir);
 extern int os_is_setuid(void);
 extern int os_setbinmode(int fd, int mode);
 extern void os_restore_mode(int fd);
+extern void os_maybe_set_errno(void);
 extern size_t optimal_bufsize(int fd, struct stat *sbuf);
 extern int ispath(const char *file);
 extern int isdirpunct(int c);
diff --git a/builtin.c b/builtin.c
index 766f7ce..d77d276 100644
--- a/builtin.c
+++ b/builtin.c
@@ -102,10 +102,8 @@ fatal(_("attempt to use array `%s' in a scalar context"), 
array_vname(s1)); \
 static void
 wrerror(FILE *fp, const char *from, struct redirect *rp)
 {
-#ifdef __MINGW32__
-       if (errno == 0 || errno == EINVAL)
-               w32_maybe_set_errno();
-#endif
+       os_maybe_set_errno();
+
        /* for stdout, die with a real SIGPIPE, like other awks */
        if (fp == stdout && errno == EPIPE)
                die_via_sigpipe();
diff --git a/io.c b/io.c
index bcaff3c..0da8699 100644
--- a/io.c
+++ b/io.c
@@ -1463,10 +1463,8 @@ non_fatal_flush_std_file(FILE *fp)
                bool is_fatal = ! is_non_fatal_std(fp);
 
                if (is_fatal) {
-#ifdef __MINGW32__
-                       if (errno == 0 || errno == EINVAL)
-                               w32_maybe_set_errno();
-#endif
+                       os_maybe_set_errno();
+
                        if (errno == EPIPE)
                                die_via_sigpipe();
                        else
@@ -1563,10 +1561,8 @@ close_io(bool *stdio_problem, bool *got_EPIPE)
        *stdio_problem = false;
        /* we don't warn about stdout/stderr if EPIPE, but we do error exit */
        if (fflush(stdout) != 0) {
-#ifdef __MINGW32__
-               if (errno == 0 || errno == EINVAL)
-                       w32_maybe_set_errno();
-#endif
+               os_maybe_set_errno();
+
                if (errno != EPIPE)
                        warning(_("error writing standard output: %s"), 
strerror(errno));
                else
@@ -1576,10 +1572,8 @@ close_io(bool *stdio_problem, bool *got_EPIPE)
                *stdio_problem = true;
        }
        if (fflush(stderr) != 0) {
-#ifdef __MINGW32__
-               if (errno == 0 || errno == EINVAL)
-                       w32_maybe_set_errno();
-#endif
+               os_maybe_set_errno();
+
                if (errno != EPIPE)
                        warning(_("error writing standard error: %s"), 
strerror(errno));
                else
diff --git a/main.c b/main.c
index 288833a..f666619 100644
--- a/main.c
+++ b/main.c
@@ -654,10 +654,8 @@ By default it reads standard input and writes standard 
output.\n\n"), fp);
        fflush(fp);
 
        if (ferror(fp)) {
-#ifdef __MINGW32__
-               if (errno == 0 || errno == EINVAL)
-                       w32_maybe_set_errno();
-#endif
+               os_maybe_set_errno();
+
                /* don't warn about stdout/stderr if EPIPE, but do error exit */
                if (errno == EPIPE)
                        die_via_sigpipe();
@@ -704,10 +702,8 @@ along with this program. If not, see 
http://www.gnu.org/licenses/.\n";);
        fflush(stdout);
 
        if (ferror(stdout)) {
-#ifdef __MINGW32__
-               if (errno == 0 || errno == EINVAL)
-                       w32_maybe_set_errno();
-#endif
+               os_maybe_set_errno();
+
                /* don't warn about stdout if EPIPE, but do error exit */
                if (errno != EPIPE)
                        warning(_("error writing standard output: %s"), 
strerror(errno));
diff --git a/nonposix.h b/nonposix.h
index 35359ab..b975f75 100644
--- a/nonposix.h
+++ b/nonposix.h
@@ -56,7 +56,6 @@ unsigned int getegid (void);
 /* gawkmisc.pc */
 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
diff --git a/pc/ChangeLog b/pc/ChangeLog
index ba9334f..d2b2c56 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -1,3 +1,8 @@
+2021-12-01         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * gawkmisc.pc (os_maybe_set_errno): Renamed from
+       w32_maybe_set_errno. Add check for errno values.
+
 2021-11-21         Arnold D. Robbins     <arnold@skeeve.com>
 
        * Makefile.tst: Regenerated.
diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc
index 1843a16..149ea62 100644
--- a/pc/gawkmisc.pc
+++ b/pc/gawkmisc.pc
@@ -1066,25 +1066,27 @@ w32_status_to_termsig (unsigned status)
 }
 
 void
-w32_maybe_set_errno (void)
+os_maybe_set_errno (void)
 {
-  DWORD w32err = GetLastError ();
-
-  switch (w32err)
-    {
-      /* When stdout is redirected to a pipe, and the program that
-        reads the pipe (e.g., a pager) exits, Windows doesn't set
-        errno to a useful value.  Help it DTRT.  */
-      case ERROR_BAD_PIPE:
-      case ERROR_PIPE_BUSY:
-      case ERROR_NO_DATA:
-      case ERROR_PIPE_NOT_CONNECTED:
-       errno = EPIPE;
-       break;
-      default:
-       errno = EINVAL;
-       break;
-    }
+  if (errno == 0 || errno == EINVAL) {
+    DWORD w32err = GetLastError ();
+
+    switch (w32err)
+      {
+        /* When stdout is redirected to a pipe, and the program that
+        reads the pipe (e.g., a pager) exits, Windows doesn't set
+        errno to a useful value.  Help it DTRT.  */
+        case ERROR_BAD_PIPE:
+        case ERROR_PIPE_BUSY:
+        case ERROR_NO_DATA:
+        case ERROR_PIPE_NOT_CONNECTED:
+       errno = EPIPE;
+       break;
+        default:
+       errno = EINVAL;
+       break;
+      }
+  }
 }
 
 #endif /* __MINGW32__ */
diff --git a/posix/ChangeLog b/posix/ChangeLog
index 0553a19..06b16f7 100644
--- a/posix/ChangeLog
+++ b/posix/ChangeLog
@@ -1,3 +1,7 @@
+2021-12-01         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * gawkmisc.c (os_maybe_set_errno): New, empty function.
+
 2021-10-27         Arnold D. Robbins     <arnold@skeeve.com>
 
        * 5.1.1: Release tar ball made.
diff --git a/posix/gawkmisc.c b/posix/gawkmisc.c
index 10c543c..e6f316c 100644
--- a/posix/gawkmisc.c
+++ b/posix/gawkmisc.c
@@ -290,6 +290,11 @@ init_sockets(void)
 {
 }
 
+void
+os_maybe_set_errno(void)
+{
+}
+
 // For MSYS, restore behavior of working in text mode.
 #ifdef __MSYS__
 void
diff --git a/vms/ChangeLog b/vms/ChangeLog
index fa2a0fb..1f332f5 100644
--- a/vms/ChangeLog
+++ b/vms/ChangeLog
@@ -1,3 +1,7 @@
+2021-12-01         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * gawkmisc.vms (os_maybe_set_errno): New, empty function.
+
 2021-10-27         Arnold D. Robbins     <arnold@skeeve.com>
 
        * 5.1.1: Release tar ball made.
diff --git a/vms/gawkmisc.vms b/vms/gawkmisc.vms
index c4a2f08..23246bd 100644
--- a/vms/gawkmisc.vms
+++ b/vms/gawkmisc.vms
@@ -660,3 +660,8 @@ void
 init_sockets(void)
 {
 }
+
+void
+os_maybe_set_errno(void)
+{
+}

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=4285d605b8c0cbe4e0b15724af1b4bd223f25403

commit 4285d605b8c0cbe4e0b15724af1b4bd223f25403
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Dec 1 22:33:47 2021 +0200

    Don't use return in a call to a void function.

diff --git a/ChangeLog b/ChangeLog
index b5b21ba..daba4ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,18 @@
+2021-12-01         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * builtin.c (efflush): Don't use return in call of function
+       returning void. It works, but is funky, and I think some
+       compilers will complain.
+
 2021-11-30         Andrew J. Schorr      <aschorr@telemetry-investments.com>
 
        Improve output redirection error handling for problems not detected
        until the final flush or close. Thanks to Miguel Pineiro Jr.
        <mpj@pineiro.cc> for the bug report and suggesting a fix.
+
        * awk.h (efflush): Add declaration.
        * builtin.c (efwrite): Break up into 3 functions by moving the
-       flushing logic into efflush and the error handling loginc into
+       flushing logic into efflush and the error handling logic into
        wrerror.
        (wrerror): New function containing the error-handling logic extracted
        from efwrite.
diff --git a/builtin.c b/builtin.c
index cc17a42..766f7ce 100644
--- a/builtin.c
+++ b/builtin.c
@@ -132,11 +132,11 @@ efflush(FILE *fp, const char *from, struct redirect *rp)
        if (rp != NULL) {
                rp->output.gawk_fflush(fp, rp->output.opaque);
                if (rp->output.gawk_ferror(fp, rp->output.opaque))
-                       return wrerror(fp, from, rp);
+                       wrerror(fp, from, rp);
        } else {
                fflush(fp);
                if (ferror(fp))
-                       return wrerror(fp, from, rp);
+                       wrerror(fp, from, rp);
        }
 }
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog        | 18 +++++++++++++++++-
 awk.h            |  1 +
 builtin.c        | 10 ++++------
 io.c             | 18 ++++++------------
 main.c           | 12 ++++--------
 nonposix.h       |  1 -
 pc/ChangeLog     |  5 +++++
 pc/gawkmisc.pc   | 38 ++++++++++++++++++++------------------
 posix/ChangeLog  |  4 ++++
 posix/gawkmisc.c |  5 +++++
 vms/ChangeLog    |  4 ++++
 vms/gawkmisc.vms |  5 +++++
 12 files changed, 75 insertions(+), 46 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]