@@ -188,8 +188,7 @@ const c_common_macros = '
188188#else
189189 #define _MOV
190190#endif
191- // tcc does not support has_include properly yet, turn it off completely
192- #if defined(__TINYC__) && defined(__has_include)
191+ #if defined(__TINYC__) && defined(__has_include) // tcc does not support has_include properly yet, turn it off completely
193192#undef __has_include
194193#endif
195194//likely and unlikely macros
@@ -314,15 +313,6 @@ typedef int (*qsort_callback_func)(const void*, const void*);
314313// gnu headers use to #define __attribute__ to empty for non-gcc compilers
315314#undef __attribute__
316315#endif
317- #ifdef __TERMUX__
318- #if !defined(__BIONIC_AVAILABILITY_GUARD)
319- #define __BIONIC_AVAILABILITY_GUARD(api_level) 0
320- #endif
321- #if __BIONIC_AVAILABILITY_GUARD(28)
322- #else
323- void * aligned_alloc(size_t alignment, size_t size) { return malloc(size); }
324- #endif
325- #endif
326316//================================== GLOBALS =================================*/
327317void _vinit(int ___argc, voidptr ___argv);
328318void _vcleanup(void);
@@ -354,25 +344,34 @@ void _vcleanup(void);
354344 #include <sys/time.h>
355345 #include <unistd.h> // sleep
356346 extern char **environ;
347+ #include <pthread.h>
348+ #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
349+ // musl does not have that
350+ #define pthread_rwlockattr_setkind_np(a, b)
351+ #endif
357352#endif
358- #if defined(__CYGWIN__) && !defined(_WIN32)
359- #error Cygwin is not supported, please use MinGW or Visual Studio.
360- #endif
361- #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun) || defined(__plan9__)
353+ #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__vinix__) || defined(__serenity__) || defined(__sun) || defined(__plan9__) || defined(__OpenBSD__)
362354 #include <sys/types.h>
363- #include <sys/wait.h> // os__wait uses wait on nix
355+ #include <sys/wait.h> // for os__wait
364356#endif
365357#ifdef __OpenBSD__
366- #include <sys/types.h>
367358 #include <sys/resource.h>
368- #include <sys/wait.h> // os__wait uses wait on nix
369359#endif
370360#ifdef __FreeBSD__
371361 #include <signal.h>
372362 #include <execinfo.h>
373363#endif
374364#ifdef __NetBSD__
375- #include <sys/wait.h> // os__wait uses wait on nix
365+ #include <sys/wait.h> // for os__wait
366+ #endif
367+ #ifdef __TERMUX__
368+ #if !defined(__BIONIC_AVAILABILITY_GUARD)
369+ #define __BIONIC_AVAILABILITY_GUARD(api_level) 0
370+ #endif
371+ #if __BIONIC_AVAILABILITY_GUARD(28)
372+ #else
373+ void * aligned_alloc(size_t alignment, size_t size) { return malloc(size); }
374+ #endif
376375#endif
377376#ifdef _WIN32
378377 #define WINVER 0x0600
@@ -406,12 +405,9 @@ void _vcleanup(void);
406405 #include <dbghelp.h>
407406 #pragma comment(lib, "Dbghelp")
408407 #endif
409- #else
410- #include <pthread.h>
411- #ifndef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP
412- // musl does not have that
413- #define pthread_rwlockattr_setkind_np(a, b)
414- #endif
408+ #endif
409+ #if defined(__CYGWIN__) && !defined(_WIN32)
410+ #error Cygwin is not supported, please use MinGW or Visual Studio.
415411#endif
416412#if defined(__MINGW32__) || defined(__MINGW64__) || (defined(_WIN32) && defined(__TINYC__))
417413 #undef PRId64
0 commit comments