Jim Meyering wrote: > > you may want to remove > > include <stdbool.h> from it tomorrow, when refactoring openat_needs_fchdir > > in some way. > > I see your point, but don't you think that if someone were to > remove openat_needs_fchdir and the inclusion of <stdbool.h>, > they would try to verify that openat.c still compiles?
For uses of 'bool', which would give a syntax error if <stdbool.h> is not included, you're right. But more generally, it happens to have missing #includes after changes. See these ChangeLog entries: 2011-11-04 Bruno Haible <[email protected]> closedir: Avoid warning on mingw. * lib/closedir.c: Include <unistd.h>. 2011-10-30 Bruno Haible <[email protected]> ffsl, ffsll: Avoid compilation error due to 'restrict'. * lib/ffsl.h: Include <config.h>. Suggested by Tom G. Christensen <[email protected]>. 2011-10-20 Bruno Haible <[email protected]> openpty: Avoid compilation error on AIX 6.1. * lib/pty.in.h [AIX]: Include <sys/ioctl.h>, for 'struct winsize'. 2011-09-25 Bruno Haible <[email protected]> strings: Fix compilation error on MSVC. * lib/strings.in.h: Include <stddef.h> for size_t. 2011-07-11 Eric Blake <[email protected]> regex: avoid compiler warning * lib/regex.c (includes): Include <strings.h>, for use of strcasecmp in regcomp.c. Reported by Joachim Schmitz. 2011-03-13 Bruno Haible <[email protected]> passfd: Fix compilation error on OpenBSD. * lib/passfd.c: Include <sys/uio.h>. While you are right that for <stdbool.h> you don't need to be so careful about whether you've included it or not, it is a general good guideline to #include all include files that are "apparently" needed for the given source code (according to POSIX) in the same file, except - like Paul said - those that are already included in the interface .h file. Bruno -- In memoriam Bernhard Lichtenberg <http://en.wikipedia.org/wiki/Bernhard_Lichtenberg>
