www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/11/17:01:30

Xref: news-dnh.mv.net comp.os.msdos.djgpp:2569
Path: news-dnh.mv.net!mv!news.sprintlink.net!howland.reston.ans.net!newsfeed.internetmci.com!bloom-beacon.mit.edu!senator-bedfellow.mit.edu!space.mit.edu!davis
From: davis AT space DOT mit DOT edu (John E. Davis)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Prototype Checking
Date: 11 Oct 1995 19:25:53 GMT
Organization: Center for Space Research
Lines: 35
References: <DGAnBG DOT 3Bq AT jade DOT mv DOT net>
Reply-To: davis AT space DOT mit DOT edu
Nntp-Posting-Host: wiwaxia.mit.edu
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

On Wed, 11 Oct 1995 16:03:43 GMT, kagel AT quasar DOT bloomberg DOT com
<kagel AT quasar DOT bloomberg DOT com> wrote: 
 :        -Wmissing-prototypes
 :            Warn if a global function is defined without a previous prototype
 :            declaration.  This warning is issued even if the definition
 :            itself provides a prototype.  The aim is to detect global
 :            functions that fail to be declared in header files.

I would like to see this extended to variable declarations as well.  Let me
be more specific.  Consider two files: header.h amd file.c:

/* header.h */
extern int function_one (void);
extern int Variable_One;

/* file.c */
#include "header.h"
int Variable_One;
static int Variable_Two;
int function_one (void) { ... }
int function_two (void) { ... }
static int function_three (void) {...}


Now, if compiled with -Wmissing-prototypes, a warning is generated for
function_two saying that a previous prototype does not exist.  However,
since function_three is static, no warning is generated.  This means that
one can use -Wmissing-prototypes to see which functions should be made
static.  I would like to have the ability to do this for variables as well.
That is, I would like to see a warning for Variable_One but not for
Variable_Two.

Comments?
--John

- Raw text -


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