[PATCH] Various pages: Remove unused <sys/types.h>

Zack Weinberg zackw@panix.com
Sun Mar 14 21:40:21 GMT 2021


On Sun, Mar 14, 2021 at 12:04 PM Alejandro Colomar via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> The manual pages are already inconsistent in which headers need
> to be included.  Right now, not all of the types used by a
> function have their required header included in the SYNOPSIS.
>
> If we were to add the headers required by all of the types used by
> functions, the SYNOPSIS would grow too much.  Not only it would
> grow too much, but the information there would be less precise.
>
> Having system_data_types(7) document each type with all the
> information about required includes is much more precise, and the
> info is centralized so that it's much easier to maintain.
>
> So let's document only the include required for the function
> prototype, and also the ones required for the macros needed to
> call the function.

I endorse this change.  For glibc, if the header file containing the
function prototype doesn't also provide everything you need to call
the function, it's a bug (except for a few cases where the relevant
standards prevent us from doing this, e.g. a function that calls
vprintf will need the macros in <stdarg.h>, but the C standard
specifically forbids <stdio.h> to include <stdarg.h>).

> <sys/types.h> only defines types, not functions or constants, so
> it doesn't belong to man[23] (function) pages at all.
> I ignore if some old systems had headers that required you to
> include <sys/types.h> *before* them (incomplete headers),

Such systems did exist in the past, but they are too old to worry
about nowadays.  I don't think it's possible for them to be compliant
with POSIX.1-1995, and the examples I know of personally (SunOS 4, for
instance) were not even fully compliant with C89.

zw


More information about the Libc-alpha mailing list