Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lint libraries?



At Mon, 7 Apr 2025 18:45:25 +0200, Roland Illig <roland.illig%gmx.de@localhost> wrote:
Subject: Re: lint libraries?
>
> > The whole point of my "typeof" was to avoid having to look at a manual
> > page!  :-)
>
> But why? The function prototypes are always in the SYNOPSIS section, so
> they are easy to find.

Manual pages weren't always available on all systems one might have to
use in the good old days.

Plus a manual page probably fills the screen even when put through a
pager, where one or two lines from grep won't scroll away so quickly.

Worst of all there were no prototypes in header files -- all you could
learn from a header was the return type.

So the lint libraries were immensely useful for both humans and lint
itself!

> >> grep "[0-9]$1" /usr/libdata/lint/llib-*
> >
> > With xlint that doesn't show me anything of much use, at least not in
> > any human readable form.
>
> That's right, but I'm still unsure for what use cases you need to query
> the function prototypes.

For the same reason one might want to read a manual page for a library
function -- it's just another quick and very easy way to find the
calling conventions for a function.

Also once upon a time there was no "LIBRARY" section (the link option
was down somewhere in the description), so knowing which lint library
something was found in would give you that information instantly

> > I'm not saying though that xlint should provide those old style lint
> > library sources.
>
> If they tend to bitrot fast, as you said, I definitely won't add them.

Well they didn't tend to bitrot much if any (I never found any mistakes,
though possibly sometimes newer entries were missing), but from what I
understand they were manually maintained, so the there was room for error.

Having lint maintain them would of course prevent any bitrot!

> > These days I would ideally want a tool that could parse enough CPP and C
> > to trawl through the headers and find a matching prototype declaration.
>
> What's your use case? There's already https://nxr.netbsd.org/ where you
> can ask for the definition of a function. Does that cover your needs?

Web pages are always a last resort, especially remote ones!

The reason for having a tool parse the headers instead of just using
grep is of course because in modern systems there can be multiple
declarations with CPP logic selecting the appropriate one, and sometimes
they're spread over multiple lines too, and then there are all the
comments that often have function names in them.

My "typeof" is meant to be a simple command-line tool that'll query
local information and show the return type and parameter types and their
order for a named or matching function (or indeed any global variable).
Showing the library name would be an added bonus.

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpx0jM0WCx1_.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index