delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/01/22/19:08:12

Date: Thu, 22 Jan 1998 16:01:40 -0800 (PST)
Message-Id: <199801230001.QAA23021@adit.ap.net>
Mime-Version: 1.0
To: andrewc AT rosemail DOT rose DOT hp DOT com, djgpp-workers AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: No 'extern' in standard include files

At 10:43  1/22/1998 PST, Andrew Crabtree wrote:
>For whatever reason (work is slow these days), I ported gcc to use
>NASM as a back end instead of using gas.  I spent a lot of time
>debugging assembly output, and I just can't understand AT&T syntax.
>While I was doing this I 
>ran into something strange in the header files.  Nasm, unlike gas,
>wants things to be explicitly externed.  Otherwise it will error
>out (I changed nasm so this could be disabled).  I also changed
>gcc so that it explicitly outputs externs (which it normally wouldn't
>do).  This works fine for things labelled with the 'extern' keyword.
>However, none of the function prototypes (at least not in stdio.h) 
>from DJDEV use the extern keyword?  I notice that my hpux header
>files all do use this keyword.  Any problems that would be
>caused by adding extern to all the prototypes?  I'm willing to
>do the work and submit the changes, I just didn't want to start
>on it if it had already been considered and rejected.
I don't think it should cause a problem. K&R I (the only version I have
handy) section 8.1 says:

If the sc-specifier [storage class specifier, i.e. `static', `register',
`extern'] is missing from a declaration, it is taken to be `auto' inside a
function, `extern' outside.

So those with no specifier are already considered `extern'. Unless this has
changed in ANSI C (which I doubt), adding them should be fine.

OTOH, if GCC knows this (as it must), it might be possible to find where
that code is buried and add the asm stuff there. This would let you use
other headers without modification.

This whole thing seems odd. Aren't there already any GCC systems on which
the assembler demands extern declarations?

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019