From c7e14488032b98ba81ffaf1aa813ada422dd4da1 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sat, 5 Apr 2025 15:29:00 +0300 Subject: [PATCH] Moved symloop_max constant into POSIX-specific section. The constant is not used in the Windows-specific code and causes clang warnings. Closes https://github.com/boostorg/filesystem/pull/332. --- src/operations.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/operations.cpp b/src/operations.cpp index cb31c50..4f69b55 100644 --- a/src/operations.cpp +++ b/src/operations.cpp @@ -252,14 +252,14 @@ void init_fill_random_impl(unsigned int major_ver, unsigned int minor_ver, unsig void init_directory_iterator_impl() noexcept; #endif // defined(BOOST_WINDOWS_API) +namespace { + //--------------------------------------------------------------------------------------// // // // helpers (all operating systems) // // // //--------------------------------------------------------------------------------------// -namespace { - // The number of retries remove_all should make if it detects that the directory it is about to enter has been replaced with a symlink or a regular file BOOST_CONSTEXPR_OR_CONST unsigned int remove_all_directory_replaced_retry_count = 5u; @@ -268,6 +268,12 @@ BOOST_CONSTEXPR_OR_CONST std::size_t small_path_size = 1024u; #if defined(BOOST_POSIX_API) +//--------------------------------------------------------------------------------------// +// // +// POSIX-specific helpers // +// // +//--------------------------------------------------------------------------------------// + // Absolute maximum path length, in character code units, that we're willing to accept from various system calls. // This value is arbitrary, it is supposed to be a hard limit to avoid memory exhaustion // in some of the algorithms below in case of some corrupted or maliciously broken filesystem. @@ -278,8 +284,6 @@ BOOST_CONSTEXPR_OR_CONST std::size_t small_path_size = 1024u; // - GNU/Hurd: no hard limit BOOST_CONSTEXPR_OR_CONST std::size_t absolute_path_max = 32u * 1024u; -#endif // defined(BOOST_POSIX_API) - // Maximum number of resolved symlinks before we register a loop BOOST_CONSTEXPR_OR_CONST unsigned int symloop_max = #if defined(SYMLOOP_MAX) @@ -289,16 +293,6 @@ BOOST_CONSTEXPR_OR_CONST unsigned int symloop_max = #endif ; -// general helpers -----------------------------------------------------------------// - -#ifdef BOOST_POSIX_API - -//--------------------------------------------------------------------------------------// -// // -// POSIX-specific helpers // -// // -//--------------------------------------------------------------------------------------// - inline bool not_found_error(int errval) noexcept { return errval == ENOENT || errval == ENOTDIR;