Getting rid of "old-style-definition" in 3.3.0r

15 views
Skip to first unread message

hoefnix

unread,
Feb 22, 2014, 1:24:39 PM2/22/14
to mini...@googlegroups.com
Hello everyone,

In a crazy mood I updated all the old K&R function definitions. They are now gone. I didn't update anything else (except some style / typo changes). Compiling went fine and debug output is fine too. However I haven't run the tests (but don't expect anything) because I am not quite sure how to setup the virtual machine.

Grts,
Gerard
output.diff

Perry E. Metzger

unread,
Feb 22, 2014, 3:31:09 PM2/22/14
to hoefnix, mini...@googlegroups.com
When we were doing this for a lot of NetBSD, we did a lot of the work
semi-automatically, which made reliability higher. Between protoize
and something that automatically expanded all the __Ps, things went
pretty fast. We did a lot of testing, but I don't think there was a
single bug that happened as a result of *automated* prototypes.

That said, even if you automate, the one potential problem is if you
have calls made from scopes where no prototype definition is in
scope. The tricky bit is that some promotions can happen differently
in old K&R world. There's a -W for both gcc and llvm that will detect
this for you, though.

--
Perry E. Metzger pe...@piermont.com

Lionel Sambuc

unread,
Feb 24, 2014, 8:06:22 AM2/24/14
to mini...@googlegroups.com
Hi Gerard,


Here is a patch generated from your submission, please tell me if this is
fine for you, or if you want something changed in it.

I took the liberty to fix a few whitespace errors, outside of that, this is your
patch as-is.

I am currently testing it. If testing is successful, and you are OK
with it in its current form, this patch will be merged.


Regards,

Lionel

Lionel Sambuc

unread,
Feb 24, 2014, 8:08:42 AM2/24/14
to mini...@googlegroups.com
With the patch actually attached, this is better...
0001-Getting-rid-of-old-style-definition.patch

hoefnix

unread,
Feb 24, 2014, 11:55:23 AM2/24/14
to mini...@googlegroups.com
Looks good to me.

Thanks,
Gerard

hoefnix

unread,
Feb 24, 2014, 11:58:01 AM2/24/14
to mini...@googlegroups.com, hoefnix
Perry, what tool do you use for automatic K&R to Ansi conversion?

Perry E. Metzger

unread,
Feb 24, 2014, 12:07:50 PM2/24/14
to hoefnix, mini...@googlegroups.com
On Mon, 24 Feb 2014 08:58:01 -0800 (PST) hoefnix
<gvds...@gmail.com> wrote:
> Perry, what tool do you use for automatic K&R to Ansi conversion?

I haven't touched that problem in a very long time (maybe over a
decade) but I think protoize is still part of gcc.

If I recall, it has a bit of trouble with a few constructs but it
tells you when it can't handle them. I also remember that the code
formatting of the prototypes wasn't always terribly nice, but indent
easily fixes that.

hoefnix

unread,
Feb 24, 2014, 12:29:24 PM2/24/14
to mini...@googlegroups.com, hoefnix
To be honest, I have seen lots of different styles in Minix. I think that a tool like indent would be very nice for _all_ the code.

Perry E. Metzger

unread,
Feb 24, 2014, 3:19:30 PM2/24/14
to hoefnix, mini...@googlegroups.com
On Mon, 24 Feb 2014 09:29:24 -0800 (PST) hoefnix
<gvds...@gmail.com> wrote:
> To be honest, I have seen lots of different styles in Minix. I
> think that a tool like indent would be very nice for _all_ the code.

The NetBSD sources have both a defined style called KNF
(see:
http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style?rev=HEAD&content-type=text/x-cvsweb-markup
)
and an indent initialization file that enforces most of it (see the
very short file:
http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/indent.pro?rev=1.3&content-type=text/x-cvsweb-markup
)

There are also emacs etc. init files to make it easier to write in
this style.
Reply all
Reply to author
Forward
0 new messages