Skip to content

Commit 1be9ea7

Browse files
committed
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.
1 parent 9e11731 commit 1be9ea7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

include/boost/filesystem/detail/header.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,6 @@
4444
// unused function 'foo'
4545
#pragma GCC diagnostic ignored "-Wunused-function"
4646

47-
#if (__GNUC__ == 12)
48-
// 'function' redeclared without dllimport attribute: previous dllimport ignored
49-
// MinGW-w64 bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106395
50-
#pragma GCC diagnostic ignored "-Wattributes"
51-
#endif
52-
5347
#if defined(__clang__)
5448
// template argument uses unnamed type
5549
#pragma clang diagnostic ignored "-Wunnamed-type-template-args"

include/boost/filesystem/directory.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535

3636
#include <boost/filesystem/detail/header.hpp> // must be the last #include
3737

38+
#if defined(__MINGW32__) && defined(BOOST_GCC) && (__GNUC__ == 12)
39+
#pragma GCC diagnostic push
40+
// 'function' redeclared without dllimport attribute: previous dllimport ignored
41+
// MinGW-w64 bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106395
42+
#pragma GCC diagnostic ignored "-Wattributes"
43+
#endif
44+
3845
//--------------------------------------------------------------------------------------//
3946

4047
namespace boost {
@@ -1034,6 +1041,10 @@ struct range_const_iterator< boost::filesystem::recursive_directory_iterator, vo
10341041

10351042
} // namespace boost
10361043

1044+
#if defined(__MINGW32__) && defined(BOOST_GCC) && (__GNUC__ == 12)
1045+
#pragma GCC diagnostic pop
1046+
#endif
1047+
10371048
#include <boost/filesystem/detail/footer.hpp>
10381049

10391050
#endif // BOOST_FILESYSTEM_DIRECTORY_HPP

0 commit comments

Comments
 (0)