From owner-freebsd-arch Thu Jan 31 14:29: 0 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 9542637B400 for ; Thu, 31 Jan 2002 14:28:52 -0800 (PST) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id g0VMROi118974; Thu, 31 Jan 2002 17:27:24 -0500 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <200201312043.g0VKhrDx004889@xerxes.courtesan.com> References: <20020131072933.GQ22384@daemon.ninth-circle.org> <3C58F78E.3F66EA8E@mindspring.com> <3C58FBEC.746257BB@softweyr.com> <20020131.085938.18394797.imp@village.org> <87d6zq31z6.fsf@snark.piermont.com> <200201312043.g0VKhrDx004889@xerxes.courtesan.com> Date: Thu, 31 Jan 2002 17:27:22 -0500 To: "Todd C. Miller" , "Perry E. Metzger" From: Garance A Drosihn Subject: Re: __P macro question Cc: "M. Warner Losh" , wes@softweyr.com, tlambert2@mindspring.com, asmodai@wxs.nl, mckusick@mckusick.com, arch@FreeBSD.ORG, peter@wemm.org, phk@critter.freebsd.dk, deatley@apple.com, jkh@winston.freebsd.org, deraadt@cvs.openbsd.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 1:43 PM -0700 1/31/02, Todd C. Miller wrote: >In message <87d6zq31z6.fsf@snark.piermont.com> > so spake "Perry E. Metzger" (perry): > >> If you do it by hand, we'll get source diffs by accident. If we build >> a quick set of scripts to do it, since we'll all be using the same >> scripts, we'll end up with fewer diffs. > >My inclination is to do the simple stuff programatically and do the >more complicated things by hand. A simple, dumb, ed script such >as the following is capable of changing the majority of things. It >doesn't attempt to deal with multi-line prototypes nor does it try >to convert prototypes that contain parens. These remaining things >can then be converted by hand. I believe Warner's plan for 'bin' is to both get rid of __P()'s, and to change routine declarations to be ANSI-style. The __P()'s are pretty easy to do with a script, but I think the declarations pretty much have to be done by hand. I may be using the wrong term there by saying 'declarations'... I mean the parameters as described at the start of the actual code for the routine. I did this to lpr a few months ago, and came across things like: static void scan_out(pp, scfd, scsp, dlm) struct printer *pp; int scfd, dlm; char *scsp; { Turning into: static void scan_out(struct printer *pp, int scfd, char *scsp, int dlm) { Ie, the parameters are specified in a different order for the parameter list than they are when listing their types. This would be hard to automate with any simple script... I also came across things like a prototype of: static int sendfile __P((struct printer *pp, int type, char *file, int format)); for a procedure declaration of: static int sendfile(pp, type, file, format) struct printer *pp; int type; char *file; char format; { (where the type for 'format' is different in the prototype than it is in the routine). In my case, I checked the end result of all my changes by using 'md5' on the object code, and either attempt to fix the above caused a change for the object code generated under Alpha. So when doing this to lpr, I started out thinking I would write some script to automate the conversion, but in the end I decided to do it all by hand just so I knew exactly what was going on... Note that I'm not doing any of the work for THIS drive to get rid of __P(), so everyone can safely ignore what I'm saying. As long as everyone else is happy with the plan, I have nothing to add. :-) -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message