Article View: gnu.gcc.help
Article #50177re: getting ANSI prototypes for gcc 2.4.5
From: Steve Harris
Date: Thu, 11 Nov 1993 14:28
Date: Thu, 11 Nov 1993 14:28
66 lines
2701 bytes
2701 bytes
From mark@mark.mvision.com (Mark Evenson)
Newsgroups: gnu.gcc.help
Subject: getting ANSI prototypes for gcc 2.4.5
Date: Wed, 10 Nov 1993 20:25:52 GMT
>when I compile with:
>
>gcc -g -ansi -Wall foo.c
>
>under sparc-sun-sunos4.1.3, I get warnings about implicit definitions of
>functions.
>
>I'm confused, so I just supply my own in an #include "ansihack.h". But I
>would rather not do this.
>
>Wasn't the 'fixincludes' pass in installing the compiler supposed to fix
>this?
>
Fixincludes apparently only makes your include files ANSI
compatible (you don't have to have prototypes to be ANSI
compatible).
>I don't have to explicity include the
>${GNU_PREFIX}/lib/gcc-lib/sparc-sun-sunos4.1.3/2.4.5/include directory,
>do I?
>
No.
gcc doesn't provide you with header files that are specific to your
system. I guess we can't expect these guys to have all the headers
necessary for everyone's system. I posted a plea for any sources of
ANSI system includes for sunos4.1.3 but received no ideas. I don't
know if I have to buy a compiler to get them or if they are available
in public domain.
Your old headers may contain old style prototypes i.e. printf();.
If you define printf(char * ...) in your ansihack.h and include
stdio.h in your source module I believe it will just
be ignored. No warnings, no typechecking. You may also receive
conflicts with builtin functions. Use -fno-builtin to alleviate
this.
For some real headaches try:
-Wstrict-prototypes
-Wmissing-prototypes
these will make sure you are type checking your parameters correctly
(provided your ANSI prototypes are the correct ones)
The ANSI include files will have something like:
#if defined(__STDC__)
extern int fclose(FILE *);
.
.
.
#endif
extern int fclose(), ...
You are the only other programmer I know of who cares somewhat
about type checking your parameters. I would have thought this
would be a higher priority in a goofy language like C (or maybe
we're just the only ones here with stone-aged system includes).
Technical Details
Message-ID:
<9311111426.AA02702@rdxsun38.aud.alcatel.com>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!cs.utexas.edu!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,3cd95749e36de244 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-11-11 06:31:54 PST Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!sol.ctr.columbia.edu!howland.reston.ans.net!cs.utexas.edu!not-for-mail From: slharris@rdxsun38.aud.alcatel.com (Steve Harris) Newsgroups: gnu.gcc.help Subject: re: getting ANSI prototypes for gcc 2.4.5 Date: 11 Nov 1993 08:28:05 -0600 Organization: UTexas Mail-to-News Gateway Lines: 66 Sender: daemon@cs.utexas.edu Message-ID: <9311111426.AA02702@rdxsun38.aud.alcatel.com> NNTP-Posting-Host: news.cs.utexas.edu