annotate modules/stdint-tests @ 6906:b912515df187

Simplification rewrite for stdint module. * modules/inttypes (Depends-on): No longer depends on stdint. * modules/stdint (Description): Say more about assumptions. Say that the fast types might differ. Say macros are used. (Files): Remove m4/size_max.m4, m4/wchar_t.m4. Add m4/longlong.m4. (Makefile.am): Revise list of substituted symbols to match new stdint.m4. * modules/stdint-tests (Files): Add m4/wchar_t.m4, m4/wint_t.m4. (configure.ac): Add gt_TYPE_WCHAR_T, gt_TYPE_WINT_T. * tests/test-stdint.c (verify_same_types) [! (__GNUC__ >= 2 && DO_PEDANTIC)]: Put in a decl, so that the code conforms to C99/C89. Test for WCHAR_MIN and WCHAR_MAX only if HAVE_WCHAR_T. Test for WINT_MIN and WINT_MAX only if HAVE_WINT_T. * lib/stdint_.h (_GL_STDINT_H): Renamed from _STDINT_H, to avoid possible collision with system files. (<stdio.h>, <time.h>, <wchar.h>) [defined __cplusplus && ! defined __STDC_CONSTANT_MACROS)]: Do not include, since we don't need WCHAR_MIN and WCHAR_MAX in this case. (<stddef.h>): Do not include; no longer needed. (<sys/types.h>): Include if @HAVE_SYS_TYPES_H@, not if (defined(__OpenBSD__) || defined(__bsdi__) || defined(__sgi)). (<sys/inttypes.h>): Include if @HAVE_SYS_INTTYPES_H@ && !@HAVE_INTTYPES_H@, not if (defined(__FreeBSD__) && (__FreeBSD__ >= 3) && (__FreeBSD__ <= 4)). (__STDINT_H__) [@HAVE_STDINT_H@ && defined __sgi && ! defined __c99]: Define, to work around IRIX <stdint.h> incompatibility. (@FULL_PATH_STDINT_H@) [!(defined(__sgi) && @HAVE_INTTYPES_H@ && !defined(__c99))]: Include in this case too, since it's harmless now. (<inttypes.h>) [@HAVE_INTTYPES_H@]: Include, since it's no longer dangerous to do so. (@FULL_PATH_INTTYPES_H@) [(defined(__hpux) || defined(_AIX)) && @HAVE_INTTYPES_H@]: Do not include, since we now include <inttypes.h>. (_STDINT_MIN, _STDINT_MAX): New macros. (int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t): (uint64_t, int_least8_t, uint_least8_t, int_least16_t): (uint_least16_t, int_least32_t, uint_least32_t, int_least64_t): (uint_least64_t, int_fast8_t, uint_fast8_t, int_fast16_t): (uint_fast16_t, int_fast32_t, uint_fast32_t, int_fast64_t): (uint_fast64_t, intptr_t, uintptr_t, intmax_t, uintmax_t): Now macros, not typedefs; this simplifies things quite a bit. Use long int for all types narrower than int64_t. (intmax_t, uintmax_t, INTMAX_C, UINTMAX_C): Define in terms of long long int or int64_t or long int, not int64_t or int32_t. This saves some compile-time testing. (INT8_MIN, INT8_MAX, UINT8_MAX, INT16_MIN, INT16_MAX, UINT16_MAX): (INT32_MIN, INT32_MAX, UINT32_MAX, INT64_MIN, INT64_MAX): (UINT64_MAX, INT_LEAST8_MIN, INT_LEAST8_MAX, UINT_LEAST8_MAX): (INT_LEAST16_MIN, INT_LEAST16_MAX, UINT_LEAST16_MAX): (INT_LEAST32_MIN, INT_LEAST32_MAX, UINT_LEAST32_MAX): (INT_LEAST64_MIN, INT_LEAST64_MAX, UINT_LEAST64_MAX, INT_FAST8_MIN): (INT_FAST8_MAX, UINT_FAST8_MAX, INT_FAST16_MIN, INT_FAST16_MAX): (UINT_FAST16_MAX, INT_FAST32_MIN, INT_FAST32_MAX, UINT_FAST32_MAX): (INT_FAST64_MIN, INT_FAST64_MAX, UINT_FAST64_MAX, INTPTR_MIN): (INTPTR_MAX, UINTPTR_MAX, INTMAX_MIN, INTMAX_MAX, UINTMAX_MAX): (PTRDIFF_MIN, PTRDIFF_MAX, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX): (SIZE_MAX, WCHAR_MIN, WCHAR_MAX, WINT_MIN, WINT_MAX): undef any previous version and define our own version, for simplicity and consistency with the new macros for types. (PTRDIFF_MIN, PTRDIFF_MAX, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX): (SIZE_MAX, WCHAR_MIN, WCHAR_MAX, WINT_MIN, WINT_MAX): Simplify definitions by using _STDINT_MIN and _STDINT_MAX where appropriate. Rely on new symbols @PTRDIFF_T_SUFFIX@, @SIG_ATOMIC_T_SUFFIX@, @SIZE_T_SUFFIX@, @WCHAR_T_SUFFIX@, @WINT_T_SUFFIX@ to keep things simple here. (UINT8_C, UINT16_C, UINT32_C, INT64_C, UINT64_C): Simplify by assuming typical 8/16/32/64 host, since we're already doing that elsewhere anyway. Use (LONG_MAX >> 31 >> 31 == 1) rather than @HAVE_LONG_64BIT@, and assume long long int is 64 bits if available. This speeds up 'configure'. * m4/longlong.m4 (AC_TYPE_LONG_LONG_INT): Backport from Autoconf 2.60, but fix a bug, by requiring at least 64 bits. * m4/ulonglong.m4 (AC_TYPE_UNSIGNED_LONG_LONG_INT): Likewise. * m4/longlong.m4 (gl_AC_TYPE_LONG_LONG): Now just call AC_TYPE_LONG_LONG_INT. This macro is obsolete and will go soon. * m4/ulonglong.m4 (gl_AC_TYPE_UNSIGNED_LONG_LONG) Likewise. * m4/stdint.m4 (gl_STDINT_H): Rewrite to accommodate stdint_.h changes. Make 2.59 a prerequisite. Check and substitute for HAVE_LONG_LONG_INT. Rely on Autoconf to check for stdint.h and inttypes.h. Do not use special include files; just use the defaults. Check for sys/inttypes.h and sys/bitypes.h in the usual way now. Remove no-longer-needed tests for HAVE_LONG_64BIT, HAVE_LONG_LONG_64BIT, int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, uint32_t uint64_t, int_least8_t, int_least16_t, int_least32_t, int_least64_t, uint_least8_t, uint_least16_t, uint_least32_t, uint_least64_t, int_fast8_t, int_fast16_t, int_fast32_t, int_fast64_t, uint_fast8_t uint_fast16_t, uint_fast32_t, uint_fast64_t, intptr_t, uintptr_t, intmax_t, uintmax_t, INT8_MIN, INT8_MAX, UINT8_MAX, INT16_MIN, INT16_MAX, UINT16_MAX, INT32_MIN, INT32_MAX, UINT32_MAX, INT64_MIN, INT64_MAX, UINT64_MAX, INT_LEAST8_MIN, INT_LEAST8_MAX, UINT_LEAST8_MAX, INT_LEAST16_MIN, INT_LEAST16_MAX, UINT_LEAST16_MAX, INT_LEAST32_MIN, INT_LEAST32_MAX, UINT_LEAST32_MAX, INT_LEAST64_MIN, INT_LEAST64_MAX, UINT_LEAST64_MAX, INT_FAST8_MIN, INT_FAST8_MAX, UINT_FAST8_MAX, INT_FAST16_MIN, INT_FAST16_MAX, UINT_FAST16_MAX, INT_FAST32_MIN, INT_FAST32_MAX, UINT_FAST32_MAX, INT_FAST64_MIN, INT_FAST64_MAX, UINT_FAST64_MAX, INTPTR_MIN, INTPTR_MAX, UINTPTR_MAX, INTMAX_MIN, INTMAX_MAX, UINTMAX_MAX, PTRDIFF_MIN, PTRDIFF_MAX, SIG_ATOMIC_MIN, SIG_ATOMIC_MAX, SIZE_MAX, WCHAR_MIN, WCHAR_MAX, WINT_MIN, WINT_MAX. Check for C99 conformance more strictly, by detecting bugs in glibc 2.4, Solaris 10, and OpenBSD 3.9. On the other hand do not check for things that C99 does not require, e.g., int8_t. If a test isn't needed unless <stdint.h> isn't working, and is unlikely to be needed for any other reason, then don't do it unless <stdint.h> isn't working. Do not check for ptrdiff_t or size_t, since we assume C89 freestanding at least. Do not check for sig_atomic_t, wchar_t, or wint_t, since the code now does the right thing even if the types are not defined. Instead use: (gl_STDINT_TYPE_PROPERTIES): New macro. (gl_HEADER_STDINT_H, gl_HEADER_INTTYPES_H): Remove. Don't bother testing whether <sys/types.h> clashes, as Autoconf does this for us now. All uses removed. (gl_STDINT_CHECK_TYPES, gl_STDINT_MISSING_BOUND): (gl_STDINT_MISSING_BOUNDS, gl_STDINT_MISSING_BOUNDS2): (gl_CHECK_TYPE_SAME): Remove; no longer needed. (gl_STDINT_BITSIZEOF): Don't bother to check whether the type exists, since we'll return 0 anyway in that case. (gl_INTEGER_TYPE_SUFFIX, gl_STDINT_INCLUDES): New macros.
author Paul Eggert <eggert@cs.ucla.edu>
date Sun, 02 Jul 2006 06:49:07 +0000
parents b048a64a7f04
children d31f3019f697
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6825
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 Files:
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 tests/test-stdint.c
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6825
diff changeset
3 m4/wchar_t.m4
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6825
diff changeset
4 m4/wint_t.m4
6825
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 Depends-on:
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 verify
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 intprops
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 configure.ac:
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6825
diff changeset
11 gt_TYPE_WCHAR_T
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6825
diff changeset
12 gt_TYPE_WINT_T
6825
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 Makefile.am:
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 TESTS += test-stdint$(EXEEXT)
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 check_PROGRAMS += test-stdint
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 License:
b048a64a7f04 New module 'stdint-tests'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 LGPL