Date: Mon, 28 May 2001 12:32:51 -0700 From: Dima Dorfman <dima@unixfreak.org> To: obrien@freebsd.org Cc: Sheldon Hearn <sheldonh@starjuice.net>, Bruce Evans <bde@zeta.org.au>, cvs-committers@freebsd.org, cvs-all@freebsd.org Subject: Re: cvs commit: src/usr.bin/jot Makefile jot.c Message-ID: <20010528193251.D76213E0B@bazooka.unixfreak.org> In-Reply-To: <20010528094712.A16116@dragon.nuxi.com>; from obrien@freebsd.org on "Mon, 28 May 2001 09:47:13 -0700"
next in thread | previous in thread | raw e-mail | index | archive | help
"David O'Brien" <obrien@freebsd.org> writes: > On Mon, May 28, 2001 at 01:49:55PM +0200, Sheldon Hearn wrote: > > Bleh. I think this is stupid. The compiler we use shouldn't force > > us into unnecessary source work-arounds. Not providing a forward > > declaration for main() is _always_ okay because it's _never_ called by > > any other subroutine in the module. > > > > David, how would you feel about a local hack to gcc for this? > > W/o really thinking about it, I'd have to say I'd have to see the diff > and which file it patches before commenting. It's +2 -1 (excluding $FreeBSD$) in c-decl.c, which is already off the vendor branch. Patch attached below. As for the rest of this thread, I agree that a prototype for main() is silly. In this commit, it was just something necessary to silence a warning and set WARNS (setting WARNS is good, since it forces new code to be warning-free as much as possible). Full ANSIfication would be going too far for relatively little gain in some cases. Dima Dorfman dima@unixfreak.org Index: c-decl.c =================================================================== RCS file: /stl/src/FreeBSD/src/contrib/gcc.295/c-decl.c,v retrieving revision 1.3 diff -u -r1.3 c-decl.c --- c-decl.c 2001/02/17 08:54:44 1.3 +++ c-decl.c 2001/05/28 19:26:49 @@ -6490,7 +6490,8 @@ /* Optionally warn of old-fashioned def with no previous prototype. */ if (warn_strict_prototypes && TYPE_ARG_TYPES (TREE_TYPE (decl1)) == 0 - && !(old_decl != 0 && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0)) + && !(old_decl != 0 && TYPE_ARG_TYPES (TREE_TYPE (old_decl)) != 0) + && strcmp ("main", IDENTIFIER_POINTER (DECL_NAME (decl1)))) warning ("function declaration isn't a prototype"); /* Optionally warn of any global def with no previous prototype. */ else if (warn_missing_prototypes To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010528193251.D76213E0B>