grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.20-50-g3e09538


From: Paul Eggert
Subject: grep branch, master, updated. v2.20-50-g3e09538
Date: Sat, 27 Sep 2014 22:32:29 +0000

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  3e09538374d9f03c735e86c98bbf41191f73906a (commit)
      from  40e0d268606ff41814ba3e0f987239e2fad1b8e6 (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=3e09538374d9f03c735e86c98bbf41191f73906a


commit 3e09538374d9f03c735e86c98bbf41191f73906a
Author: Paul Eggert <address@hidden>
Date:   Sat Sep 27 15:31:12 2014 -0700

    maint: generalize the -Wcast-align fix
    
    * src/grep.c (CAST_ALIGNED): New macro.
    (skip_easy_bytes): Use it.

diff --git a/src/grep.c b/src/grep.c
index 207bdea..bb5ba1c 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -469,6 +469,21 @@ init_easy_encoding (void)
     easy_encoding &= mbclen_cache[i] == 1;
 }
 
+/* A cast to TYPE of VAL.  Use this when TYPE is a pointer type, VAL
+   is properly aligned for TYPE, and 'gcc -Wcast-align' cannot infer
+   the alignment and would otherwise complain about the cast.  */
+#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+# define CAST_ALIGNED(type, val)                           \
+    ({ __typeof__ (val) val_ = val;                        \
+       _Pragma ("GCC diagnostic push")                     \
+       _Pragma ("GCC diagnostic ignored \"-Wcast-align\"") \
+       (type) val_;                                        \
+       _Pragma ("GCC diagnostic pop")                      \
+    })
+#else
+# define CAST_ALIGNED(type, val) ((type) (val))
+#endif
+
 /* An unsigned type suitable for fast matching.  */
 typedef uintmax_t uword;
 
@@ -496,15 +511,8 @@ skip_easy_bytes (char const *buf)
   for (p = buf; (uintptr_t) p % sizeof (uword) != 0; p++)
     if (*p & HIBYTE)
       return p;
-
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wcast-align"
-  /* We have aligned P to a uword boundary, so we can safely
-     tell gcc to suppress its cast-alignment warning.  */
-  for (s = (uword const *) p; ! (*s & hibyte_mask); s++)
+  for (s = CAST_ALIGNED (uword const *, p); ! (*s & hibyte_mask); s++)
     continue;
-#pragma GCC diagnostic pop
-
   for (p = (char const *) s; ! (*p & HIBYTE); p++)
     continue;
   return p;

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

Summary of changes:
 src/grep.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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