Skip to content

Commit

Permalink
Fix two small issues with preprocessor directives (ocaml#13281)
Browse files Browse the repository at this point in the history
* Add missing `defined` in preprocessor test

When `HAS_CLOCK_GETTIME_NSEC_NP` is not defined,
`#elif HAS_CLOCK_GETTIME_NSEC_NP` triggers a warning

* Include `caml/config.h` before `HAS_GETTIMEOFDAY` is tested

Also remove a duplicate `errno.h`
  • Loading branch information
shym authored Jul 4, 2024
1 parent 61b971d commit 6ad156a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions runtime/unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,12 @@
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include "caml/config.h"
#ifdef HAS_GETTIMEOFDAY
#include <sys/time.h>
#endif
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include "caml/config.h"
#if defined(SUPPORT_DYNAMIC_LINKING) && !defined(BUILDING_LIBCAMLRUNS)
#define WITH_DYNAMIC_LINKING
#ifdef __CYGWIN__
Expand All @@ -47,7 +46,7 @@
#endif
#ifdef HAS_POSIX_MONOTONIC_CLOCK
#include <time.h>
#elif HAS_CLOCK_GETTIME_NSEC_NP
#elif defined(HAS_CLOCK_GETTIME_NSEC_NP)
#include <time.h>
#endif
#ifdef HAS_DIRENT
Expand Down

0 comments on commit 6ad156a

Please sign in to comment.