From 3ea0f71ffa5abad001245baf9665c7d6c8560291 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 23 Jun 2025 19:48:19 +0200 Subject: [PATCH] build: stop checking for `sys/stat.h` It has been used unconditionally in `src` and `tests` since at least 2011-09-19 via fdecb56cbfcafe5b770c4181133655b89973f41e. There are earlier unguarded references in `tests`. Also de-duplicate to include it just once. Ref: https://github.com/curl/curl/pull/17717#issuecomment-2996631026 Closes #17724 --- .github/scripts/cmp-config.pl | 1 + CMake/unix-cache.cmake | 1 - CMake/win32-cache.cmake | 1 - CMakeLists.txt | 1 - configure.ac | 1 - lib/config-mac.h | 1 - lib/config-os400.h | 3 --- lib/config-plan9.h | 1 - lib/config-riscos.h | 3 --- lib/config-win32.h | 3 --- lib/curl_config.h.cmake | 3 --- lib/curl_setup_once.h | 2 -- lib/vssh/libssh.c | 3 --- lib/vtls/vtls.c | 3 --- lib/vtls/vtls_scache.c | 3 --- src/tool_cb_wrt.c | 2 -- src/tool_dirhie.c | 2 -- src/tool_findfile.c | 3 --- src/tool_main.c | 2 -- 19 files changed, 1 insertion(+), 38 deletions(-) diff --git a/.github/scripts/cmp-config.pl b/.github/scripts/cmp-config.pl index f6dee00f9b..930168c812 100755 --- a/.github/scripts/cmp-config.pl +++ b/.github/scripts/cmp-config.pl @@ -73,6 +73,7 @@ my %remove = ( '#define HAVE_STDIO_H 1' => 1, '#define HAVE_STDLIB_H 1' => 1, '#define HAVE_STRING_H 1' => 1, + '#define HAVE_SYS_STAT_H 1' => 1, '#define HAVE_SYS_XATTR_H 1' => 1, '#define HAVE_UNICODE_UIDNA_H 1' => 1, '#define HAVE_WOLFSSH_SSH_H 1' => 1, diff --git a/CMake/unix-cache.cmake b/CMake/unix-cache.cmake index 2f0da66755..2c85626a49 100644 --- a/CMake/unix-cache.cmake +++ b/CMake/unix-cache.cmake @@ -286,7 +286,6 @@ if(CYGWIN OR else() set(HAVE_SYS_SOCKIO_H 1) endif() -set(HAVE_SYS_STAT_H 1) set(HAVE_SYS_TYPES_H 1) set(HAVE_SYS_UN_H 1) if(CYGWIN) diff --git a/CMake/win32-cache.cmake b/CMake/win32-cache.cmake index 3bf77bb840..4fe9eb1139 100644 --- a/CMake/win32-cache.cmake +++ b/CMake/win32-cache.cmake @@ -169,7 +169,6 @@ set(HAVE_SYS_POLL_H 0) set(HAVE_SYS_RESOURCE_H 0) set(HAVE_SYS_SELECT_H 0) set(HAVE_SYS_SOCKIO_H 0) -set(HAVE_SYS_STAT_H 1) set(HAVE_SYS_TYPES_H 1) set(HAVE_SYS_UN_H 0) set(HAVE_SYS_UTIME_H 1) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08c6632669..d3c91e2f3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1638,7 +1638,6 @@ check_include_file("sys/poll.h" HAVE_SYS_POLL_H) check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H) check_include_file_concat_curl("sys/select.h" HAVE_SYS_SELECT_H) check_include_file("sys/sockio.h" HAVE_SYS_SOCKIO_H) -check_include_file("sys/stat.h" HAVE_SYS_STAT_H) check_include_file_concat_curl("sys/types.h" HAVE_SYS_TYPES_H) check_include_file("sys/un.h" HAVE_SYS_UN_H) check_include_file_concat_curl("sys/utime.h" HAVE_SYS_UTIME_H) # sys/types.h (AmigaOS) diff --git a/configure.ac b/configure.ac index 0d5da0073e..f027cae0ec 100644 --- a/configure.ac +++ b/configure.ac @@ -3912,7 +3912,6 @@ AC_CHECK_HEADERS( netinet/udp.h \ netdb.h \ sys/sockio.h \ - sys/stat.h \ sys/param.h \ termios.h \ termio.h \ diff --git a/lib/config-mac.h b/lib/config-mac.h index 435e1293e0..6da544fe8f 100644 --- a/lib/config-mac.h +++ b/lib/config-mac.h @@ -50,7 +50,6 @@ #define HAVE_SYS_TYPES_H 1 #define HAVE_GETTIMEOFDAY 1 #define HAVE_FCNTL_H 1 -#define HAVE_SYS_STAT_H 1 #define HAVE_UTIME_H 1 #define HAVE_SYS_UTIME_H 1 #define HAVE_SYS_IOCTL_H 1 diff --git a/lib/config-os400.h b/lib/config-os400.h index ec7fc9129d..064338ed2a 100644 --- a/lib/config-os400.h +++ b/lib/config-os400.h @@ -161,9 +161,6 @@ /* Define if you have the header file. */ #undef HAVE_SYS_SOCKIO_H -/* Define if you have the header file. */ -#define HAVE_SYS_STAT_H - /* Define if you have the header file. */ #define HAVE_SYS_TYPES_H diff --git a/lib/config-plan9.h b/lib/config-plan9.h index 8d19925993..68d0cf7f56 100644 --- a/lib/config-plan9.h +++ b/lib/config-plan9.h @@ -113,7 +113,6 @@ #define HAVE_SYS_IOCTL_H 1 #define HAVE_SYS_PARAM_H 1 #define HAVE_SYS_RESOURCE_H 1 -#define HAVE_SYS_STAT_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_UN_H 1 #define HAVE_TERMIOS_H 1 diff --git a/lib/config-riscos.h b/lib/config-riscos.h index 03a3cde074..3158c984ee 100644 --- a/lib/config-riscos.h +++ b/lib/config-riscos.h @@ -147,9 +147,6 @@ /* Define if you have the header file. */ #undef HAVE_SYS_SOCKIO_H -/* Define if you have the header file. */ -#undef HAVE_SYS_STAT_H - /* Define if you have the header file. */ #define HAVE_SYS_TYPES_H diff --git a/lib/config-win32.h b/lib/config-win32.h index 176f65a3b7..363e7d85bf 100644 --- a/lib/config-win32.h +++ b/lib/config-win32.h @@ -77,9 +77,6 @@ /* Define if you have the header file. */ /* #define HAVE_SYS_SOCKIO_H 1 */ -/* Define if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - /* Define if you have the header file. */ #define HAVE_SYS_TYPES_H 1 diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index 3a9abaf1e9..0838ddccfb 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -589,9 +589,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_SOCKIO_H 1 -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H 1 - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TYPES_H 1 diff --git a/lib/curl_setup_once.h b/lib/curl_setup_once.h index 8d0cfcb387..bec45de888 100644 --- a/lib/curl_setup_once.h +++ b/lib/curl_setup_once.h @@ -41,9 +41,7 @@ #include #endif -#ifdef HAVE_SYS_STAT_H #include -#endif #if !defined(_WIN32) || defined(__MINGW32__) #include diff --git a/lib/vssh/libssh.c b/lib/vssh/libssh.c index 643b8f4987..ca0c5d09b2 100644 --- a/lib/vssh/libssh.c +++ b/lib/vssh/libssh.c @@ -70,9 +70,6 @@ #include "../curlx/warnless.h" #include "curl_path.h" -#ifdef HAVE_SYS_STAT_H -#include -#endif #ifdef HAVE_UNISTD_H #include #endif diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c index 53fc329d07..43f251a0a9 100644 --- a/lib/vtls/vtls.c +++ b/lib/vtls/vtls.c @@ -43,9 +43,6 @@ #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_SYS_STAT_H -#include -#endif #ifdef HAVE_FCNTL_H #include #endif diff --git a/lib/vtls/vtls_scache.c b/lib/vtls/vtls_scache.c index 1fe4b5bbde..15104294e2 100644 --- a/lib/vtls/vtls_scache.c +++ b/lib/vtls/vtls_scache.c @@ -29,9 +29,6 @@ #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_SYS_STAT_H -#include -#endif #ifdef HAVE_FCNTL_H #include #endif diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c index 9babd54cf7..17574c6eca 100644 --- a/src/tool_cb_wrt.c +++ b/src/tool_cb_wrt.c @@ -28,8 +28,6 @@ #include #endif -#include - #include "tool_cfgable.h" #include "tool_msgs.h" #include "tool_cb_wrt.h" diff --git a/src/tool_dirhie.c b/src/tool_dirhie.c index de4bdcef64..e4e3e859e7 100644 --- a/src/tool_dirhie.c +++ b/src/tool_dirhie.c @@ -23,8 +23,6 @@ ***************************************************************************/ #include "tool_setup.h" -#include - #if defined(_WIN32) && !defined(UNDER_CE) # include #endif diff --git a/src/tool_findfile.c b/src/tool_findfile.c index 4b09d0f708..72868f4b4f 100644 --- a/src/tool_findfile.c +++ b/src/tool_findfile.c @@ -29,9 +29,6 @@ #define __NO_NET_API #endif -#ifdef HAVE_SYS_STAT_H -#include -#endif #ifdef HAVE_FCNTL_H #include #endif diff --git a/src/tool_main.c b/src/tool_main.c index 6c994d971f..b1135f8628 100644 --- a/src/tool_main.c +++ b/src/tool_main.c @@ -23,8 +23,6 @@ ***************************************************************************/ #include "tool_setup.h" -#include - #ifdef _WIN32 #include #endif -- 2.47.2