*BSD News Article 17131


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!bruce.cs.monash.edu.au!monu6!escargot!minyos.xx.rmit.OZ.AU!rxklam
From: rxklam@minyos.xx.rmit.OZ.AU (Luke Mewburn)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: stdio.h & __sputc problems with gcc -ansi
Date: 14 Jun 1993 17:45:49 GMT
Organization: Sheepish Looks R Us.
Lines: 41
Message-ID: <1vidgd$rn1@escargot.xx.rmit.OZ.AU>
References: <1vhfrt$p3p@escargot.xx.rmit.OZ.AU> <1vi2be$qo4@escargot.xx.rmit.OZ.AU>
Reply-To: zak@rmit.edu.au
NNTP-Posting-Host: minyos.xx.rmit.oz.au

raemph@kittyhawk.aero.rmit.OZ.AU (Martin P. Howell) writes:

> I wrote:
>> I've discovered an annoying problem in <stdio.h> when running
>> gcc (1.40 or whatever's the default) with -ansi, and a project with
>> multiple .o files.

>> When gcc gets around to linking, I get "multiply defined __sputc"
>> errors (I can't remember the exact text, this is from memory).
>> Looking in stdio.h, I see that __sputc is defined as 
>> 	static __inline

> In fact, __sputc is defined as 

> static inline 

> without the leading underscores (at least in both 386bsd 0.1 and NetBSD).
> When the -ansi switch is given, gcc seems to ignore both the static and
> the inline rather than giving an error, hence making the function global.

You are quite correct on the definition. I just ftp-ed the stdio.h out
of sun-lamp; instead of dumping from telix, rebooting to netbsd,
grabbing my copy, and going back to moss-dos. They musta fixed it
there...  _That_ will teach me not to grab the latest sources to show a
`bug' :|

> Just add two underscores to the inline in /usr/include/stdio.h as in

> static __inline int __sputc(int _c, FILE _p) {

> and the problem will go away (presumably this lack of underscores is just
> a typing mistake).

Yup, worked perfect.

> -Martin.
> raemph@kittyhawk.aero.rmit.oz.au

--
Luke Mewburn [Zak], <zak@rmit.edu.au>
"Lawyers - the only group for which ignorance of the law is not a crime" - anon