Paolo Bonzini wrote:
> * src/dfa.c (position_set): Change nelem to a size_t.
> ---
> src/dfa.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/dfa.c b/src/dfa.c
> index 03676b0..491f447 100644
> --- a/src/dfa.c
> +++ b/src/dfa.c
> @@ -246,7 +246,7 @@ typedef struct
> typedef struct
> {
> position *elems; /* Elements of this position set. */
> - int nelem; /* Number of elements in this set. */
> + size_t nelem; /* Number of elements in this set. */
That change induces these new warnings/errors:
dfa.c: In function 'dfaanalyze':
dfa.c:2165:13: error: comparison of unsigned expression >= 0 is always true
[-Werror=type-limits]
dfa.c:2185:13: error: comparison of unsigned expression >= 0 is always true
[-Werror=type-limits]
dfa.c:2294:9: error: comparison of unsigned expression >= 0 is always true
[-Werror=type-limits]
Fortunately, it's easy to avoid those by removing the offending
assertion from REALLOC_IF_NECESSARY. Please squash this into your
change-set:
diff --git a/src/dfa.c b/src/dfa.c
index 491f447..db6058e 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -430,7 +430,6 @@ static void regexp (void);
#define REALLOC_IF_NECESSARY(p, n_alloc, n_required) \
do \
{ \
- assert (0 <= (n_required)); \
if ((n_alloc) <= (n_required)) \
{ \
size_t new_n_alloc = (n_required) + !(p); \
I would have preferred to retain it as long as some n_required
variables are still signed, but if that condition ever becomes false,
we will eventually find out via other means.