diff options
Diffstat (limited to 'gl/stdint.in.h')
| -rw-r--r-- | gl/stdint.in.h | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/gl/stdint.in.h b/gl/stdint.in.h index fea7483b..f6066094 100644 --- a/gl/stdint.in.h +++ b/gl/stdint.in.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright (C) 2001-2002, 2004-2024 Free Software Foundation, Inc. | 1 | /* Copyright (C) 2001-2002, 2004-2026 Free Software Foundation, Inc. |
| 2 | Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. | 2 | Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. |
| 3 | This file is part of gnulib. | 3 | This file is part of gnulib. |
| 4 | 4 | ||
| @@ -51,13 +51,6 @@ | |||
| 51 | in public interfaces due to compiler differences. */ | 51 | in public interfaces due to compiler differences. */ |
| 52 | 52 | ||
| 53 | #if @HAVE_STDINT_H@ | 53 | #if @HAVE_STDINT_H@ |
| 54 | # if defined __sgi && ! defined __c99 | ||
| 55 | /* Bypass IRIX's <stdint.h> if in C89 mode, since it merely annoys users | ||
| 56 | with "This header file is to be used only for c99 mode compilations" | ||
| 57 | diagnostics. */ | ||
| 58 | # define __STDINT_H__ | ||
| 59 | # endif | ||
| 60 | |||
| 61 | /* Some pre-C++11 <stdint.h> implementations need this. */ | 54 | /* Some pre-C++11 <stdint.h> implementations need this. */ |
| 62 | # ifdef __cplusplus | 55 | # ifdef __cplusplus |
| 63 | # ifndef __STDC_CONSTANT_MACROS | 56 | # ifndef __STDC_CONSTANT_MACROS |
| @@ -80,7 +73,7 @@ | |||
| 80 | #define _@GUARD_PREFIX@_STDINT_H | 73 | #define _@GUARD_PREFIX@_STDINT_H |
| 81 | 74 | ||
| 82 | /* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, | 75 | /* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, |
| 83 | LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ | 76 | LONG_MIN, LONG_MAX, ULONG_MAX, CHAR_BIT, _GL_INTEGER_WIDTH. */ |
| 84 | #include <limits.h> | 77 | #include <limits.h> |
| 85 | 78 | ||
| 86 | /* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides | 79 | /* Override WINT_MIN and WINT_MAX if gnulib's <wchar.h> or <wctype.h> overrides |
| @@ -94,8 +87,8 @@ | |||
| 94 | 87 | ||
| 95 | #if ! @HAVE_C99_STDINT_H@ | 88 | #if ! @HAVE_C99_STDINT_H@ |
| 96 | 89 | ||
| 97 | /* <sys/types.h> defines some of the stdint.h types as well, on glibc, | 90 | /* <sys/types.h> defines some of the stdint.h types as well, on glibc and |
| 98 | IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>). | 91 | OpenBSD 3.8 (via <machine/types.h>). |
| 99 | AIX 5.2 <sys/types.h> isn't needed and causes troubles. | 92 | AIX 5.2 <sys/types.h> isn't needed and causes troubles. |
| 100 | Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but | 93 | Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but |
| 101 | relies on the system <stdint.h> definitions, so include | 94 | relies on the system <stdint.h> definitions, so include |
| @@ -189,6 +182,10 @@ typedef __int64 gl_int64_t; | |||
| 189 | # define int64_t gl_int64_t | 182 | # define int64_t gl_int64_t |
| 190 | # define GL_INT64_T | 183 | # define GL_INT64_T |
| 191 | # else | 184 | # else |
| 185 | /* Verify that 'long long' has exactly 64 bits. */ | ||
| 186 | typedef _gl_verify_int64_bits[ | ||
| 187 | _STDINT_MAX (1, sizeof (long long) * CHAR_BIT, 0ll) >> 31 >> 31 == 1 | ||
| 188 | ? 1 : -1]; | ||
| 192 | # undef int64_t | 189 | # undef int64_t |
| 193 | typedef long long int gl_int64_t; | 190 | typedef long long int gl_int64_t; |
| 194 | # define int64_t gl_int64_t | 191 | # define int64_t gl_int64_t |
| @@ -210,6 +207,11 @@ typedef unsigned __int64 gl_uint64_t; | |||
| 210 | # define uint64_t gl_uint64_t | 207 | # define uint64_t gl_uint64_t |
| 211 | # define GL_UINT64_T | 208 | # define GL_UINT64_T |
| 212 | # else | 209 | # else |
| 210 | /* Verify that 'unsigned long long' has exactly 64 bits. */ | ||
| 211 | typedef _gl_verify_uint64_bits[ | ||
| 212 | _STDINT_MAX (0, sizeof (unsigned long long) * CHAR_BIT, 0ull) | ||
| 213 | >> 31 >> 31 >> 1 == 1 | ||
| 214 | ? 1 : -1]; | ||
| 213 | # undef uint64_t | 215 | # undef uint64_t |
| 214 | typedef unsigned long long int gl_uint64_t; | 216 | typedef unsigned long long int gl_uint64_t; |
| 215 | # define uint64_t gl_uint64_t | 217 | # define uint64_t gl_uint64_t |
| @@ -575,11 +577,7 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) | |||
| 575 | # endif | 577 | # endif |
| 576 | 578 | ||
| 577 | /* wchar_t limits */ | 579 | /* wchar_t limits */ |
| 578 | /* Get WCHAR_MIN, WCHAR_MAX. | 580 | /* Get WCHAR_MIN, WCHAR_MAX. */ |
| 579 | This include is not on the top, above, because on OSF/1 4.0 we have a | ||
| 580 | sequence of nested includes | ||
| 581 | <wchar.h> -> <stdio.h> -> <getopt.h> -> <stdlib.h>, and the latter includes | ||
| 582 | <stdint.h> and assumes its types are already defined. */ | ||
| 583 | # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) | 581 | # if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) |
| 584 | # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H | 582 | # define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H |
| 585 | # include <wchar.h> | 583 | # include <wchar.h> |
