#ident is a preprocessor directive which effectively converts into a .comment section entry. The GNU tools do not support it, and FreeBSD has a lot of code with #ifdef to turn them into static strings. This is because the preprocessor is built into the compiler.
The GNU assembler supports .ident directives, which are more or less the same thing. I'm actually not sure if the RCS command ident(1) is capable of examining strings in non-data sections of code, but if not, it would have to be modified.
Historically the GNU tools have avoided implementation dependent extensions, except with their command line arguments; at one point, if you used #pragma, the compiler would actually exec nethack ("since the meaning of #pragma is implementation defined, we define it to invoke nethack").
You will likely not get a lot of support for #ident from the FSF, who are the final arbiters of what is or isn't included in gcc.
-- Terry On Apr 15, 2008, at 7:56 AM, Chris Inacio < email@hidden> wrote: 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
|