[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)
This commit is contained in:
Petr Hosek 2025-02-12 11:37:07 -08:00 committed by Tom Stellard
parent 4f10d6d3ae
commit 2a358bac78
2 changed files with 2 additions and 2 deletions

View File

@ -9,6 +9,8 @@
#ifndef LLVM_LIBC_COMMON_H #ifndef LLVM_LIBC_COMMON_H
#define LLVM_LIBC_COMMON_H #define LLVM_LIBC_COMMON_H
#define __LLVM_LIBC__ 1
#ifdef __cplusplus #ifdef __cplusplus
#undef __BEGIN_C_DECLS #undef __BEGIN_C_DECLS

View File

@ -9,6 +9,4 @@
#ifndef LLVM_LIBC_MACROS_FEATURES_MACROS_H #ifndef LLVM_LIBC_MACROS_FEATURES_MACROS_H
#define LLVM_LIBC_MACROS_FEATURES_MACROS_H #define LLVM_LIBC_MACROS_FEATURES_MACROS_H
#define __LLVM_LIBC__ 1
#endif // LLVM_LIBC_MACROS_FEATURES_MACROS_H #endif // LLVM_LIBC_MACROS_FEATURES_MACROS_H