Skip to content

Commit 2a358ba

Browse files
petrhosektstellar
authored andcommitted
[libc] Move __LLVM_LIBC__ define to __llvm-libc-common.h (llvm#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 b0d7820)
1 parent 4f10d6d commit 2a358ba

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

libc/include/__llvm-libc-common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef LLVM_LIBC_COMMON_H
1010
#define LLVM_LIBC_COMMON_H
1111

12+
#define __LLVM_LIBC__ 1
13+
1214
#ifdef __cplusplus
1315

1416
#undef __BEGIN_C_DECLS

libc/include/llvm-libc-macros/features-macros.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@
99
#ifndef LLVM_LIBC_MACROS_FEATURES_MACROS_H
1010
#define LLVM_LIBC_MACROS_FEATURES_MACROS_H
1111

12-
#define __LLVM_LIBC__ 1
13-
1412
#endif // LLVM_LIBC_MACROS_FEATURES_MACROS_H

0 commit comments

Comments
 (0)