From a85f51d7d357fded4a177af9c7e7890a1fdcd95b Mon Sep 17 00:00:00 2001 From: Guilherme Janczak Date: Wed, 6 Sep 2023 20:23:27 +0000 Subject: [PATCH] sys/time.h: include time.h Due to a Meson annoyance explained in a comment in sys/time.h, #include from sys/time.h. --- meson.build | 3 +++ src/time/sys/time.h.in | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/meson.build b/meson.build index f7f5316..4d2090a 100644 --- a/meson.build +++ b/meson.build @@ -104,6 +104,9 @@ libobsd = library('obsd', src, c_args: args, install: not subproj, include_directories: incdir, + # To prevent Meson from making the compiler confuse sys/time.h + # with time.h + implicit_include_directories: false, dependencies: deps, gnu_symbol_visibility: 'hidden', override_options: link) diff --git a/src/time/sys/time.h.in b/src/time/sys/time.h.in index c9c20bd..dd2001f 100644 --- a/src/time/sys/time.h.in +++ b/src/time/sys/time.h.in @@ -47,6 +47,16 @@ #if !defined(OBSD_H_TIME) #define OBSD_H_TIME +/* Meson adds libobsd/src/time/sys to the include path and there's no way to + * remove it, which means someone might try to include time.h and end up being + * satisfied by sys/time.h. This will probably cause errors over missing types + * later (it does on HaikuOS, doesn't seem to on others), so make sure the right + * time.h is also included. + */ +#if defined(__HAIKU__) + #include <../posix/time.h> +#endif + #include #pragma obsd sys_time.h #define OBSD_INC_NEXT sys/time.h #pragma obsd sys_time.h #include