Re: enabling #ident in Apple gcc
Re: enabling #ident in Apple gcc
- Subject: Re: enabling #ident in Apple gcc
- From: "Chris Inacio" <email@hidden>
- Date: Tue, 15 Apr 2008 10:56:55 -0400
On Mon, Apr 14, 2008 at 7:08 PM, Shawn Erickson <
email@hidden> wrote:
On Mon, Apr 14, 2008 at 11:59 AM, Chris Inacio <
email@hidden> wrote:
> I work on developing cross platform software, (YAF, libfixbuf,) which runs
> on multiple varieties of Unix/POSIX. We have started to put:
>
> #ident "$Id$
>
> into our code to be able to use the ident command to find version numbers.
> This works on all platforms I've tested with all the compilers I've tested,
> (Linux, Solaris, gcc, Sun Pro, Intel C) except for Mac OS. It doesn't cause
> an error on Mac OS, it just doesn't work.
<http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/ident.1.html>
---
<http://gcc.gnu.org/onlinedocs/cpp/Other-Directives.html>
8 Other Directives
The '#ident' directive takes one argument, a string constant. On some
systems, that string
constant is copied into a special segment of the ob ject file. On other
systems, the directive
is ignored. The '#sccs' directive is a synonym for '#ident'.
These directives are not part of the C standard, but they are not
official GNU extensions
either. What historical information we have been able to find, suggests
they originated with
System V.
The null directive consists of a '#' followed by a newline, with only
whitespace (including
comments) in between. A null directive is understood as a
preprocessing directive but has
no effect on the preprocessor output. The primary significance of the
existence of the null
directive is that an input line consisting of just a '#' will produce
no output, rather than a
line of output containing just a '#'. Supposedly some old C programs
contain such lines.
This basically states that "#ident" is not an officially supported directive, (nor probably its cousin, #pragma ident.) But it does work on many platforms, including Linux and Solaris. Microsoft's compiler supports it as well, (even if their resource compiler and some other tools don't/strip it away.)
This would imply to me, that while the GCC maintainers aren't going out of their to make it work, (at least officially,) they don't seem to be trying to break it either. I can understand that maybe Apple had a reason to drop support for this, something like, "in Mach-O it's really ugly and hard..." I guess my question becomes, why was it dropped? Is there a simple switch to make it work? Will it ever work on Mac OS again?
Does anyone have any insight here? It's been a number of years since I've done any compiler hacking. I would rather not have to try to understand this from the source code. It's a nice solution on most platforms, I wish Apple would let/make it work on Mac OS as well.
Thanks,
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden