C++ Logo


Advanced search

Re: Allow [[deprecated]] on call site to disable deprecated warning

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Sun, 7 Feb 2021 16:28:50 +0200
On Sun, 7 Feb 2021 at 12:22, Avi Kivity <avi_at_[hidden]> wrote:
> > Create your own MY_DEPRECATED macro, make it expand to actual
> > deprecation normally, but not in unit tests,
> > compile the unit tests with -DMY_SOMETHING that disables deprecations.
> > Or just add a #define into
> > your unit tests.
> Doesn't that break with modules?
> We should not be suggesting solutions that involve the preprocessor in 2021.

Fair point. When the attribute is a property of a real declaration,
text-processing techniques no longer help.

I wonder whether we should go for a [[nowarn]] instead that just turns
off diagnostics that don't report
ill-formedness. If I had that, I would certainly hop on my time
machine and make it available on every
C++11 compiler I've ever used. :)

Received on 2021-02-07 08:29:03