smol-gilbraltar/patches/5.2.1/0001-Fix-two-small-issues-with-preprocessor-directives-13.patch
2025-01-02 12:16:39 +01:00

49 lines
1.2 KiB
Diff

From 189d0adbdcbc480fe3c9c79abf4b3f1df584e0c1 Mon Sep 17 00:00:00 2001
From: shym <samuel@tarides.com>
Date: Thu, 4 Jul 2024 18:01:17 +0200
Subject: [PATCH 01/14] Fix two small issues with preprocessor directives
(#13281)
* 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`
---
runtime/unix.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/runtime/unix.c b/runtime/unix.c
index b5fd4de17b..c0677e09ac 100644
--- a/runtime/unix.c
+++ b/runtime/unix.c
@@ -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__
@@ -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
--
2.45.2