Skip to content

Commit c996023

Browse files
authored
[libc] Provide an implementation of the 'stdint.h' header (#83353)
Summary: I've noticed one problem is that the user includes `stdint.h` the compiler will do `#include_next <stdint.h>` potentially into a conflicting implementation on systems with multiple headers installed. The `clang` header is standards compliant and works with `clang` and `gcc` which are both of our targets, so I simply copied it here. This has the effect of including `stdint.h` on clang / LLVM libc behaving the same as `-ffreestanding`.
1 parent 5675447 commit c996023

File tree

15 files changed

+923
-0
lines changed

15 files changed

+923
-0
lines changed

libc/config/baremetal/arm/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
44
libc.include.fenv
55
libc.include.errno
66
libc.include.float
7+
libc.include.stdint
78
libc.include.inttypes
89
libc.include.math
910
libc.include.stdio

libc/config/baremetal/riscv/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
44
libc.include.fenv
55
libc.include.errno
66
libc.include.float
7+
libc.include.stdint
78
libc.include.inttypes
89
libc.include.math
910
libc.include.stdio

libc/config/darwin/arm/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(TARGET_PUBLIC_HEADERS
33
libc.include.errno
44
libc.include.fenv
55
libc.include.float
6+
libc.include.stdint
67
libc.include.inttypes
78
libc.include.limits
89
libc.include.math

libc/config/darwin/x86_64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
44
# Fenv is currently disabled.
55
#libc.include.fenv
66
libc.include.float
7+
libc.include.stdint
78
libc.include.inttypes
89
libc.include.limits
910
libc.include.math

libc/config/gpu/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(TARGET_PUBLIC_HEADERS
33
libc.include.ctype
44
libc.include.string
55
libc.include.float
6+
libc.include.stdint
67
libc.include.inttypes
78
libc.include.limits
89
libc.include.math

libc/config/linux/aarch64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(TARGET_PUBLIC_HEADERS
55
libc.include.features
66
libc.include.fenv
77
libc.include.float
8+
libc.include.stdint
89
libc.include.inttypes
910
libc.include.limits
1011
libc.include.math

libc/config/linux/arm/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set(TARGET_PUBLIC_HEADERS
33
libc.include.fenv
44
libc.include.errno
55
libc.include.float
6+
libc.include.stdint
67
libc.include.inttypes
78
libc.include.math
89
libc.include.stdckdint

libc/config/linux/riscv/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set(TARGET_PUBLIC_HEADERS
77
libc.include.features
88
libc.include.fenv
99
libc.include.float
10+
libc.include.stdint
1011
libc.include.inttypes
1112
libc.include.limits
1213
libc.include.math

libc/config/linux/x86_64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ set(TARGET_PUBLIC_HEADERS
77
libc.include.features
88
libc.include.fenv
99
libc.include.float
10+
libc.include.stdint
1011
libc.include.inttypes
1112
libc.include.limits
1213
libc.include.math

libc/include/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ add_gen_header(
8484
.llvm-libc-macros.float_macros
8585
)
8686

87+
add_gen_header(
88+
stdint
89+
DEF_FILE stdint.h.def
90+
GEN_HDR stdint.h
91+
DEPENDS
92+
.llvm-libc-macros.stdint_macros
93+
)
94+
8795
add_gen_header(
8896
limits
8997
DEF_FILE limits.h.def

libc/include/llvm-libc-macros/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ add_macro_header(
6767
file-seek-macros.h
6868
)
6969

70+
add_macro_header(
71+
stdint_macros
72+
HDR
73+
stdint-macros.h
74+
)
75+
7076
add_macro_header(
7177
float_macros
7278
HDR

0 commit comments

Comments
 (0)