Skip to content

[libc] Add simple features.h with implementation macro #69402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libc/config/linux/aarch64/headers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.assert
libc.include.ctype
libc.include.errno
libc.include.features
libc.include.fenv
libc.include.inttypes
libc.include.math
Expand Down
1 change: 1 addition & 0 deletions libc/config/linux/riscv/headers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.dirent
libc.include.errno
libc.include.fcntl
libc.include.features
libc.include.fenv
libc.include.inttypes
libc.include.math
Expand Down
1 change: 1 addition & 0 deletions libc/config/linux/x86_64/headers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(TARGET_PUBLIC_HEADERS
libc.include.dirent
libc.include.errno
libc.include.fcntl
libc.include.features
libc.include.fenv
libc.include.inttypes
libc.include.math
Expand Down
9 changes: 9 additions & 0 deletions libc/include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ add_gen_header(
.llvm-libc-types.mode_t
)

add_gen_header(
features
DEF_FILE features.h.def
GEN_HDR features.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.features_macros
)

add_gen_header(
fenv
DEF_FILE fenv.h.def
Expand Down
17 changes: 17 additions & 0 deletions libc/include/features.h.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//===-- C standard library header features.h -------------------------------===//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this line is one character too long

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed: 67770cb

//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_FEATURES_H
#define LLVM_LIBC_FEATURES_H

#include <__llvm-libc-common.h>
#include <llvm-libc-macros/features-macros.h>

%%public_api()

#endif // LLVM_LIBC_FEATURES_H
6 changes: 6 additions & 0 deletions libc/include/llvm-libc-macros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ add_macro_header(
fcntl-macros.h
)

add_macro_header(
features_macros
HDR
features-macros.h
)

add_macro_header(
fenv_macros
HDR
Expand Down
14 changes: 14 additions & 0 deletions libc/include/llvm-libc-macros/features-macros.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//===-- Definition of macros from features.h ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef __LLVM_LIBC_MACROS_FEATURES_MACROS_H
#define __LLVM_LIBC_MACROS_FEATURES_MACROS_H

#define __LLVM_LIBC__ 1

#endif // __LLVM_LIBC_MACROS_FEATURES_MACROS_H