TYPE_MAXIMUM: avoid theoretically undefined behavior
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 30 Jan 2011 07:59:31 +0000 (23:59 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 30 Jan 2011 08:00:00 +0000 (00:00 -0800)
commitee9e39c014e2880179c91960ce1f69309d0c1500
tree11654c2892678ea15c6fa939af91e1062bb1eb31
parent56887e878833f53c8ca55371c0e4be66388e157b
TYPE_MAXIMUM: avoid theoretically undefined behavior

* lib/intprops.h (TYPE_MINIMUM, TYPE_MAXIMUM): Do not shift a
negative number, which the C Standard says has undefined behavior.
In practice this is not a problem, but might as well do it by the book.
Reported by Rich Felker and Eric Blake; see
<http://lists.gnu.org/archive/html/bug-gnulib/2011-01/msg00493.html>.
* lib/strtol.c (TYPE_MINIMUM, TYPE_MAXIMUM): Likewise.
* m4/mktime.m4 (AC_FUNC_MKTIME): Likewise.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Likewise.
* m4/parse-datetime.m4 (gl_PARSE_DATETIME): Likewise.
* m4/stdint.m4 (gl_STDINT_H): Likewise.
* lib/mktime.c (TYPE_MAXIMUM): Redo slightly to match the others.
ChangeLog
lib/intprops.h
lib/mktime.c
lib/strtol.c
m4/mktime.m4
m4/nanosleep.m4
m4/parse-datetime.m4
m4/stdint.m4