LibBSD | Casts to clockid_t in CLOCK_MONOTONIC causing preprocessor error (#12)

Aaron Nyholm (@eagleirony) gitlab at rtems.org
Thu Oct 31 00:36:12 UTC 2024



Aaron Nyholm created an issue: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/issues/12



While adding support for `6-freebsd-current` updates to Freebsd have caused an issue with the newlib define of `CLOCK_MONOTONIC` and `CLOCK_BOOTTIME`. 

In https://github.com/freebsd/freebsd-src/blob/main/contrib/wpa/src/utils/os_unix.c#L109 the preprocessor compares `CLOCK_MONOTONIC` and `CLOCK_BOOTTIME`. newlib includes casts to `clockid_t` in the define causing the compiler to throw the following error.

```In file included from /opt/work/rtems/6/aarch64-rtems6/include/sys/time.h:414,
                 from ../../freebsd/contrib/wpa/src/utils/includes.h:49,
                 from ../../freebsd/contrib/wpa/src/utils/os_unix.c:11:
../../freebsd/contrib/wpa/src/utils/os_unix.c: In function 'os_get_reltime':
../../freebsd/contrib/wpa/src/utils/os_unix.c:116:52: error: missing binary operator before token "4"
  116 | #if !(defined(CLOCK_BOOTTIME) && CLOCK_BOOTTIME == CLOCK_MONOTONIC)
      | ```

Freebsd doesn't include casts in their defines, bring newlib inline with Freebsd would solve this issue.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/pkg/rtems-libbsd/-/issues/12
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20241031/e2fa9de4/attachment-0001.htm>


More information about the bugs mailing list