MinGW 5.1.0 no longer seems to suppress warnings

1k views Asked by At

I am running Windows 7.1 64-bit, Boost 1.58.0, and (recently) MinGW 5.1.0 64-bit.

When I was previously running MinGW 4.9.2, I used the following

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
#include "boost/asio/ip/host_name.hpp" // for host_name()
#pragma GCC diagnostic pop

to suppress unnecessary warnings, and it worked--most of the time. If there was a legitimate error in the code, these suppressed warning showed up anyway--but I can live with that.

Yesterday, I upgraded to MinGW 5.1.0 64-bit. The pragmas shown above no longer seem to be suppressing warnings. I couldn't find anything on Google that would suggest anything has changed.

I really would like to have this feature working again since I'm using Boost Test that has dozens of "std::auto_ptr is deprecated" warnings.

1

There are 1 answers

0
Chnossos On

Looking at the error:

In file included from C:/C++/MinGW-w64/5.1.0/i686-w64-mingw32/include/c++/memory:81:0,
             from ../common/include/boost/asio/detail/addressof.hpp:21,
             from ../common/include/boost/asio/detail/handler_alloc_helpers.hpp:19,
             from ../common/include/boost/asio/detail/bind_handler.hpp:19,
             from ../common/include/boost/asio/detail/wrapped_handler.hpp:18,
             from ../common/include/boost/asio/io_service.hpp:24,
             [...]:
boost/smart_ptr/shared_ptr.hpp:549:38: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
     this_type( static_cast< std::auto_ptr<Y> && >( r ) ).swap( *this );
                                  ^

You can see the compiler flag is no longer -Wunused-variable but now -Wdeprecated-declarations. Reflecting that in the #pragma made it work again for me.