Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2002 17:27:22 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        "Todd C. Miller" <Todd.Miller@courtesan.com>, "Perry E. Metzger" <perry@wasabisystems.com>
Cc:        "M. Warner Losh" <imp@village.org>, 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
Subject:   Re: __P macro question
Message-ID:  <p05101402b87f705dd790@[128.113.24.47]>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05101402b87f705dd790>