This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: adding __COUNTER__ to gcc
- From: Ian Lance Taylor <iant at google dot com>
- To: olenz <lenz dot oron at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 16 Sep 2006 21:37:17 -0700
- Subject: Re: adding __COUNTER__ to gcc
- References: <6343128.post@talk.nabble.com>
olenz <lenz.oron@gmail.com> writes:
> I was trying to add __COUNTER__ support to the gcc compiler but my
> implementation (same as __LINE__) is not good for pre compiled headers.
> any idea how to implement this? one optiion is to add a global variable to
> each program, initialized to 0, and to replace the __COUNTER__ with
> something like (myGlobal++). any idea how do i add such a global varibale
> and use it later?
Look in libcpp/pch.c to see how the preprocessor saves and restores
its state when using PCH.
Ian