From owner-cvs-all Mon May 28 5: 5:20 2001 Delivered-To: cvs-all@freebsd.org Received: from ringworld.nanolink.com (ringworld.nanolink.com [195.24.48.13]) by hub.freebsd.org (Postfix) with SMTP id 64C2337B422 for ; Mon, 28 May 2001 05:05:13 -0700 (PDT) (envelope-from roam@orbitel.bg) Received: (qmail 6394 invoked by uid 1000); 28 May 2001 12:04:15 -0000 Date: Mon, 28 May 2001 15:04:15 +0300 From: Peter Pentchev To: Bruce Evans , Sheldon Hearn , Dima Dorfman , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/usr.bin/jot Makefile jot.c Message-ID: <20010528150415.H588@ringworld.oblivion.bg> Mail-Followup-To: Bruce Evans , Sheldon Hearn , Dima Dorfman , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org References: <50418.991042601@axl.fw.uunet.co.za> <20010528145944.F588@ringworld.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010528145944.F588@ringworld.oblivion.bg>; from roam@orbitel.bg on Mon, May 28, 2001 at 02:59:44PM +0300 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, May 28, 2001 at 02:59:44PM +0300, Peter Pentchev wrote: > On Mon, May 28, 2001 at 09:43:58PM +1000, Bruce Evans wrote: > > 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. > > In this case, gcc is not complaining about main() not being prototyped, > and it's not complaining because of -Wmissing-prototypes. Rather, it's > -Wstrict-prototypes that's making it whine, because of a K&R declaration > without a previous prototype. It whines about 'function declaration > is not a prototype', not about a missing prototype. (though yes, I agree that if main() is special in other cases, it should maybe be made special for the strict-prototypes check, too.) G'luck, Peter -- If you think this sentence is confusing, then change one pig. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message