bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gnulib] sysexits.h


From: Paul Eggert
Subject: Re: [Bug-gnulib] sysexits.h
Date: 11 Jun 2003 14:46:24 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Simon Josefsson <address@hidden> writes:

> Bruno Haible <address@hidden> writes:
> 
> > Paul Eggert wrote:
> >> It is certainly relevant from the point of the C and POSIX standards.
> >> They both require that every C translation unit must contain at least
> >> one external declaration.  "gcc -pedantic" checks for this.
> >
> > Does "typedef int dummy;" count as such an external declaration? I.e.
> > will it work to write
> >
> >   #ifndef ELIDE_CODE
> >     ... much code ,,.
> >   #else
> >     typedef int dummy;
> >   #endif

Yes, that's conforming C code.


> IIRC, it has to be something that ends up in the object code.

Yes, I recall linkers with that problem.  They used to be quite a
hassle.  And we can't assume this problem away by assuming a
C89-or-better compiler, as the problem is in the linker, not the
compiler.

I just did a deja.com search and found that the Unix System III linker
had the problem, and I think that is probably what I am remembering.
Here's a reference:

   From: Brandon S. Allbery KF8NH (address@hidden)
   Subject: Re: Do your cc & ld accept empty *.c files?
   Date: 1991-10-09 11:06:02 PST
   http://groups.google.com/groups?selm=1991Oct9.014034.4781%40NCoast.ORG
   news:address@hidden

This reference is quite old, though.  So I think it'd be OK to use the
typedef approach; if it doesn't work, we can always back out to
"static int dummy;".




reply via email to

[Prev in Thread] Current Thread [Next in Thread]