From owner-cvs-all Mon May 28 4:45:50 2001 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id C626737B424; Mon, 28 May 2001 04:45:42 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id VAA21577; Mon, 28 May 2001 21:45:30 +1000 Date: Mon, 28 May 2001 21:43:58 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Sheldon Hearn Cc: Dima Dorfman , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/jot Makefile jot.c In-Reply-To: <50418.991042601@axl.fw.uunet.co.za> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 28 May 2001, Sheldon Hearn wrote: > On Sun, 27 May 2001 17:55:52 MST, Dima Dorfman wrote: > > > Modified files: > > usr.bin/jot Makefile jot.c > > Log: > > Silence warnings and compile with WARNS=2 on i386 and alpha. > > Since when do you have to add a prototype for main()?! Since -Wmissing-prototypes was added to CFLAGS (by WARNS=2 or BDECFLAGS) to detect the potential error of not declaring extern functions in the right place (which is never in *.c). main() is a special case, however. It can't be declared in a header file in C because in the hosted (non-freestanding) case there are several valid but inconsistent prototypes for it: int main(void); /* required to work by ISO C90 */ int main(int argc, char **argv); /* same */ int main(int argc, char **argv, char **envp); /* optional POSIX */ int main(anything); /* optional implementation-defined */ gcc shouldn't warn about main() not being prototyped before it is defined even with -Wmissing-prototypes, but it currently warns about it if the definition is old-style. gcc -ffreestanding also seems to be broken. I think main() should not be special then, but it is. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message