Merge 300d4e0135673afb6703a1b36a034fdfe2e77a7f into 9fda7b0afbd0640f482f4aea8720a8c0afd18740

This commit is contained in:
500-internal-server-error 2025-02-19 22:10:16 +07:00 committed by GitHub
commit 3df1e01c98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 97 additions and 15 deletions

View File

@ -85,12 +85,34 @@ jobs:
- name: "Windows MSVC 2019"
os: windows-2019
build_type: Release
build_std_testing: 'OFF'
packages: ninja
generator: "Visual Studio 16 2019"
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: cl
cxx: cl
- name: "Windows MSYS2 UCRT64"
os: windows-2019
msystem: ucrt64
build_type: Release
build_std_testing: 'OFF'
packages: cmake gcc ninja
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: gcc
cxx: g++
- name: "Windows MSYS2 CLANG64"
os: windows-2019
msystem: clang64
build_type: Release
packages: cmake clang ninja
generator: Ninja
compatibility: "cxx_std_11;cxx_std_17;cxx_std_20"
cc: clang
cxx: clang++
- name: "macOS 13 AppleClang"
os: macos-13
build_type: Release
@ -116,17 +138,26 @@ jobs:
sudo apt update
sudo apt install ${{ matrix.config.packages }}
- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
- name: Install dependencies on windows (MSVC)
if: startsWith(matrix.config.os, 'windows') && matrix.config.msystem == ''
run: |
choco install ${{ matrix.config.packages }}
- name: Install dependencies on windows (MSYS2)
if: startsWith(matrix.config.os, 'windows') && matrix.config.msystem != ''
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.config.msystem }}
update: true
pacboy: ${{ matrix.config.packages }}
- name: Install dependencies on macOS
if: startsWith(matrix.config.os, 'macos')
run: |
brew install ${{ matrix.config.packages }}
- name: Configure project
if: matrix.config.msystem == ''
shell: bash
run: |
export CC=${{ matrix.config.cc }}
@ -135,18 +166,49 @@ jobs:
cmake --version
mkdir build
mkdir install
if [[ "${{ matrix.config.build_type }}" == "Debug" ]]; then
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=Debug -DGHC_COVERAGE=ON -DGHC_FILESYSTEM_TEST_COMPILE_FEATURES="${{ matrix.config.compatibility }}" -DCMAKE_INSTALL_PREFIX:PATH=install
else
cmake -G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DGHC_FILESYSTEM_TEST_COMPILE_FEATURES="${{ matrix.config.compatibility }}" -DCMAKE_INSTALL_PREFIX:PATH=install
fi
args=(-G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }})
[[ "${{ matrix.config.build_type }}" == "Debug" ]] && args+=(-DGHC_COVERAGE=ON)
[[ -n "${{ matrix.config.msystem }}" ]] && args+=(-DGHC_FILESYSTEM_BUILD_STD_TESTING=NO)
args+=(-DCMAKE_INSTALL_PREFIX:PATH=install)
cmake "${args[@]}"
- name: Configure project (MSYS2)
if: matrix.config.msystem != ''
shell: msys2 {0}
run: |
export CC=${{ matrix.config.cc }}
export CXX=${{ matrix.config.cxx }}
ninja --version
cmake --version
mkdir build
mkdir install
args=(-G "${{ matrix.config.generator }}" -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }})
[[ "${{ matrix.config.build_type }}" == "Debug" ]] && args+=(-DGHC_COVERAGE=ON)
[[ -n "${{ matrix.config.msystem }}" ]] && args+=(-DGHC_FILESYSTEM_BUILD_STD_TESTING=NO)
args+=(-DCMAKE_INSTALL_PREFIX:PATH=install)
cmake "${args[@]}"
- name: Build project
if: matrix.config.msystem == ''
shell: bash
run: |
cmake --build build --config ${{ matrix.config.build_type }}
- name: Build project (MSYS2)
if: matrix.config.msystem != ''
shell: msys2 {0}
run: |
cmake --build build --config ${{ matrix.config.build_type }}
- name: Run tests
if: matrix.config.msystem == ''
shell: bash
run: |
cd build && ctest -C ${{ matrix.config.build_type }}
- name: Run tests (MSYS2)
if: matrix.config.msystem != ''
shell: msys2 {0}
run: |
cd build && ctest -C ${{ matrix.config.build_type }}
@ -167,4 +229,3 @@ jobs:
with:
path-to-lcov: ${{ github.workspace }}/build/coverage.info
github-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -40,7 +40,7 @@ if (CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 8.0 O
if(${CMAKE_SYSTEM_NAME} MATCHES "Haiku")
target_link_libraries(${targetName} network)
endif()
target_compile_options(${targetName} PRIVATE $<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
target_compile_options(${targetName} PRIVATE $<$<OR:$<BOOL:${CYGWIN}>,$<BOOL:${MINGW}>>:-Wa,-mbig-obj>)
target_compile_definitions(${targetName} PRIVATE USE_STD_FS)
endif()
@ -69,7 +69,7 @@ macro(AddTestExecutableWithStdCpp cppStd)
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-error=deprecated-declarations>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-error=deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>
$<$<OR:$<BOOL:${CYGWIN}>,$<BOOL:${MINGW}>>:-Wa,-mbig-obj>
$<$<BOOL:${GHC_COVERAGE}>:--coverage>)
if(CMAKE_CXX_COMPILER_ID MATCHES MSVC)
target_compile_definitions(filesystem_test_cpp${cppStd} PRIVATE _CRT_SECURE_NO_WARNINGS)

View File

@ -1941,7 +1941,7 @@ GHC_INLINE void create_symlink(const path& target_name, const path& new_symlink,
ec = detail::make_error_code(detail::portable_error::not_supported);
return;
}
#if defined(__GNUC__) && __GNUC__ >= 8
#if (defined(__GNUC__) && __GNUC__ >= 8) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
@ -1949,7 +1949,7 @@ GHC_INLINE void create_symlink(const path& target_name, const path& new_symlink,
#pragma warning(disable : 4191)
#endif
static CreateSymbolicLinkW_fp api_call = reinterpret_cast<CreateSymbolicLinkW_fp>(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "CreateSymbolicLinkW"));
#if defined(__GNUC__) && __GNUC__ >= 8
#if (defined(__GNUC__) && __GNUC__ >= 8) || defined(__clang__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
#pragma warning(pop)
@ -1970,7 +1970,7 @@ GHC_INLINE void create_symlink(const path& target_name, const path& new_symlink,
GHC_INLINE void create_hardlink(const path& target_name, const path& new_hardlink, std::error_code& ec)
{
#if defined(__GNUC__) && __GNUC__ >= 8
#if (defined(__GNUC__) && __GNUC__ >= 8) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
@ -1978,7 +1978,7 @@ GHC_INLINE void create_hardlink(const path& target_name, const path& new_hardlin
#pragma warning(disable : 4191)
#endif
static CreateHardLinkW_fp api_call = reinterpret_cast<CreateHardLinkW_fp>(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "CreateHardLinkW"));
#if defined(__GNUC__) && __GNUC__ >= 8
#if (defined(__GNUC__) && __GNUC__ >= 8) || defined(__clang__)
#pragma GCC diagnostic pop
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
#pragma warning(pop)
@ -2116,6 +2116,13 @@ private:
element_type _handle;
};
// It seems GCC doesn't catch this, but Clang does
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72751
#if defined(__clang__) && defined(__MINGW32__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnested-anon-types"
#endif
#ifndef REPARSE_DATA_BUFFER_HEADER_SIZE
typedef struct _REPARSE_DATA_BUFFER
{
@ -2152,6 +2159,10 @@ typedef struct _REPARSE_DATA_BUFFER
#endif
#endif
#if defined(__clang__) && defined(__MINGW32__)
#pragma clang diagnostic pop
#endif
template <class T>
struct free_deleter
{
@ -2246,12 +2257,22 @@ GHC_INLINE void timeToFILETIME(time_t t, FILETIME& ft)
ft.dwHighDateTime = ull.HighPart;
}
// Not sure why GCC doesn't catch this here, but Clang does
#if defined(__clang__) && defined(__MINGW32__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
template <typename INFO>
GHC_INLINE uintmax_t hard_links_from_INFO(const INFO* info)
{
return static_cast<uintmax_t>(-1);
}
#if defined(__clang__) && defined(__MINGW32__)
#pragma clang diagnostic pop
#endif
template <>
GHC_INLINE uintmax_t hard_links_from_INFO<BY_HANDLE_FILE_INFORMATION>(const BY_HANDLE_FILE_INFORMATION* info)
{

View File

@ -14,7 +14,7 @@ function(SetTestCompileOptions target_name)
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Werror -Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wshadow -Wconversion -Wsign-conversion -Wpedantic -Wno-psabi -Werror -Wno-deprecated-declarations>
$<$<CXX_COMPILER_ID:MSVC>:/WX /wd4996>
$<$<BOOL:${CYGWIN}>:-Wa,-mbig-obj>)
$<$<OR:$<BOOL:${CYGWIN}>,$<BOOL:${MINGW}>>:-Wa,-mbig-obj>)
endfunction()
if(GHC_COVERAGE)