Skip to content

Commit d620a88

Browse files
committed
Simplify macro checks.
1 parent fbcafe9 commit d620a88

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@
1515
#ifdef __clang__
1616
#pragma clang diagnostic push
1717
#pragma clang diagnostic ignored "-Wgnu-include-next"
18-
#elif defined(__GNUC__) // gcc
19-
#if !defined _GCC_LIMITS_H_
20-
#define _GCC_LIMITS_H_
21-
#endif
18+
#else // gcc
2219
#pragma GCC system_header
2320
#endif // __clang__, __GNUC__
2421

22+
#if defined(__GNUC__) && !defined(_GCC_LIMITS_H_)
23+
// The system's limits.h may, in turn, try to #include_next GCC's limits.h.
24+
// Define the macro _GCC_LIMITS_H_ to stop its chains of #include_next.
25+
#define _GCC_LIMITS_H_
26+
#endif
27+
2528
// Include compiler's header
2629
#include_next <limits.h>
2730

0 commit comments

Comments
 (0)