aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-03-19 18:52:21 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-03-19 18:52:21 +0000
commitdcdbb3613ce66483161e032050c3bed55e7d16b1 (patch)
tree781bed96de91c8bbeb348883349d799bacf58066
parentchar32: add missing header to work with musl (diff)
char32: only include stdc-predef.h if it is available
Use the (relatively new) macro __has_include() to check if stdc-predef.h exists, and only include it if it does. If stdc-predef.h does not exist, or if the compiler does not implement __has_include(), stdc-predef.h is *not* included.
-rw-r--r--char32.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/char32.c b/char32.c
index 6bd90e36..e25db3f1 100644
--- a/char32.c
+++ b/char32.c
@@ -6,8 +6,12 @@
#include <wctype.h>
#include <wchar.h>
-#include <stdc-predef.h>
+#if defined __has_include
+ #if __has_include (<stdc-predef.h>)
+ #include <stdc-predef.h>
+ #endif
+#endif
#define LOG_MODULE "char32"
#define LOG_ENABLE_DBG 0