lib/intprops.h


Log

Author Commit Date CI Message
Jim Meyering 1602f0af 2012-01-01T10:04:58 maint: update all copyright year number ranges Run "make update-copyright".
Jim Meyering cf2b9e84 2011-05-28T13:45:12 intprops.h: adjust another comment to match code change * lib/intprops.h (_GL_INT_SIGNED): Now, E may have side effects.
Jim Meyering dabf3a8d 2011-05-28T12:34:08 intprops.h: adjust comment to match code change * lib/intprops.h (_GL_INT_CONVERT): Adjust comment: now that E is used only once, it *may* have side effects. Also fix an unrelated typo.
Paul Eggert 8aad2a7b 2011-05-24T16:45:14 intprops: shorten, to pacify gcc -Woverlength-strings * lib/intprops.h (_GL_INT_CONVERT, _GL_INT_NEGATE_CONVERT): (_GL_BINARY_OP_OVERFLOW): Say "0 * (x)" rather than "(x) - (x)", so that, for example, verify (INT_MULTIPLY_OVERFLOW (...)) is less likely to run afoul of C compiler limits for string constant lengths. See <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00528.html>.
Paul Eggert 48552f31 2011-05-20T11:30:16 intprops: remove assumption about A|B representation * lib/intprops.h (_GL_BINARY_OP_OVERFLOW): Do not assume that A|B is a valid integer if both A and B are. Although this is true for all known practical hosts, the C standard doesn't guarantee it, and the code need not assume it. Also, this change may work around HP-UX 11.23 and IRIX 6.5 cc bugs reported by Bruno Haible in <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00426.html>.
Paul Eggert 92c71a1c 2011-05-19T19:16:04 intprops: work around IRIX 6.5 cc bug with 0u - 0u + -1 See http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00406.html * lib/intprops.h (_GL_INT_NEGATE_CONVERT): New macro. (_GL_INT_SIGNED, _GL_INT_MAXIMUM, _GL_DIVIDE_OVERFLOW): (_GL_REMAINDER_OVERFLOW): Use it.
Paul Eggert 8cc0fee0 2011-05-19T01:36:25 intprops: work around C compiler bugs * lib/intprops.h (INT_MULTIPLY_RANGE_OVERFLOW): Work around compiler bug in Sun C 5.11 2010/08/13 and other compilers; see <http://lists.gnu.org/archive/html/bug-gnulib/2011-05/msg00401.html>.
Paul Eggert e873fd36 2011-05-15T09:35:12 intprops: add safe, portable integer overflow checking * lib/intprops.h (_GL_INT_CONVERT, _GL_INT_TWOS_COMPLEMENT): (_GL_INT_SIGNED, _GL_INT_MINIMUM, _GL_INT_MAXIMUM): (_GL_SIGNED_INT_MINIMUM, INT_ADD_RANGE_OVERFLOW): (INT__SUBTRACT__RANGE_OVERFLOW, INT_NEGATE_RANGE_OVERFLOW): (INT_MULTIPLY_RANGE_OVERFLOW, INT_REMAINDER_RANGE_OVERFLOW): (INT_LEFT_SHIFT_RANGE_OVERFLOW, _GL_ADD_OVERFLOW): (_GL__SUBTRACT__OVERFLOW, _GL_MULTIPLY_OVERFLOW, _GL_DIVIDE_OVERFLOW): (_GL_REMAINDER_OVERFLOW, _GL_UNSIGNED_NEG_MULTIPLE, INT_ADD_OVERFLOW): (INT__SUBTRACT__OVERFLOW, INT_NEGATE_OVERFLOW, INT_MULTIPLY_OVERFLOW): (INT_DIVIDE_OVERFLOW, INT_REMAINDER_OVERFLOW): (INT_LEFT_SHIFT_OVERFLOW, _GL_BINARY_OP_OVERFLOW): New macros.
Paul Eggert 65dc5d65 2011-05-08T12:28:01 intprops: Sun C 5.11 supports __typeof__ * lib/intprops.h (_GL_HAVE___TYPEOF__): New macro, which is set for either GCC 2 or later, as before, or for Sun C 5.11 or later, which is new. (_GL_SIGNED_TYPE_OR_EXPR): Use it.
Paul Eggert f40658a3 2011-05-08T11:53:53 intprops: switch to usual gnulib indenting and naming * lib/intprops.h (_GL_INTPROPS_H): Rename from GL_INTPROPS_H. (_GL_SIGNED_TYPE_OR_EXPR): Rename from signed_type_or_expr__. * tests/test-inttostr.c (IS_TIGHT): Adjust to above renaming.
Paul Eggert ee9e39c0 2011-01-29T23:59:31 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.
Jim Meyering d60f3b0c 2011-01-01T20:17:23 maint: update almost all copyright ranges to include 2011 Run the new "make update-copyright" rule.
Paul Eggert 7b3b57be 2010-11-17T16:29:40 intprops: new macro INT_BITS_STRLEN_BOUND * lib/intprops.h (INT_BITS_STRLEN_BOUND): New macro, needed by ftoastr.h. This exposes an internal of intprops.h that was formerly not exposed. Also, it uses a slightly tighter bound than before; though this makes no practical difference, we might as well be as tight as we easily can.
Jim Meyering b2e2010c 2010-01-01T10:31:12 update nearly all FSF copyright year lists to include 2010 Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
Bruno Haible 441aa304 2009-12-10T20:28:30 Use spaces for indentation, not tabs.
Eric Blake fdac57e8 2009-11-14T15:09:08 intprops: add double-inclusion guard * lib/intprops.h: Allow idempotent includes. Suggested by Bruce Korb. Signed-off-by: Eric Blake <ebb9@byu.net>
Bruno Haible 57fdfd3f 2007-10-07T19:14:58 Change copyright notice from GPLv2+ to GPLv3+.
Jim Meyering add25498 2005-09-27T08:40:36 (signed_type_or_expr__): Define. (INT_STRLEN_BOUND) [__GNUC__]: Use a slightly tighter bound for unsigned types.
Paul Eggert 267a39ba 2005-05-14T06:03:57 *** empty log message ***
Paul Eggert d3aea660 2005-03-26T17:53:44 one's complement -> ones' complement (as per Knuth)
Paul Eggert d6913e92 2005-03-26T17:47:53 (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): "value of type" -> "type or expression" in comment.
Jim Meyering 8baf2fec 2005-03-26T11:10:52 Comment nits. Add the apostrophe in `(one|two)'s complement'. Correct typos: s/or/of/.
Paul Eggert b6097b0f 2005-03-09T23:22:50 Add TYPE_ONES_COMPLEMENT and TYPE_SIGNED_MAGNITUDE, and use less-tricky TYPE_MINIMUM and TYPE_MAXIMUM.
Paul Eggert eef56b54 2005-03-09T19:11:23 Factor int-properties macros into a single file, except for glibc-related files. * lib/intprops.h: New file. * lib/getloadavg.c: Include it instead of limits.h. (INT_STRLEN_BOUND): Remove. * lib/human.c: Include intprops.h. (group_number): Use INT_STRLEN_BOUND instead of rolling it ourself. * lib/human.h (LONGEST_HUMAN_READABLE): Use 146/485 rather than 302/1000. * lib/inttostr.h: Include intprops.h instead of limits.h. (INT_STRLEN_BOUND, INT_BUFSIZE_BOUND): Remove. * lib/mktime.c (TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT): New macros, for consistency with intprops.h. (time_t_is_integer, twos_complement_arithmetic): Use them. * lib/sig2str.h: Include <signal.h>, intprops.h. (INT_STRLEN_BOUND): Remove. * lib/strftime.c (TYPE_SIGNED): Remove. (INT_STRLEN_BOUND): Switch to same implementation as intprops.h. * lib/strtol.c: Adjust comments to match intprops.h. * lib/userspec.c: Include intprops.h. (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove. * lib/utimecmp.c, lib/xnanosleep.c, lib/xstrtol.c: Likewise. * lib/utimecmp.c (utimecmp): Use TYPE_IS_INTEGER, TYPE_TWOS_COMPLEMENT instead of rolling our own expressions. * lib/xstrtol.c: Include xstrtol.h first, to test interface. * modules/getloadavg (Files): Add lib/intprops.h. * modules/human (Files): Likewise. * modules/inttostr (Files): Likewise. * modules/sig2str (Files): Likewise. * modules/userspec (Files): Likewise. * modules/utimecmp (Files): Likewise. * modules/xnanosleep (Files): Likewise. * modules/xstrtol (Files): Likewise.