mirror of
https://github.com/gulrak/filesystem.git
synced 2025-12-07 01:06:38 +08:00
Fix building on Windows with Clang in MinGW mode
Apply GCC `#pragma`s to Clang too, and also more to fix the things Clang catches that GCC doesn't
This commit is contained in:
parent
9fda7b0afb
commit
84fa1ac50a
@ -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);
|
ec = detail::make_error_code(detail::portable_error::not_supported);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if defined(__GNUC__) && __GNUC__ >= 8
|
#if (defined(__GNUC__) && __GNUC__ >= 8) || defined(__clang__)
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||||
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
|
#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)
|
#pragma warning(disable : 4191)
|
||||||
#endif
|
#endif
|
||||||
static CreateSymbolicLinkW_fp api_call = reinterpret_cast<CreateSymbolicLinkW_fp>(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "CreateSymbolicLinkW"));
|
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
|
#pragma GCC diagnostic pop
|
||||||
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
|
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
|
||||||
#pragma warning(pop)
|
#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)
|
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 push
|
||||||
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||||
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
|
#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)
|
#pragma warning(disable : 4191)
|
||||||
#endif
|
#endif
|
||||||
static CreateHardLinkW_fp api_call = reinterpret_cast<CreateHardLinkW_fp>(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "CreateHardLinkW"));
|
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
|
#pragma GCC diagnostic pop
|
||||||
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
|
#elif defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__clang__)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
@ -2116,6 +2116,13 @@ private:
|
|||||||
element_type _handle;
|
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
|
#ifndef REPARSE_DATA_BUFFER_HEADER_SIZE
|
||||||
typedef struct _REPARSE_DATA_BUFFER
|
typedef struct _REPARSE_DATA_BUFFER
|
||||||
{
|
{
|
||||||
@ -2152,6 +2159,10 @@ typedef struct _REPARSE_DATA_BUFFER
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__clang__) && defined(__MINGW32__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct free_deleter
|
struct free_deleter
|
||||||
{
|
{
|
||||||
@ -2246,12 +2257,22 @@ GHC_INLINE void timeToFILETIME(time_t t, FILETIME& ft)
|
|||||||
ft.dwHighDateTime = ull.HighPart;
|
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>
|
template <typename INFO>
|
||||||
GHC_INLINE uintmax_t hard_links_from_INFO(const INFO* info)
|
GHC_INLINE uintmax_t hard_links_from_INFO(const INFO* info)
|
||||||
{
|
{
|
||||||
return static_cast<uintmax_t>(-1);
|
return static_cast<uintmax_t>(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(__clang__) && defined(__MINGW32__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
GHC_INLINE uintmax_t hard_links_from_INFO<BY_HANDLE_FILE_INFORMATION>(const BY_HANDLE_FILE_INFORMATION* info)
|
GHC_INLINE uintmax_t hard_links_from_INFO<BY_HANDLE_FILE_INFORMATION>(const BY_HANDLE_FILE_INFORMATION* info)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user