On Thu, 21 May 2015, Baptiste Daroussin wrote:
Log: add an include on sys/types.h because we do explicitly use size_t remove unused stdbool.h
sys/types.h may be needed for some other typedef, but not for size_t. size_t is already declared in at least 3 other of the included headers: - <stdlib.h> and <string.h> (C90 standard) - <unistd.h> (POSIX.1-2001 standard) <sys/types.h> is a prerequisite for <unistd.h> in POSIX.1-1990, and most section 2 man pages still document it as a prerequiste for their syscalls. They place it before the include of <unistd.h> but are too fuzzy to document if it is a prerequisite for <unistd.h or their syscalls. But it have never actually been a prerequisite in any version of FreeBSD. In FreeBSD-1 and 4.4BSD-Lite2, <unistd.h> includes <sys/types.h> and thus gets size_t and lots of pollution. <unistd.h> was cleaned up a bit in 2002, but the ifdefs for things like _SIZE_T_DECLARED in this cleanup are still nonsense, because <unistd.h> still includes <sys/types.h> before these ifdefs and thus gets size_t and lots of pollution, much the same as in FreeBSD-1. Some of the section 2 headers were bogusly changed to say that sys/types.h is a prerequisite for their syscalls _after_ POSIX.1-2001 standardized it not being a prerequisite for <unistd.h> for the syscalls declared there. It is needed for portability to pre-POSIX.1-2001 systems that are not polluted like FreeBSD, if any. IIRC, even POSIX.1-1990 permits <unistd.h> (or any POSIX header) to declare any typedef ending in _t, so <unistd.h> can declare size_t for itself and might even work without its prerequisite. Applications just cannot depend on this. In the previous change, the use of MAXPATHLEN regressed to use of PATH_MAX. MAXPATHLEN was honestly unportable. It defined in all (?) BSD systems. PATH_MAX only defined if {PATH_MAX} is constant. It is better to be honestly unportable than to use PATH_MAX incorrectly. MAXPATHLEN required the include of <sys/param.h>. That gave <sys/types.h> and lots of undocumented pollution. Apparently, none of the pollution was needed, not even <sys/types.h>. Bruce _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"