[llvm-branch-commits] [libc] 2a358ba - [libc] Move __LLVM_LIBC__ define to __llvm-libc-common.h (#126877)
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Feb 14 13:43:42 PST 2025
Author: Petr Hosek
Date: 2025-02-14T13:43:12-08:00
New Revision: 2a358bac7874baed5d05221e8ae6c75266c407b7
URL: https://github.com/llvm/llvm-project/commit/2a358bac7874baed5d05221e8ae6c75266c407b7
DIFF: https://github.com/llvm/llvm-project/commit/2a358bac7874baed5d05221e8ae6c75266c407b7.diff
LOG: [libc] Move __LLVM_LIBC__ define to __llvm-libc-common.h (#126877)
Relying on features.h is problematic since codebases are free to have
such a header on their search path, which breaks compilation. libc
should instead provide a more standard way of getting __LLVM_LIBC__.
Since __llvm-libc-common.h is included from all libc headers, defining
__LLVM_LIBC__ there ensures that this define is available whenever any
of the standard header is included.
(cherry picked from commit b0d782080529cf5d422847e1f91f29bd7c62f691)
Added:
Modified:
libc/include/__llvm-libc-common.h
libc/include/llvm-libc-macros/features-macros.h
Removed:
################################################################################
diff --git a/libc/include/__llvm-libc-common.h b/libc/include/__llvm-libc-common.h
index b5a23c5765f4d..9112d1ebe302c 100644
--- a/libc/include/__llvm-libc-common.h
+++ b/libc/include/__llvm-libc-common.h
@@ -9,6 +9,8 @@
#ifndef LLVM_LIBC_COMMON_H
#define LLVM_LIBC_COMMON_H
+#define __LLVM_LIBC__ 1
+
#ifdef __cplusplus
#undef __BEGIN_C_DECLS
diff --git a/libc/include/llvm-libc-macros/features-macros.h b/libc/include/llvm-libc-macros/features-macros.h
index 5bc87a68fc0ba..f87ae4ad12408 100644
--- a/libc/include/llvm-libc-macros/features-macros.h
+++ b/libc/include/llvm-libc-macros/features-macros.h
@@ -9,6 +9,4 @@
#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 llvm-branch-commits
mailing list