Disable the gcc 12 warning about dllimport in directory.hpp.

The warnings suppressed in header.hpp can be force-enabled by the user,
so disable the buggy warning in directory.hpp instead. Also make the
workaround more specific to MinGW.
This commit is contained in:
Andrey Semashev
2025-06-13 03:18:50 +03:00
parent 9e11731148
commit 1be9ea7f04
2 changed files with 11 additions and 6 deletions

View File

@@ -44,12 +44,6 @@
// unused function 'foo'
#pragma GCC diagnostic ignored "-Wunused-function"
#if (__GNUC__ == 12)
// 'function' redeclared without dllimport attribute: previous dllimport ignored
// MinGW-w64 bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106395
#pragma GCC diagnostic ignored "-Wattributes"
#endif
#if defined(__clang__)
// template argument uses unnamed type
#pragma clang diagnostic ignored "-Wunnamed-type-template-args"

View File

@@ -35,6 +35,13 @@
#include <boost/filesystem/detail/header.hpp> // must be the last #include
#if defined(__MINGW32__) && defined(BOOST_GCC) && (__GNUC__ == 12)
#pragma GCC diagnostic push
// 'function' redeclared without dllimport attribute: previous dllimport ignored
// MinGW-w64 bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106395
#pragma GCC diagnostic ignored "-Wattributes"
#endif
//--------------------------------------------------------------------------------------//
namespace boost {
@@ -1034,6 +1041,10 @@ struct range_const_iterator< boost::filesystem::recursive_directory_iterator, vo
} // namespace boost
#if defined(__MINGW32__) && defined(BOOST_GCC) && (__GNUC__ == 12)
#pragma GCC diagnostic pop
#endif
#include <boost/filesystem/detail/footer.hpp>
#endif // BOOST_FILESYSTEM_DIRECTORY_HPP