grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.25-107-gf2751ef


From: Jim Meyering
Subject: grep branch, master, updated. v2.25-107-gf2751ef
Date: Thu, 29 Sep 2016 05:15:53 +0000 (UTC)

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 "grep".

The branch, master has been updated
       via  f2751efd87c91576fcac1033a5919d363967a838 (commit)
       via  0e1f38d1402abcfbd9dec29103c68f86609ed28c (commit)
      from  e9e7ee1cc9372e8699f2b183fb3aedb608f2304d (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.savannah.gnu.org/cgit/grep.git/commit/?id=f2751efd87c91576fcac1033a5919d363967a838


commit f2751efd87c91576fcac1033a5919d363967a838
Author: Jim Meyering <address@hidden>
Date:   Wed Sep 28 22:08:07 2016 -0700

    build: placate GCC 7's -Wimplicit-fallthrough
    
    * src/pcresearch.c (die): New macro.
    (Pexecute): Use it in place of offending uses of error,
    to placate GCC 7's -Wimplicit-fallthrough.
    Include verify.h.  Since this is grep's first explicit use of this
    gnulib module, ...
    * bootstrap.conf (gnulib_modules): Add verify.

diff --git a/bootstrap.conf b/bootstrap.conf
index 3b12061..5ee69cd 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -88,6 +88,7 @@ unistd
 unlocked-io
 update-copyright
 useless-if-before-free
+verify
 version-etc-fsf
 wchar
 wcrtomb
diff --git a/src/pcresearch.c b/src/pcresearch.c
index 9ffa22a..6e192e3 100644
--- a/src/pcresearch.c
+++ b/src/pcresearch.c
@@ -20,6 +20,19 @@
 
 #include <config.h>
 #include "search.h"
+#include "verify.h"
+
+/* Wrap a fatal 3-argument use of "error" (with literal nonzero exit
+   status), so that static analyzers like clang-analyzer and GCC 7's
+   -Wimplicit-fallthrough know this "function" does not return.  */
+#define die(st, fmt, arg)                                              \
+  do                                                                   \
+    {                                                                  \
+      verify ((st) != 0);                                              \
+      error (0, fmt, arg);                                             \
+      exit (st);                                                       \
+    }                                                                  \
+  while (0)
 
 #if HAVE_LIBPCRE
 # include <pcre.h>
@@ -337,15 +350,15 @@ Pexecute (char *buf, size_t size, size_t *match_size,
           break;
 
         case PCRE_ERROR_NOMEMORY:
-          error (EXIT_TROUBLE, 0, _("memory exhausted"));
+          die (EXIT_TROUBLE, 0, _("memory exhausted"));
 
 # if PCRE_STUDY_JIT_COMPILE
         case PCRE_ERROR_JIT_STACKLIMIT:
-          error (EXIT_TROUBLE, 0, _("exhausted PCRE JIT stack"));
+          die (EXIT_TROUBLE, 0, _("exhausted PCRE JIT stack"));
 # endif
 
         case PCRE_ERROR_MATCHLIMIT:
-          error (EXIT_TROUBLE, 0, _("exceeded PCRE's backtracking limit"));
+          die (EXIT_TROUBLE, 0, _("exceeded PCRE's backtracking limit"));
 
         default:
           /* For now, we lump all remaining PCRE failures into this basket.

http://git.savannah.gnu.org/cgit/grep.git/commit/?id=0e1f38d1402abcfbd9dec29103c68f86609ed28c


commit f2751efd87c91576fcac1033a5919d363967a838
Author: Jim Meyering <address@hidden>
Date:   Wed Sep 28 22:08:07 2016 -0700

    build: placate GCC 7's -Wimplicit-fallthrough
    
    * src/pcresearch.c (die): New macro.
    (Pexecute): Use it in place of offending uses of error,
    to placate GCC 7's -Wimplicit-fallthrough.
    Include verify.h.  Since this is grep's first explicit use of this
    gnulib module, ...
    * bootstrap.conf (gnulib_modules): Add verify.

diff --git a/bootstrap.conf b/bootstrap.conf
index 3b12061..5ee69cd 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -88,6 +88,7 @@ unistd
 unlocked-io
 update-copyright
 useless-if-before-free
+verify
 version-etc-fsf
 wchar
 wcrtomb
diff --git a/src/pcresearch.c b/src/pcresearch.c
index 9ffa22a..6e192e3 100644
--- a/src/pcresearch.c
+++ b/src/pcresearch.c
@@ -20,6 +20,19 @@
 
 #include <config.h>
 #include "search.h"
+#include "verify.h"
+
+/* Wrap a fatal 3-argument use of "error" (with literal nonzero exit
+   status), so that static analyzers like clang-analyzer and GCC 7's
+   -Wimplicit-fallthrough know this "function" does not return.  */
+#define die(st, fmt, arg)                                              \
+  do                                                                   \
+    {                                                                  \
+      verify ((st) != 0);                                              \
+      error (0, fmt, arg);                                             \
+      exit (st);                                                       \
+    }                                                                  \
+  while (0)
 
 #if HAVE_LIBPCRE
 # include <pcre.h>
@@ -337,15 +350,15 @@ Pexecute (char *buf, size_t size, size_t *match_size,
           break;
 
         case PCRE_ERROR_NOMEMORY:
-          error (EXIT_TROUBLE, 0, _("memory exhausted"));
+          die (EXIT_TROUBLE, 0, _("memory exhausted"));
 
 # if PCRE_STUDY_JIT_COMPILE
         case PCRE_ERROR_JIT_STACKLIMIT:
-          error (EXIT_TROUBLE, 0, _("exhausted PCRE JIT stack"));
+          die (EXIT_TROUBLE, 0, _("exhausted PCRE JIT stack"));
 # endif
 
         case PCRE_ERROR_MATCHLIMIT:
-          error (EXIT_TROUBLE, 0, _("exceeded PCRE's backtracking limit"));
+          die (EXIT_TROUBLE, 0, _("exceeded PCRE's backtracking limit"));
 
         default:
           /* For now, we lump all remaining PCRE failures into this basket.

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

Summary of changes:
 bootstrap.conf   |    1 +
 gnulib           |    2 +-
 src/pcresearch.c |   19 ++++++++++++++++---
 3 files changed, 18 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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