This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Generating a deprecation warning for macros
- From: Ian Lance Taylor <iant at google dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 20 Sep 2012 09:47:48 -0700
- Subject: Re: Generating a deprecation warning for macros
- References: <505B26DF.1030801@redhat.com>
On Thu, Sep 20, 2012 at 7:23 AM, Florian Weimer <fweimer@redhat.com> wrote:
> I would like to generate a deprecation warning for macros. In the header
> file, I would like to have:
>
> #define FOO 127
> /* do something with FOO to mark it deprecated */
>
> And in client code which includes the header,
>
> printf("%d", FOO);
>
> should print a compile-time warning. Is this possible without changing GCC
> itself?
I don't think so. We have deprecated attributes for functions,
variables, and types, but there is no notion of an attribute for
macros, and there is no support for marking a macro as deprecated.
Ian