Current-Users archive

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

Re: lint libraries?



Am 06.04.2025 um 00:22 schrieb Greg A. Woods:
> I haven't played enough with xlint in a post C89 world yet to know if it
> will also still catch all the same things (including missing prototypes,
> and mis-matches between prototypes and definitions).

Feel free to look at usr.bin/xlint/lint1/README.md and
tests/usr.bin/xlint/lint1/*.c, which describe what lint can and cannot
do. If there's anything missing, just ask.

>> What about:
>>
>> man "$1"
>
> 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.

>> 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.

> 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.

> 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?

> That's basically what Cscope does, but unfortunately you can't get it to
> parse just header files and find declarations (i.e. prototypes) -- it
> insists on finding definitions so you have to parse all the library
> sources, and of course it doesn't have a quick-and-dirty way to just
> write out just the matching declaration(s).

If you want a demangler for the lint library files, you can write it by
copying usr.bin/xlint/lint2/read.c.

To output a type in cdecl format, you can copy
usr.bin/xlint/common/tyname.c.

Roland



Home | Main Index | Thread Index | Old Index