[libc-commits] [libc] 74b0465 - [libc] Add simple features.h with implementation macro (#69402)

via libc-commits libc-commits at lists.llvm.org
Wed Oct 18 19:08:17 PDT 2023


Author: alfredfo
Date: 2023-10-19T04:08:13+02:00
New Revision: 74b0465fe954934453feb3c47892397dbc77b5b4

URL: https://github.com/llvm/llvm-project/commit/74b0465fe954934453feb3c47892397dbc77b5b4
DIFF: https://github.com/llvm/llvm-project/commit/74b0465fe954934453feb3c47892397dbc77b5b4.diff

LOG: [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

Added: 
    libc/include/features.h.def
    libc/include/llvm-libc-macros/features-macros.h

Modified: 
    libc/config/linux/aarch64/headers.txt
    libc/config/linux/riscv/headers.txt
    libc/config/linux/x86_64/headers.txt
    libc/include/CMakeLists.txt
    libc/include/llvm-libc-macros/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/config/linux/aarch64/headers.txt b/libc/config/linux/aarch64/headers.txt
index 6e30c7c29b2c4bf..c47e05c924fd94f 100644
--- a/libc/config/linux/aarch64/headers.txt
+++ b/libc/config/linux/aarch64/headers.txt
@@ -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

diff  --git a/libc/config/linux/riscv/headers.txt b/libc/config/linux/riscv/headers.txt
index aaa75a9dd08cbd7..24247ee5819f94a 100644
--- a/libc/config/linux/riscv/headers.txt
+++ b/libc/config/linux/riscv/headers.txt
@@ -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

diff  --git a/libc/config/linux/x86_64/headers.txt b/libc/config/linux/x86_64/headers.txt
index aaa75a9dd08cbd7..24247ee5819f94a 100644
--- a/libc/config/linux/x86_64/headers.txt
+++ b/libc/config/linux/x86_64/headers.txt
@@ -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

diff  --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index fd2cb9351419ca8..9d170603ffa45cd 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -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

diff  --git a/libc/include/features.h.def b/libc/include/features.h.def
new file mode 100644
index 000000000000000..a5d2be0a0692fe2
--- /dev/null
+++ b/libc/include/features.h.def
@@ -0,0 +1,17 @@
+//===-- C standard library header 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_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

diff  --git a/libc/include/llvm-libc-macros/CMakeLists.txt b/libc/include/llvm-libc-macros/CMakeLists.txt
index 8a225889a6f1f87..9c9e6bfd1256453 100644
--- a/libc/include/llvm-libc-macros/CMakeLists.txt
+++ b/libc/include/llvm-libc-macros/CMakeLists.txt
@@ -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

diff  --git a/libc/include/llvm-libc-macros/features-macros.h b/libc/include/llvm-libc-macros/features-macros.h
new file mode 100644
index 000000000000000..2938b3ccb95b29c
--- /dev/null
+++ b/libc/include/llvm-libc-macros/features-macros.h
@@ -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


        


More information about the libc-commits mailing list