[Bug libstdc++/59325] Provide a way to disable deprecated warnings

andysem at mail dot ru gcc-bugzilla@gcc.gnu.org
Tue Oct 20 14:46:17 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59325

--- Comment #8 from andysem at mail dot ru ---
(In reply to Jonathan Wakely from comment #6)
> (In reply to andysem from comment #2)
> > (In reply to Jonathan Wakely from comment #1)
> > > You can use a #pragma to disable -Wdeprecated locally
> > 
> > But the legacy C++ is used in the library, which code I'd like to avoid
> > changing.
> 
> Is this still a problem? Uses of deprecated features within the library
> itself should no longer emit warnings (I think I've disabled them with
> pragmas).
> 
> So the only uses should be in our own code, which you can add pragmas to.

Yes, this is still a problem. To be clear, the library I was referring to was
not libstdc++ but another library which I have no control of and which is still
using C++03 features. I don't think it will move away from std::auto_ptr any
time soon as it is part of the API.

> If you want to ignore the warning because you know you're not going to use a
> different implementation or a newer standard, you can use -Wno-deprecated to
> disable all such warnings globally or use #pragma to disable them locally.

I don't want to disable _all_ deprecated warnings universally, only those
emitted by libstdc++. For this reason I cannot use -Wno-deprecated. #pragma
also doesn't really work because libstdc++ can be included from any header,
including those from other libraries, for which I don't want to disable
warnings.


More information about the Gcc-bugs mailing list