]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: threads: fix -Wundef for _POSIX_PRIORITY_SCHEDULING on libmusl
authorWilly Tarreau <w@1wt.eu>
Wed, 15 Sep 2021 08:12:04 +0000 (10:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 15 Sep 2021 08:32:12 +0000 (10:32 +0200)
Building with an old musl-based toolchain reported this warning:

  include/haproxy/thread.h: In function 'ha_thread_relax':
  include/haproxy/thread.h:256:5: warning: "_POSIX_PRIORITY_SCHEDULING" is not defined [-Wundef]
   #if _POSIX_PRIORITY_SCHEDULING
       ^

There were indeed two "#if" insteadd of #ifdef" for this macro, let's
fix them.

include/haproxy/thread.h

index 51c7278489670ed8b9679452fdbd8ebf2adddda4..9cf66476c30ecb9f550ae17a339bbabf692bffee 100644 (file)
@@ -103,7 +103,7 @@ static inline unsigned long long ha_get_pthread_id(unsigned int thr)
 
 static inline void ha_thread_relax(void)
 {
-#if _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_PRIORITY_SCHEDULING
        sched_yield();
 #endif
 }
@@ -253,7 +253,7 @@ static inline unsigned long long ha_get_pthread_id(unsigned int thr)
 
 static inline void ha_thread_relax(void)
 {
-#if _POSIX_PRIORITY_SCHEDULING
+#ifdef _POSIX_PRIORITY_SCHEDULING
        sched_yield();
 #else
        pl_cpu_relax();