From 56776c92f730449bc81f0dbefd33ccf707c503a2 Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Sat, 27 Apr 2024 09:58:19 +0200 Subject: [PATCH 1/8] work on ci scripts --- .cirrus.yml | 2 +- .github/workflows/build_cmake.yml | 114 +++++++++++++----------------- CMakeLists.txt | 2 +- 3 files changed, 50 insertions(+), 68 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index d786910..fbd0e0b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,6 +1,6 @@ freebsd_task: freebsd_instance: - image_family: freebsd-12-1 + image_family: freebsd-14-0 install_script: | pkg install -y cmake pw groupadd testgrp diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index f50664b..86b55ac 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -10,8 +10,8 @@ jobs: fail-fast: false matrix: config: - - name: "Ubuntu 20.04 GCC 9.3" - os: ubuntu-20.04 + - name: "Ubuntu 22.04 GCC 11" + os: ubuntu-22.04 build_type: Release packages: ninja-build generator: Ninja @@ -19,26 +19,26 @@ jobs: cc: gcc cxx: g++ - - name: "Ubuntu 20.04 Clang 10.0" - os: ubuntu-20.04 + - name: "Ubuntu 22.04 Clang 13.0" + os: ubuntu-22.04 build_type: Release packages: ninja-build generator: Ninja compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" - cc: clang-10 - cxx: clang++-10 + cc: clang-13 + cxx: clang++-13 - - name: "Ubuntu 20.04 Clang 11.0" - os: ubuntu-20.04 + - name: "Ubuntu 20.04 Clang 15.0" + os: ubuntu-22.04 build_type: Release - packages: ninja-build clang-11 libc++-11-dev libc++abi-11-dev + packages: ninja-build generator: Ninja compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" - cc: clang-11 - cxx: clang++-11 + cc: clang-15 + cxx: clang++-15 - - name: "Ubuntu 20.04 GCC 9.3 coverage" - os: ubuntu-20.04 + - name: "Ubuntu 22.04 GCC 11 coverage" + os: ubuntu-22.04 build_type: Debug packages: ninja-build lcov generator: Ninja @@ -46,68 +46,41 @@ jobs: cc: gcc cxx: g++ - - name: "Ubuntu 18.04 GCC 8.4" - os: ubuntu-18.04 - build_type: Release - packages: ninja-build gcc-8 g++-8 - generator: Ninja - compatibility: "cxx_std_11;cxx_std_17" - cc: gcc-8 - cxx: g++-8 - - - name: "Ubuntu 18.04 GCC 7.5" - os: ubuntu-18.04 + - name: "Ubuntu 20.04 GCC 9.3" + os: ubuntu-20.04 build_type: Release packages: ninja-build generator: Ninja - compatibility: "cxx_std_11;cxx_std_17" - cc: gcc-7 - cxx: g++-7 - - - name: "Ubuntu 18.04 GCC 6.5" - os: ubuntu-18.04 - build_type: Release - packages: ninja-build gcc-6 g++-6 - generator: Ninja - compatibility: "cxx_std_11;cxx_std_17" - cc: gcc-6 - cxx: g++-6 - - - name: "Ubuntu 18.04 GCC 5.5" - os: ubuntu-18.04 - build_type: Release - packages: ninja-build gcc-5 g++-5 - generator: Ninja - compatibility: "cxx_std_11;cxx_std_17" - cc: gcc-5 - cxx: g++-5 + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: gcc + cxx: g++ - - name: "Ubuntu 18.04 Clang 9.0" - os: ubuntu-18.04 + - name: "Ubuntu 20.04 Clang 10.0" + os: ubuntu-20.04 build_type: Release - packages: ninja-build libc++-9-dev libc++abi-9-dev + packages: ninja-build generator: Ninja compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" - cc: clang - cxx: clang++ + cc: clang-10 + cxx: clang++-10 - - name: "Ubuntu 18.04 Clang 6.0" - os: ubuntu-18.04 + - name: "Ubuntu 20.04 Clang 11.0" + os: ubuntu-20.04 build_type: Release - packages: ninja-build clang-6.0 + packages: ninja-build clang-11 libc++-11-dev libc++abi-11-dev generator: Ninja - compatibility: "cxx_std_11;cxx_std_17" - cc: clang-6.0 - cxx: clang++-6.0 + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: clang-11 + cxx: clang++-11 - - name: "Ubuntu 18.04 Clang 5.0" - os: ubuntu-18.04 - build_type: Release - packages: ninja-build clang-5.0 + - name: "Ubuntu 20.04 GCC 9.3 coverage" + os: ubuntu-20.04 + build_type: Debug + packages: ninja-build lcov generator: Ninja - compatibility: "cxx_std_11;cxx_std_17" - cc: clang-5.0 - cxx: clang++-5.0 + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: gcc + cxx: g++ - name: "Windows MSVC 2019" os: windows-2019 @@ -118,8 +91,17 @@ jobs: cc: cl cxx: cl - - name: "macOS 10.15 AppleClang" - os: macos-10.15 + - name: "macOS 13 AppleClang" + os: macos-13 + build_type: Release + packages: ninja + generator: Ninja + compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" + cc: clang + cxx: clang++ + + - name: "macOS 12 AppleClang" + os: macos-12 build_type: Release packages: ninja generator: Ninja @@ -127,7 +109,7 @@ jobs: cc: clang cxx: clang++ - - name: "macOS 11.6 AppleClang" + - name: "macOS 11 AppleClang" os: macos-11 build_type: Release packages: ninja diff --git a/CMakeLists.txt b/CMakeLists.txt index 063289c..de97dd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.7.2) project( ghcfilesystem, - VERSION 1.5.14 + VERSION 1.5.15 ) if (POLICY CMP0077) From 9fe68b91c7b7c96c44d7de827a2a4835b82e55f2 Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Sat, 27 Apr 2024 10:41:56 +0200 Subject: [PATCH 2/8] work on ci scripts --- .github/workflows/build_cmake.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index 86b55ac..dc669ee 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -22,16 +22,16 @@ jobs: - name: "Ubuntu 22.04 Clang 13.0" os: ubuntu-22.04 build_type: Release - packages: ninja-build + packages: ninja-build libc++-13-dev generator: Ninja compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" cc: clang-13 cxx: clang++-13 - - name: "Ubuntu 20.04 Clang 15.0" + - name: "Ubuntu 22.04 Clang 15.0" os: ubuntu-22.04 build_type: Release - packages: ninja-build + packages: ninja-build libc++-15-dev generator: Ninja compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" cc: clang-15 From 72a03b3c6dfe3c16079e1822b5491cd4af319eba Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Sat, 27 Apr 2024 12:00:20 +0200 Subject: [PATCH 3/8] work on ci scripts --- test/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2275c61..1554201 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,6 +3,11 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") set(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS ON) include(ParseAndAddCatchTests) +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND UNIX AND NOT APPLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + set(CMAKE_EXE_LINKER_FLAGS "-lc++abi") +endif() + function(SetTestCompileOptions target_name) target_compile_options(${target_name} PRIVATE $<$:-s DISABLE_EXCEPTION_CATCHING=0> From fbc5d213fc73027e2520a085c161e3cc47682940 Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Sat, 27 Apr 2024 12:07:57 +0200 Subject: [PATCH 4/8] work on ci scripts --- .github/workflows/build_cmake.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_cmake.yml b/.github/workflows/build_cmake.yml index dc669ee..c8170ec 100644 --- a/.github/workflows/build_cmake.yml +++ b/.github/workflows/build_cmake.yml @@ -22,7 +22,7 @@ jobs: - name: "Ubuntu 22.04 Clang 13.0" os: ubuntu-22.04 build_type: Release - packages: ninja-build libc++-13-dev + packages: ninja-build libc++-13-dev libc++abi-13-dev generator: Ninja compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" cc: clang-13 @@ -31,7 +31,7 @@ jobs: - name: "Ubuntu 22.04 Clang 15.0" os: ubuntu-22.04 build_type: Release - packages: ninja-build libc++-15-dev + packages: ninja-build libc++-15-dev libc++abi-15-dev generator: Ninja compatibility: "cxx_std_11;cxx_std_17;cxx_std_20" cc: clang-15 From b1982f06c84f08a99fb90bac43c2d03712efe921 Mon Sep 17 00:00:00 2001 From: Steffen Schuemann Date: Sat, 27 Apr 2024 12:20:18 +0200 Subject: [PATCH 5/8] work on ci scripts --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1554201..1401ef0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") set(PARSE_CATCH_TESTS_ADD_TO_CONFIGURE_DEPENDS ON) include(ParseAndAddCatchTests) -if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND UNIX AND NOT APPLE) +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND UNIX AND NOT APPLE AND NOT BSD) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS "-lc++abi") endif() From f43846877bd903b7f4bad5d26dd138b53c75b345 Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Wed, 18 Dec 2024 15:25:52 +0100 Subject: [PATCH 6/8] Avoid GNU `getcwd` extension behavior GNU `getcwd` can allocate a buffer if passed `NULL` for it. This is an extension which is e.g., not recognized by clang-tidy-19's `StdCLibraryFunctions` check[^1] which emits a diagnostic on a violated precondition `buf != NULL`, ``` The 1st argument to 'getcwd' is NULL but should not be NULL [clang-analyzer-unix.StdCLibraryFunctions,-warnings-as-errors] [build] 3987 | std::unique_ptr buffer{::getcwd(NULL, 0), std::free}; ``` This patch modifies this use of `getcwd` with this extension behavior to instead use `get_current_dir_name` which is also a GNU extension, but does not trigger this diagnostic. [^1]: https://clang.llvm.org/docs/analyzer/checkers.html#unix-stdclibraryfunctions-c --- include/ghc/filesystem.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index 1770d73..89fccfd 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -4229,7 +4229,7 @@ GHC_INLINE path current_path(std::error_code& ec) } return path(std::wstring(buffer.get()), path::native_format); #elif defined(__GLIBC__) - std::unique_ptr buffer { ::getcwd(NULL, 0), std::free }; + std::unique_ptr buffer { ::get_current_dir_name(), std::free }; if (buffer == nullptr) { ec = detail::make_system_error(); return path(); From 99c3500205c7583623ca343a78b767f28b6dde53 Mon Sep 17 00:00:00 2001 From: Benjamin Bannier Date: Wed, 18 Dec 2024 15:45:33 +0100 Subject: [PATCH 7/8] Replace EOL centos CI with rockylinux centos7 has reached EOL on 2024-06-30, centos8 on 2021-10-31. In practical terms this means that their package repositories are offline for the foreseeable future and the CI tasks making use of them might never run again. This patch replaces the existing CI jobs on centos7/centos8 with jobs on rockylinux8/9. Since rockylinux is an open source variant similar to RHEL this should provide testing with similar spirit. In contrast to centos, rockylinux does provide very granular tagging of releases which if used would help avoid breaking on e.g., subtle package changes in their package repositories. I however did not use very precise tags in the patch and instead went with broad "trains" for the 8 and 9 series; I hope this minimizes maintenance overhead (e.g., bumping to new releases) while still giving a good testing signal. --- .cirrus.yml | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index fbd0e0b..b188205 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,25 +11,24 @@ freebsd_task: test_script: | sudo -u testuser .ci/unix-test.sh -centos7_task: +rockylinux8_task: container: - image: centos:7 + image: docker.io/rockylinux:8 install_script: | - yum install -y centos-release-scl - yum install -y devtoolset-9 - curl -L https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.tar.gz | tar xzvf - -C /usr/local --strip-components 1 + dnf group install -y "Development Tools" + dnf install cmake -y build_script: | - source /opt/rh/devtoolset-9/enable && PATH=$PATH:/usr/local/bin .ci/unix-build.sh + .ci/unix-build.sh test_script: | - PATH=$PATH:/usr/local/bin .ci/unix-test.sh + .ci/unix-test.sh -centos8_task: +rockylinux9_task: container: - image: quay.io/centos/centos:stream8 + image: docker.io/rockylinux:9 install_script: | - yum group install -y "Development Tools" - curl -L https://github.com/Kitware/CMake/releases/download/v3.16.4/cmake-3.16.4-Linux-x86_64.tar.gz | tar xzvf - -C /usr/local --strip-components 1 + dnf group install -y "Development Tools" + dnf install cmake -y build_script: | - PATH=$PATH:/usr/local/bin .ci/unix-build.sh + .ci/unix-build.sh test_script: | - PATH=$PATH:/usr/local/bin .ci/unix-test.sh \ No newline at end of file + .ci/unix-test.sh From f08e8b0064b0420f305d58184eec19877ef91f55 Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 4 Jan 2025 21:44:32 -0800 Subject: [PATCH 8/8] Check macros are defined before use This resolves warnings when compiling with -wundef (and errors when combined with -werror). --- include/ghc/fs_std.hpp | 12 ++++++------ include/ghc/fs_std_fwd.hpp | 12 ++++++------ include/ghc/fs_std_impl.hpp | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/ghc/fs_std.hpp b/include/ghc/fs_std.hpp index d5c1643..f09eeec 100644 --- a/include/ghc/fs_std.hpp +++ b/include/ghc/fs_std.hpp @@ -32,7 +32,7 @@ #ifndef GHC_FILESYSTEM_STD_H #define GHC_FILESYSTEM_STD_H -#if _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) +#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) // ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus // _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/ #if __has_include() // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html @@ -46,12 +46,12 @@ // Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS // released after std::filesystem, where std::filesystem is always available. // (All other ___VERSION_MIN_REQUIREDs will be undefined and thus 0.) - #if __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ - || __TV_OS_VERSION_MIN_REQUIRED && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ - || __WATCH_OS_VERSION_MAX_ALLOWED && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ + || defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 #undef GHC_USE_STD_FS - #endif + #endif #endif #endif #endif diff --git a/include/ghc/fs_std_fwd.hpp b/include/ghc/fs_std_fwd.hpp index d979113..372470f 100644 --- a/include/ghc/fs_std_fwd.hpp +++ b/include/ghc/fs_std_fwd.hpp @@ -34,7 +34,7 @@ #ifndef GHC_FILESYSTEM_STD_FWD_H #define GHC_FILESYSTEM_STD_FWD_H -#if _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) +#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) // ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus // _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/ #if __has_include() // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html @@ -48,12 +48,12 @@ // Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS // released after std::filesystem, where std::filesystem is always available. // (All other ___VERSION_MIN_REQUIREDs will be undefined and thus 0.) - #if __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ - || __TV_OS_VERSION_MIN_REQUIRED && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ - || __WATCH_OS_VERSION_MAX_ALLOWED && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ + || defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 #undef GHC_USE_STD_FS - #endif + #endif #endif #endif #endif diff --git a/include/ghc/fs_std_impl.hpp b/include/ghc/fs_std_impl.hpp index 8ba5733..e21714e 100644 --- a/include/ghc/fs_std_impl.hpp +++ b/include/ghc/fs_std_impl.hpp @@ -31,7 +31,7 @@ // The cpp has to include this before including fs_std_fwd.hpp directly or via a different // header to work. //--------------------------------------------------------------------------------------- -#if _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) +#if defined(_MSVC_LANG) && _MSVC_LANG >= 201703L || __cplusplus >= 201703L && defined(__has_include) // ^ Supports MSVC prior to 15.7 without setting /Zc:__cplusplus to fix __cplusplus // _MSVC_LANG works regardless. But without the switch, the compiler always reported 199711L: https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/ #if __has_include() // Two stage __has_include needed for MSVC 2015 and per https://gcc.gnu.org/onlinedocs/cpp/_005f_005fhas_005finclude.html @@ -45,12 +45,12 @@ // Note: This intentionally uses std::filesystem on any new Apple OS, like visionOS // released after std::filesystem, where std::filesystem is always available. // (All other ___VERSION_MIN_REQUIREDs will be undefined and thus 0.) - #if __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ - || __IPHONE_OS_VERSION_MIN_REQUIRED && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ - || __TV_OS_VERSION_MIN_REQUIRED && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ - || __WATCH_OS_VERSION_MAX_ALLOWED && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 \ + || defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__TV_OS_VERSION_MIN_REQUIRED) && __TV_OS_VERSION_MIN_REQUIRED < 130000 \ + || defined(__WATCH_OS_VERSION_MAX_ALLOWED) && __WATCH_OS_VERSION_MAX_ALLOWED < 60000 #undef GHC_USE_STD_FS - #endif + #endif #endif #endif #endif