Newer gcc swallow version control keywords
Oleg Goldshmidt
pub at goldshmidt.org
Tue Oct 18 18:04:08 IST 2011
On Mon, Oct 17, 2011 at 10:21 PM, Oleg Goldshmidt <pub at goldshmidt.org> wrote:
> "Nadav Har'El" <nyh at math.technion.ac.il> writes:
>
>> In any case, because there was always a fear that the compiler might
>> optimize these out, someone invented a new directive, #ident, as in:
>>
>> #ident "$Id$"
>
> This has always been there, but it has never been standard, AFAIK. It
> is not a GCC extension, either. Most preprocessors don't barf on
> directives they do not understand, but they may simply ignore #ident
> which will lead to the same behaviour that I do not want.
Just to make things more interesting, it looks like MS Visual Studio
2010 ignores #ident, warns about it, and suggests
#pragma comment(exestr,"$Id$")
instead, which works. It also emits nothing for a static const char
foo[] = "$Id$" in either Release or Debug mode.
Luckily, it seems to provide __pragma() which should be the same as
_Pragma and can be hidden in preprocessor macros.
--
Oleg Goldshmidt | pub at goldshmidt.org
More information about the Linux-il
mailing list