Skip to content

Commit 7cc79d1

Browse files
committed
define LONG_MAX via arch alltypes.h, strip down bits/limits.h
LLONG_MAX is uniform for all archs we support and plenty of header and code level logic assumes it is, so it does not make sense for limits.h bits mechanism to pretend it's variable. LONG_BIT can be defined in terms of LONG_MAX; there's no reason to put it in bits. by moving LONG_MAX definition to __LONG_MAX in alltypes.h and moving LLONG_MAX out of bits, there are now no plain-C limits that are defined in the bits header, so the bits header only needs to be included in the POSIX or extended profiles. this allows the feature test macro logic to be removed from the bits header, facilitating a long-term goal of getting such logic out of bits. having __LONG_MAX in alltypes.h will allow further generalization of headers. archs without a constant PAGESIZE no longer need bits/limits.h at all.
1 parent 316730c commit 7cc79d1

File tree

34 files changed

+35
-117
lines changed

34 files changed

+35
-117
lines changed

arch/aarch64/bits/alltypes.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#define __BYTE_ORDER 1234
99
#endif
1010

11+
#define __LONG_MAX 0x7fffffffffffffffL
12+
1113
#ifndef __cplusplus
1214
TYPEDEF unsigned wchar_t;
1315
#endif

arch/aarch64/bits/limits.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

arch/arm/bits/alltypes.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#define __BYTE_ORDER 1234
99
#endif
1010

11+
#define __LONG_MAX 0x7fffffffL
12+
1113
#ifndef __cplusplus
1214
TYPEDEF unsigned wchar_t;
1315
#endif

arch/arm/bits/limits.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

arch/generic/bits/limits.h

Whitespace-only changes.

arch/i386/bits/alltypes.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define _Reg int
44

55
#define __BYTE_ORDER 1234
6+
#define __LONG_MAX 0x7fffffffL
67

78
#ifndef __cplusplus
89
#ifdef __WCHAR_TYPE__

arch/i386/bits/limits.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2-
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
31
#define PAGESIZE 4096
4-
#define LONG_BIT 32
5-
#endif
6-
7-
#define LONG_MAX 0x7fffffffL
8-
#define LLONG_MAX 0x7fffffffffffffffLL

arch/m68k/bits/alltypes.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define _Reg int
44

55
#define __BYTE_ORDER 4321
6+
#define __LONG_MAX 0x7fffffffL
67

78
#ifndef __cplusplus
89
#ifdef __WCHAR_TYPE__

arch/m68k/bits/limits.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

arch/microblaze/bits/alltypes.h.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#define __BYTE_ORDER 4321
99
#endif
1010

11+
#define __LONG_MAX 0x7fffffffL
12+
1113
#ifndef __cplusplus
1214
TYPEDEF int wchar_t;
1315
#endif

0 commit comments

Comments
 (0)