🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #42272

[Q] Is GCC's <stdio.h> correct?

#42272
From: Alex Measday
Date: Tue, 19 Dec 1995 00:00
88 lines
4330 bytes
[Would somebody please give me a newsreader that works?  :(]

We have GCC version 2.6-95q2 installed under SunOS 4.1.3.  When I compile
a "Hello, World!" program:

    #include  <stdio.h>

    int  main (int argc, char *argv[])
    {
        printf ("Hello, World!\n") ;
    }

I get a warning:

    % gcc -Wall hello.c
    hello.c: In function `main':
**  hello.c:5: warning: implicit declaration of function `printf' **
    hello.c:6: warning: control reaches end of non-void function

PRINTF() not declared?  When I use the "-E" option to look at the CPP output,
I find that <stdio.h> has the following structure:

    (/usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6-95q2/include/stdio.h)
    #include <stdarg.h>   
    #ifndef FILE
        extern struct _iobuf {...} _iob[] ;
        ...
    #    define FILE struct _iobuf
        ...
        ... EXTERN declarations for functions that return non-INT and
        ... non-VOID types, using the _PARAMS macro.
        ...
    #endif
    #if defined(__cplusplus) || defined(__USE_FIXED_PROTOTYPES__)
        ...
        ... EXTERN declarations for functions that return INTs and VOIDs (;),
        ... but the _PARAMS macro is NOT used.
        ...
    #endif

The final "#if/#endif" section is not included since the two macros are not
defined.  Is something wrong with our GCC installation, or am I just the
first person to notice that 3/4 of the Standard I/O functions are not being
declared?

Can anyone shed some light on this problem for me?  ("-v" output from the
GCC command is found below.)

                                Thanks, Alex

========================================================================
|  Alex Measday             Code 521 - Microelectronic Systems Branch  |
|  Integral Systems, Inc.            NASA Goddard Space Flight Center  |
|  alexm@vlsi.gsfc.nasa.gov                             Greenbelt, MD  |
========================================================================
)             http://vlsi22.gsfc.nasa.gov/~alexm/home.html             (
========================================================================
           
********************************************************************************
    Verbose output from "gcc -v -Wall hello.c"
********************************************************************************

Reading specs from /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6-95q2/specs
gcc version 2.6-95q2
 /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6-95q2/cpp -lang-c -v \
    -iprefix /vxworks/links/os/gnu/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6-95q2/ \
    -undef -D__GNUC__=2 -D__GNUC_MINOR__=6 -Dsparc -Dsun -Dunix \
    -D__GCC_NEW_VARARGS__ -D__sparc__ -D__sun__ -D__unix__ \
    -D__GCC_NEW_VARARGS__ -D__sparc -D__sun -D__unix \
    -Asystem(unix) -Asystem(bsd) -Acpu(sparc) -Amachine(sparc) \
    -Wall hello.c /usr/tmp/cca28958.i
GNU CPP version 2.6-95q2 (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /vxworks/links/os/gnu/lib/...
 /vxworks/links/os/gnu/lib/... (Non-existent directories)
 /vxworks/links/os/gnu/lib/...
 /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6-95q2/../../../../include
 /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6-95q2/../../../../sparc-sun-sunos$
 /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6-95q2/include
 /usr/include
End of search list.
 /usr/gnu/lib/gcc-lib/sparc-sun-sunos4.1.3/2.6-95q2/cc1 /usr/tmp/cca28958.i \
    -quiet -dumpbase hello.c -Wall -version -o /usr/tmp/cca28958.s
GNU C version 2.6-95q2 (sparc) compiled by GNU C version 2.6-95q2.  
hello.c: In function `main':
hello.c:5: warning: implicit declaration of function `printf'
hello.c:6: warning: control reaches end of non-void function
Technical Details
Message-ID: <4b70og$mc5@post.gsfc.nasa.gov>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,1d48b55f28d63030,start
X-Google-Attributes: gid11318c,public
From: Alex Measday <alexm@vlsi.gsfc.nasa.gov>
Subject: [Q] Is GCC's <stdio.h> correct?
Date: 1995/12/19
Message-ID: <4b70og$mc5@post.gsfc.nasa.gov>
X-Deja-AN: 122393831
content-type: text/plain; charset=us-ascii
organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA
x-url: news:gnu.gcc.help
mime-version: 1.0
newsgroups: gnu.gcc.help
x-mailer: Mozilla 1.1N (X11; I; SunOS 4.1.3 sun4c)