[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] regcomp.c: avoid the sole warning from gcc's -Wtype-limits
From: |
Jim Meyering |
Subject: |
[PATCH] regcomp.c: avoid the sole warning from gcc's -Wtype-limits |
Date: |
Wed, 03 Feb 2010 18:04:50 +0100 |
This may be the final piece I require to allow grep to use gnulib's
regex module:
>From 9d0ad652de159d08e5f679842f8a2a5658196361 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 3 Feb 2010 18:01:36 +0100
Subject: [PATCH] regcomp.c: avoid the sole warning from gcc's -Wtype-limits
* lib/regcomp.c (TYPE_SIGNED): Define.
(parse_dup_op): Use it to avoid the sole warning from -Wtype-limits.
---
ChangeLog | 4 ++++
lib/regcomp.c | 6 +++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fb38064..093bdcf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2010-02-03 Jim Meyering <address@hidden>
+ regcomp.c: avoid the sole warning from gcc's -Wtype-limits
+ * lib/regcomp.c (TYPE_SIGNED): Define.
+ (parse_dup_op): Use it to avoid the sole warning from -Wtype-limits.
+
regcomp.c: avoid a new -Wshadow warning
* lib/regcomp.c (create_initial_state): Do not shadow local "err".
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 32997cc..d5968bd 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -2577,10 +2577,14 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp,
re_dfa_t *dfa,
if (BE (tree == NULL, 0))
goto parse_dup_op_espace;
+/* From gnulib's "intprops.h":
+ True if the arithmetic type T is signed. */
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+
/* This loop is actually executed only when end != REG_MISSING,
to rewrite <re>{0,n} as (<re>(<re>...<re>?)?)?... We have
already created the start+1-th copy. */
- if ((Idx) -1 < 0 || end != REG_MISSING)
+ if (TYPE_SIGNED (Idx) || end != REG_MISSING)
for (i = start + 2; i <= end; ++i)
{
elem = duplicate_tree (elem, dfa);
--
1.7.0.rc1.193.ge8618
- [PATCH] regcomp.c: avoid the sole warning from gcc's -Wtype-limits,
Jim Meyering <=