about summary refs log tree commit diff
path: root/Rules
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2019-06-18 11:47:49 -0400
committerZack Weinberg <zackw@panix.com>2020-01-08 13:04:44 -0500
commitafaa4fe717db9f4106570665f5db0cd45684b96a (patch)
tree202ee1da168bf8b9c9a3209fa54d52fb8404d496 /Rules
parent89cbc039a98f6bfc7e27c98a7e3799cf190c11f1 (diff)
downloadglibc-afaa4fe717db9f4106570665f5db0cd45684b96a.tar.gz
glibc-afaa4fe717db9f4106570665f5db0cd45684b96a.tar.xz
glibc-afaa4fe717db9f4106570665f5db0cd45684b96a.zip
Don’t include sys/cdefs.h directly from public headers.
The convention throughout glibc is that every public header includes
features.h directly, as its first action, and relies on features.h to
include sys/cdefs.h.  In a few places, though, it’s been done the
other way around, usually in headers that were copied from a BSD
source (where the convention is exactly the opposite).  This patch
makes all installed headers match the glibc convention.

This patch also corrects a bug in glob.h: it may declare size_t
without notifying stddef.h that it has done this, so e.g.

    #define _XOPEN_SOURCE 700
    #include <glob.h>
    #include <stddef.h>
    int dummy;

declares size_t twice, which is invalid prior to C2011.  I wasn’t able
to persuade gcc 8 to issue an error, even with -std=c89 -Wsystem-headers,
but clang is not so lenient.

	* posix/glob.h: Include features.h, not sys/cdefs.h.
	When __USE_XOPEN || USE_XOPEN2K8, include stddef.h for size_t;
	otherwise, issue an immediate #error if __SIZE_TYPE__ is not
	available. Use __gsize_t, not __size_t, as an impl-namespace
	alternative name for size_t.
	* conform/data/glob.h-data: Adjust to match.

	* inet/netinet/igmp.h, mach/lock-intern.h, misc/ar.h
	* misc/sys/auxv.h, resolv/resolv.h, socket/sys/un.h
	* sunrpc/rpc/auth_des.h, sunrpc/rpc/rpc_msg.h
	* sysdeps/generic/memcopy.h, sysdeps/generic/netinet/tcp.h
	* sysdeps/htl/pthread.h, sysdeps/mach/hurd/net/ethernet.h
	* sysdeps/mach/hurd/net/if_arp.h: Include features.h, not sys/cdefs.h.

	* scripts/check-obsolete-constructs.py (HEADER_ALLOWED_INCLUDES):
        Update.
Diffstat (limited to 'Rules')
0 files changed, 0 insertions, 0 deletions