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

Date: Wed, 11 Oct 1995 12:03:43 -0400
From: kagel AT quasar DOT bloomberg DOT com
To: library AT ssd DOT anet DOT cz
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Prototype Checking
Reply-To: kagel AT ts1 DOT bloomberg DOT com

   Date: Sat, 7 Oct 1995 12:30:13 +0100 (MET)
   From: "Nathan L. Cutler" <library AT ssd DOT anet DOT cz>

   I am going through a C tutorial that is very good but quite old.  One of the
   things it is telling me to do is to enable prototype checking with my
   compiler.  I am using djgpp.  (1) is it actually necessary to turn on proto-
   type checking with gcc? and (2) what is the command-line extension to do so?

Gcc does do basic prototype checking, however there are options to add stricter
checking:

       -Wconversion
           Warn if a prototype causes a type conversion that is different
           from what would happen to the same argument in the absence of a
           prototype.  This includes conversions of fixed point to floating
           and vice versa, and conversions changing the width or signedness
           of a fixed point argument except when the same as the default
           promotion.

       -Waggregate-return
           Warn if any functions that return structures or unions are
           defined or called.

       -Wstrict-prototypes
           Warn if a function is declared or defined without specifying the
           argument types.  (An old-style function definition is permitted
           without a warning if preceded by a declaration which specifies
           the argument types.)

       -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.

       -Wredundant-decls
           Warn if anything is declared more than once in the same scope,
           even in cases where multiple declaration is valid and changes
           nothing.

       -Wnested-externs
           Warn if an extern declaration is encountered within a function.

       -mwarn-passed-structs
           Emit a warning message if a structure is passed to a function, or
           declared as a function argument.  This warns about the places
           where gcc will not interoperate with compilers that do not pass
           structures according to the 88open Object Compatibility Standard.

-- 
Art S. Kagel, kagel AT ts1 DOT bloomberg DOT com

Variety is the soul of pleasure.  --  Aphra Behn

- Raw text -


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