Re: [RFA/commit] procfs.c: Remove unused functions and make many functions static

Maciej W. Rozycki
2012-05-04T09:10:15Z

On Thu, 3 May 2012, Joel Brobecker wrote:

> This is something that was triggered after seeing a patch silencing
> some -Wmissing-prototypes errors in procfs.c. The diff made me wonder
> about why we had so many non-static functions in procfs.c. Turns out
> most of them can actually be static.
>
> This patches the functions that can be static into static functions.
> It removes advances declarations when unnecessary.
>
> And it also delete unused functions...

I hesitated doing that in the change you must obviously have in mind
because it appeared to me that this source file wants to present a
complete API to /proc services, even if some parts are not actually
(currently) used by GDB (but may be or may have been sometime). Hence all
the unused functions have prototypes and are defined with external linkage
or GCC (and possibly some other compilers) would have complained about
them long ago, before -Wmissing-prototypes was added.

What is unclear to me of course is whether the availability of the
complete API (if my perception is indeed correct) is relevant any longer
and why the prototypes have never been moved to a header clients could
use. The file is very old:

Thu Oct 24 01:32:51 1991 Fred Fish (fnf at cygnus.com)

* procfs.c: New file for SVR4 /proc (process file system) support.

and a corresponding header was not added back then even though it had
clients (a common practice once, sigh, for any client to use its own
locally provided prototypes or even rely on default declarations).

Maciej