Newer gcc swallow version control keywords
Baruch Siach
baruch at tkos.co.il
Mon Oct 17 21:03:01 IST 2011
Hi Oleg,
On Mon, Oct 17, 2011 at 06:29:58PM +0200, Oleg Goldshmidt wrote:
...
> Now, put the above line in a C or C++ file, say foo.cc, and do the
> following:
>
> $ g++ -g -O2 foo.cc -c -o foo.o
> $ ident foo.o
> foo.o:
> $Id: foo.cc 673 2011-10-17 09:48:11Z oleg $
>
> This works up to and including gcc 4.4, but it does not work with gcc
> 4.5.1 or gcc 4.6.1 (the ident part does not show any keywords). The
> reason seems to be that the optimizer realizes that the static const
> is not used and eliminates it (remove -O2 and ident works fine).
The -O2, as well as -O and -Os, gcc options enable a set of specific
optimizations that can each be turned off. The full list is at
http://gcc.gnu.org/onlinedocs/gcc-4.6.1/gcc/Optimize-Options.html. Just go
over this list and disable each optimization, until you find the one removing
your static string.
baruch
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
More information about the Linux-il
mailing list