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.
This commit is contained in:
Andrey Semashev 2025-04-05 15:29:00 +03:00
parent 30b312e5c0
commit c7e1448803

View File

@ -252,14 +252,14 @@ void init_fill_random_impl(unsigned int major_ver, unsigned int minor_ver, unsig
void init_directory_iterator_impl() noexcept; void init_directory_iterator_impl() noexcept;
#endif // defined(BOOST_WINDOWS_API) #endif // defined(BOOST_WINDOWS_API)
namespace {
//--------------------------------------------------------------------------------------// //--------------------------------------------------------------------------------------//
// // // //
// helpers (all operating systems) // // 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 // 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; 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) #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. // 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 // 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. // 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 // - GNU/Hurd: no hard limit
BOOST_CONSTEXPR_OR_CONST std::size_t absolute_path_max = 32u * 1024u; 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 // Maximum number of resolved symlinks before we register a loop
BOOST_CONSTEXPR_OR_CONST unsigned int symloop_max = BOOST_CONSTEXPR_OR_CONST unsigned int symloop_max =
#if defined(SYMLOOP_MAX) #if defined(SYMLOOP_MAX)
@ -289,16 +293,6 @@ BOOST_CONSTEXPR_OR_CONST unsigned int symloop_max =
#endif #endif
; ;
// general helpers -----------------------------------------------------------------//
#ifdef BOOST_POSIX_API
//--------------------------------------------------------------------------------------//
// //
// POSIX-specific helpers //
// //
//--------------------------------------------------------------------------------------//
inline bool not_found_error(int errval) noexcept inline bool not_found_error(int errval) noexcept
{ {
return errval == ENOENT || errval == ENOTDIR; return errval == ENOENT || errval == ENOTDIR;