hyperrealm / libconfig

C/C++ library for processing configuration files
https://hyperrealm.github.io/libconfig/
GNU Lesser General Public License v2.1
1.1k stars 359 forks source link

`wincompat.h` macro condition is missing 3rd case for `msys64/clang64` #238

Open Challanger524 opened 2 months ago

Challanger524 commented 2 months ago
[build] libconfig/lib/libconfig.c:682:10: error: call to undeclared function 'fsync'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
[build]   682 |       if(posix_fsync(fd) != 0)
[build]       |          ^
[build] libconfig/lib/wincompat.h:120:22: note: expanded from macro 'posix_fsync'
[build]   120 | #define posix_fsync  fsync

Silly quick workaround - create 3rd missing case for msys2 (starts from line 96)

--- a/lib/wincompat.h
+++ b/lib/wincompat.h
@@ -94,6 +94,17 @@ extern int posix_fsync(int fd);
 #endif /* defined(WIN32) || defined(__MINGW32__) */

 #if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
+  || defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) \
+  && defined(__MINGW32__)
+
+#define INT64_CONST(I)  (I ## LL)
+#define UINT64_CONST(I) (I ## ULL)
+
+#include <Shlwapi.h>
+#define IS_RELATIVE_PATH(P) \
+  (PathIsRelativeA(P))
+
+#elif (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
   || defined(WIN64) || defined(_WIN64) || defined(__WIN64__)) \
   && ! defined(__MINGW32__)
Challanger524 commented 2 months ago

@hyperrealm I don't know how to fix this issue in the right way without a knowing person