In a testdir of modules time-h time-h-tests time-h-c++-tests posixcheck on native Windows, with clang, I see these compilation errors:
C:\cygwin64\home\bruno\testdir3\gltests\test-getcwd.c(77,32): error: too many arguments to function call, expected single argument '_Path', have 2 arguments if (mkdir (dir_name, S_IRWXU) < 0 || chdir (dir_name) < 0) ~~~~~ ^~~~~~~ ../gllib\sys/stat.h(942,18): note: expanded from macro 'S_IRWXU' # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\direct.h(108,26): note: 'mkdir' declared here _ACRTIMP int __cdecl mkdir( ^ C:\cygwin64\home\bruno\testdir3\gltests\test-getcwd.c(180,28): error: too many arguments to function call, expected single argument '_Path', have 2 arguments if (mkdir (DIR_NAME, S_IRWXU) < 0 || chdir (DIR_NAME) < 0) ~~~~~ ^~~~~~~ ../gllib\sys/stat.h(942,18): note: expanded from macro 'S_IRWXU' # define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\direct.h(108,26): note: 'mkdir' declared here _ACRTIMP int __cdecl mkdir( ^ This patch fixes it. 2024-08-27 Bruno Haible <br...@clisp.org> mkdir: Fix for use of posixcheck module on native Windows. * lib/sys_stat.in.h (mkdir): Give priority to the native Windows definition over the GNULIB_POSIXCHECK redefinition. diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 531232bbc1..d2ecdb9da9 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -675,12 +675,6 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); # endif _GL_CXXALIASWARN (mkdir); -#elif defined GNULIB_POSIXCHECK -# undef mkdir -# if HAVE_RAW_DECL_MKDIR -_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - " - "use gnulib module mkdir for portability"); -# endif #elif @GNULIB_MDA_MKDIR@ /* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between @@ -703,6 +697,12 @@ _GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); _GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); # endif _GL_CXXALIASWARN (mkdir); +#elif defined GNULIB_POSIXCHECK +# undef mkdir +# if HAVE_RAW_DECL_MKDIR +_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - " + "use gnulib module mkdir for portability"); +# endif #endif