Old gcc versions are confused by __has_include(), so nest the #ifdefs

and #define/#undef a second symbol for the else case.
This commit is contained in:
Rob Landley 2019-11-13 08:48:44 -06:00
parent ae34569fd0
commit 25c3e69114

View File

@ -287,8 +287,14 @@ static inline int __android_log_write(int pri, const char *tag, const char *msg)
#endif #endif
// libprocessgroup is an Android platform library not included in the NDK. // 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> #include <processgroup/sched_policy.h>
#define GOT_IT
#endif
#endif
#ifdef GOT_IT
#undef GOT_IT
#else #else
static inline int get_sched_policy(int tid, void *policy) {return 0;} static inline int get_sched_policy(int tid, void *policy) {return 0;}
static inline char *get_sched_policy_name(int policy) {return "unknown";} static inline char *get_sched_policy_name(int policy) {return "unknown";}