diff options
author | Gunnar Beutner <gunnar@beutner.name> | 2021-04-11 05:10:35 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-11 09:51:20 +0200 |
commit | be4b20c14d13246b6b798e931ede2df22de54737 (patch) | |
tree | 5ee38f3132269e1a514ccc3b78fff394108e8a67 /Userland/Libraries/LibC | |
parent | dc446920e0710fec1a37b9212e1292df629be09a (diff) | |
download | serenity-be4b20c14d13246b6b798e931ede2df22de54737.zip |
LibC: Make <limits.h> compatible with GCC so that it doesn't install a fixed header
GCC installs a fixed version of the <limits.h> header as per https://gcc.gnu.org/onlinedocs/gcc/Fixed-Headers.html.
The fixed header doesn't include the target's <limits.h> which in turn means that some definitions (such as PATH_MAX)
aren't available. This change requires rebuilding the toolchain (Toolchain/BuildIt.sh).
This fixes the flatbuffers port.
The commit also removes some non-standard defines (U*_MIN) which don't appear to be used
anywhere. By definition they're always 0 though so they're not strictly necessary.
Diffstat (limited to 'Userland/Libraries/LibC')
-rw-r--r-- | Userland/Libraries/LibC/bits/stdint.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibC/limits.h | 25 |
2 files changed, 24 insertions, 2 deletions
diff --git a/Userland/Libraries/LibC/bits/stdint.h b/Userland/Libraries/LibC/bits/stdint.h index 7c07ea72a3..73eb81f786 100644 --- a/Userland/Libraries/LibC/bits/stdint.h +++ b/Userland/Libraries/LibC/bits/stdint.h @@ -74,7 +74,6 @@ typedef __INTPTR_TYPE__ intptr_t; typedef __UINTMAX_TYPE__ uintmax_t; #define UINTMAX_MAX __UINTMAX_MAX__ -#define UINTMAX_MIN __UINTMAX_MIN__ typedef __INTMAX_TYPE__ intmax_t; #define INTMAX_MAX __INTMAX_MAX__ diff --git a/Userland/Libraries/LibC/limits.h b/Userland/Libraries/LibC/limits.h index a53b4723ec..c4183ba170 100644 --- a/Userland/Libraries/LibC/limits.h +++ b/Userland/Libraries/LibC/limits.h @@ -47,13 +47,17 @@ #define INT_MIN INT32_MIN #define UINT_MAX UINT32_MAX -#define UINT_MIN UINT32_MIN #define CHAR_BIT 8 #define SCHAR_MIN (-128) #define SCHAR_MAX 127 #define UCHAR_MAX 255 +#define SHRT_MAX 32768 +#define SHRT_MIN (-SHRT_MAX - 1) + +#define USHRT_MAX 65535 + #define LONG_MAX 2147483647L #define LONG_MIN (-LONG_MAX - 1L) @@ -62,11 +66,30 @@ #define LONG_LONG_MAX 9223372036854775807LL #define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL) +#define LLONG_MAX LONG_LONG_MAX +#define LLONG_MIN LONG_LONG_MIN + #define ULONG_LONG_MAX 18446744073709551615ULL #define CHAR_MIN SCHAR_MIN #define CHAR_MAX SCHAR_MAX +#define CHAR_WIDTH 8 +#define SCHAR_WIDTH 8 +#define UCHAR_WIDTH 8 + +#define SHRT_WIDTH 16 +#define USHRT_WIDTH 16 + +#define INT_WIDTH 32 +#define UINT_WIDTH 32 + +#define LONG_WIDTH 32 +#define ULONG_WIDTH 32 + +#define LLONG_WIDTH 64 +#define ULLONG_WIDTH 64 + #define MB_LEN_MAX 16 #define ARG_MAX 65536 |