aboutsummaryrefslogtreecommitdiff
path: root/lib/portability.h
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-11-13 08:48:44 -0600
committerRob Landley <rob@landley.net>2019-11-13 08:48:44 -0600
commit25c3e691140f48e971bdcc558cdf9acb7576598a (patch)
tree09657a1dbc700866e515b24e8de300a8899d898d /lib/portability.h
parentae34569fd0e2242ea85ffec193d825dd006d1038 (diff)
downloadtoybox-25c3e691140f48e971bdcc558cdf9acb7576598a.tar.gz
Old gcc versions are confused by __has_include(), so nest the #ifdefs
and #define/#undef a second symbol for the else case.
Diffstat (limited to 'lib/portability.h')
-rw-r--r--lib/portability.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/portability.h b/lib/portability.h
index 896fba34..b586c132 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -287,8 +287,14 @@ static inline int __android_log_write(int pri, const char *tag, const char *msg)
#endif
// libprocessgroup is an Android platform library not included in the NDK.
-#if defined(__BIONIC__) && __has_include(<processgroup/sched_policy.h>)
+#if defined(__BIONIC__)
+#if __has_include(<processgroup/sched_policy.h>)
#include <processgroup/sched_policy.h>
+#define GOT_IT
+#endif
+#endif
+#ifdef GOT_IT
+#undef GOT_IT
#else
static inline int get_sched_policy(int tid, void *policy) {return 0;}
static inline char *get_sched_policy_name(int policy) {return "unknown";}