[PATCH] Add new cpp predef macro __SAFE_FILE__ to improve compile-time assertions.
Ian Lance Taylor
iant@google.com
Tue Apr 24 20:29:00 GMT 2007
Basile STARYNKEVITCH <basile@starynkevitch.net> writes:
> Le Tue, Apr 24, 2007 at 06:27:39PM +0100, Dave Korn écrivait/wrote:
> >
> > Still, is there never another situation which might call for the ability to
> > generate a unique symbol using preprocessor macros? Currently, it is
> > completely impossible.
>
> If we accept some new CPP extensions (which seems out of fashion these days)
> we could dream of a __COUNT__ pseudo symbol (like __LINE__) which get
> automagically incremented at each use. This could help in reliable
> "gensym"-ed names...
>
> #define GENSYM(Sym) Sym##__COUNT__
>
> Given that such a thing would be quite simple to implement (and to think of)
> I suppose nobody wants this feature. Or maybe I am wrong and forgot some
> more serious issues about this.
Ollie Wild has a patch to implement __COUNTER__.
I believe it is waiting on approval of -fdirectives-only.
http://gcc.gnu.org/ml/gcc-patches/2007-02/msg02178.html
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00786.html
Ollie, please correct me if I am wrong.
Ian
More information about the Gcc-patches
mailing list