From: Jim Meyering Date: Sat, 28 May 2011 18:58:14 +0000 (+0200) Subject: parse-datetime.y: accommodate -Wstrict-overflow X-Git-Tag: v0.1~2683 X-Git-Url: http://erislabs.net/gitweb/?a=commitdiff_plain;h=a8ff65c;p=gnulib.git parse-datetime.y: accommodate -Wstrict-overflow * lib/parse-datetime.y (yylex): Rearrange pointer arithmetic to placate -Wstrict-overflow. --- diff --git a/ChangeLog b/ChangeLog index 5de6fa7ff..f9ee06b01 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2011-05-28 Jim Meyering + parse-datetime.y: accommodate -Wstrict-overflow + * lib/parse-datetime.y (yylex): Rearrange pointer arithmetic to + placate -Wstrict-overflow. + trim: avoid a warning from -O2 -Wstrict-overflow * lib/trim.c (trim2): Declare local to be "unsigned int", not "int". diff --git a/lib/parse-datetime.y b/lib/parse-datetime.y index d77955f40..23a9a4159 100644 --- a/lib/parse-datetime.y +++ b/lib/parse-datetime.y @@ -1119,7 +1119,7 @@ yylex (YYSTYPE *lvalp, parser_control *pc) do { - if (p < buff + sizeof buff - 1) + if (p - buff < sizeof buff - 1) *p++ = c; c = *++pc->input; }