🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.c.moderated
6 messages
6 total messages Started by K Goldman Thu, 11 Apr 1996 00:50
include file checking
#2569
Author: K Goldman
Date: Thu, 11 Apr 1996 00:50
8 lines
665 bytes
My compiler seems to check function prototypes if they exist, but
is just as happy to not have them.  Therefore . . .

Is there an automated way to insure that I have included all the
header files that I need in my source code?

-- 
Ken Goldman   kgold@watson.ibm.com   914-784-7396
Re: include file checking
#2574
Author: Andreas Schwab
Date: Thu, 11 Apr 1996 18:54
16 lines
1224 bytes
In article <4khl1h$stq@solutions.solon.com>, kgold@watson.ibm.com (K Goldman) writes:

|> My compiler seems to check function prototypes if they exist, but
|> is just as happy to not have them.  Therefore . . .

|> Is there an automated way to insure that I have included all the
|> header files that I need in my source code?

You don't say which compiler you use, but if you use GCC you can
enable -Wmissing-prototypes, -Wstrict-prototypes,
-Wmissing-declarations, and/or -Wimplicit, depending on what you want
to check for.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.informatik.uni-dortmund.de              completely different"
Re: include file checking
#2576
Author: Tom McGlynn
Date: Thu, 11 Apr 1996 23:49
13 lines
1047 bytes
K Goldman (kgold@watson.ibm.com) wrote:
: Is there an automated way to insure that I have included all the
: header files that I need in my source code?

If possible, tell your compiler to check for this.

For example, the -v option for SPARCcompiler 3.0 gives messages similar to:

"temp.c", line 3: warning: implicitly declaring function to return int: help()

--
The preceding is my opinion and not necessarily the opinion of my
employer.
Re: include file checking
#2579
Author: K Goldman
Date: Fri, 12 Apr 1996 13:19
23 lines
1342 bytes
schwab@lamothe.informatik.uni-dortmund.de (Andreas Schwab) writes:
|> kgold@watson.ibm.com (K Goldman) writes:
|> 
|> |> My compiler seems to check function prototypes if they exist, but
|> |> is just as happy to not have them.  Therefore . . .
|> 
|> |> Is there an automated way to insure that I have included all the
|> |> header files that I need in my source code?
|> 
|> You don't say which compiler you use, but if you use GCC you can
|> enable -Wmissing-prototypes, -Wstrict-prototypes,
|> -Wmissing-declarations, and/or -Wimplicit, depending on what you want
|> to check for.
|> 

Sorry.  It's xlc, which is the ANSI version of cc, on an IBM RS/6000
running AIX 3.2.5.

I _did_ read the manual, and the man page, and the on-line help,
and there doesn't seem to be a switch to check for prototypes.

-- 
Ken Goldman   kgold@watson.ibm.com   914-784-7396
Re: include file checking
#2581
Author: Dan Pop
Date: Sat, 13 Apr 1996 02:27
51 lines
2121 bytes
In <4kll8t$o4r@solutions.solon.com> kgold@watson.ibm.com (K Goldman) writes:

>schwab@lamothe.informatik.uni-dortmund.de (Andreas Schwab) writes:
>|> kgold@watson.ibm.com (K Goldman) writes:
>|> 
>|> |> My compiler seems to check function prototypes if they exist, but
>|> |> is just as happy to not have them.  Therefore . . .
>|> 
>|> |> Is there an automated way to insure that I have included all the
>|> |> header files that I need in my source code?
>|> 
>|> You don't say which compiler you use, but if you use GCC you can
>|> enable -Wmissing-prototypes, -Wstrict-prototypes,
>|> -Wmissing-declarations, and/or -Wimplicit, depending on what you want
>|> to check for.
>|> 
>
>Sorry.  It's xlc, which is the ANSI version of cc, on an IBM RS/6000
>running AIX 3.2.5.
>
>I _did_ read the manual, and the man page, and the on-line help,
>and there doesn't seem to be a switch to check for prototypes.

Two possibilities:

1. Upgrade to AIX 4.1 and the current version of xlc, which does what you
   need:

    sp054:~/tmp 9> cat test.c
    void foo(void)
    {
	bogus();
    }
    sp054:~/tmp 10> xlc -qinfo -c test.c
    "test.c", line 3.5: 1506-304 (I) No function prototype given for 'bogus'.

2. Use gcc, which is freeware:

    sp054:~/tmp 11> gcc -Wall -c test.c
    test.c: In function `foo':
    test.c:3: warning: implicit declaration of function `bogus'

Given your email address, the first alternative might be free for you,
as well.

Dan
--
Dan Pop
CERN, CN Division
Email: danpop@mail.cern.ch 
Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
Re: include file checking
#2583
Author: Konrad Schwarz
Date: Sat, 13 Apr 1996 02:27
10 lines
782 bytes
In article <4khl1h$stq@solutions.solon.com>,
kgold@watson.ibm.com (K Goldman) writes:

|> Is there an automated way to insure that I have included all the
|> header files that I need in my source code?

Since C++ mandates that functions be properly prototyped, one thing
you might want to try is to run your code through a C++ compiler.

Konrad Schwarz
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads