Skip to content

Commit 74b0465

Browse files
authored
[libc] Add simple features.h with implementation macro (#69402)
In the future this should probably be autogenerated so it defines library version. See: Discussion in #libc https://discord.com/channels/636084430946959380/636732994891284500/1163979080979460176
1 parent 5e30c74 commit 74b0465

File tree

7 files changed

+49
-0
lines changed

7 files changed

+49
-0
lines changed

libc/config/linux/aarch64/headers.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ set(TARGET_PUBLIC_HEADERS
22
libc.include.assert
33
libc.include.ctype
44
libc.include.errno
5+
libc.include.features
56
libc.include.fenv
67
libc.include.inttypes
78
libc.include.math

libc/config/linux/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.dirent
55
libc.include.errno
66
libc.include.fcntl
7+
libc.include.features
78
libc.include.fenv
89
libc.include.inttypes
910
libc.include.math

libc/config/linux/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
libc.include.dirent
55
libc.include.errno
66
libc.include.fcntl
7+
libc.include.features
78
libc.include.fenv
89
libc.include.inttypes
910
libc.include.math

libc/include/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ add_gen_header(
4646
.llvm-libc-types.mode_t
4747
)
4848

49+
add_gen_header(
50+
features
51+
DEF_FILE features.h.def
52+
GEN_HDR features.h
53+
DEPENDS
54+
.llvm_libc_common_h
55+
.llvm-libc-macros.features_macros
56+
)
57+
4958
add_gen_header(
5059
fenv
5160
DEF_FILE fenv.h.def

libc/include/features.h.def

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//===-- C standard library header features.h -------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_LIBC_FEATURES_H
10+
#define LLVM_LIBC_FEATURES_H
11+
12+
#include <__llvm-libc-common.h>
13+
#include <llvm-libc-macros/features-macros.h>
14+
15+
%%public_api()
16+
17+
#endif // LLVM_LIBC_FEATURES_H

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ add_macro_header(
4646
fcntl-macros.h
4747
)
4848

49+
add_macro_header(
50+
features_macros
51+
HDR
52+
features-macros.h
53+
)
54+
4955
add_macro_header(
5056
fenv_macros
5157
HDR
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//===-- Definition of macros from features.h ------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef __LLVM_LIBC_MACROS_FEATURES_MACROS_H
10+
#define __LLVM_LIBC_MACROS_FEATURES_MACROS_H
11+
12+
#define __LLVM_LIBC__ 1
13+
14+
#endif // __LLVM_LIBC_MACROS_FEATURES_MACROS_H

0 commit comments

Comments
 (0)