diff options
| author | Zack Weinberg <zackw@panix.com> | 2016-08-23 21:19:17 -0400 |
|---|---|---|
| committer | Zack Weinberg <zackw@panix.com> | 2016-09-23 08:43:56 -0400 |
| commit | 4775578486c8ee2aa09b402eb272eb932e7e0691 (patch) | |
| tree | bbf7bd888aec1d626a492c2bece4ef0efd50169a /include | |
| parent | c66b29f9cce9bf7c67d55879dff5e4cd03ecfac1 (diff) | |
| download | glibc-4775578486c8ee2aa09b402eb272eb932e7e0691.tar.xz glibc-4775578486c8ee2aa09b402eb272eb932e7e0691.zip | |
Installed header hygiene (BZ#20366): Test of installed headers.
This adds a test to ensure that the problems fixed in the last several
patches do not recur. Each directory checks the headers that it
installs for two properties: first, each header must be compilable in
isolation, as both C and C++, under a representative combination of
language and library conformance levels; second, there is a blacklist
of identifiers that may not appear in any installed header, currently
consisting of the legacy BSD typedefs. (There is an exemption for the
headers that define those typedefs, and for the RPC headers. It may be
necessary to make this more sophisticated if we add more stuff to the
blacklist in the future.)
In order for this test to work correctly, every wrapper header
that actually defines something must guard those definitions with
#ifndef _ISOMAC. This is the existing mechanism used by the conform/
tests to tell wrapper headers not to define anything that the public
header wouldn't, and not to use anything from libc-symbols.h. conform/
only cares for headers that we need to check for standards conformance,
whereas this test applies to *every* header. (Headers in include/ that
are either installed directly, or are internal-use-only and do *not*
correspond to any installed header, are not affected.)
* scripts/check-installed-headers.sh: New script.
* Rules: In each directory that defines header files to be installed,
run check-installed-headers.sh on them as a special test.
* Makefile: Likewise for the headers installed at top level.
* include/aliases.h, include/alloca.h, include/argz.h
* include/arpa/nameser.h, include/arpa/nameser_compat.h
* include/elf.h, include/envz.h, include/err.h
* include/execinfo.h, include/fpu_control.h, include/getopt.h
* include/gshadow.h, include/ifaddrs.h, include/libintl.h
* include/link.h, include/malloc.h, include/mcheck.h
* include/mntent.h, include/netinet/ether.h
* include/nss.h, include/obstack.h, include/printf.h
* include/pty.h, include/resolv.h, include/rpc/auth.h
* include/rpc/auth_des.h, include/rpc/auth_unix.h
* include/rpc/clnt.h, include/rpc/des_crypt.h
* include/rpc/key_prot.h, include/rpc/netdb.h
* include/rpc/pmap_clnt.h, include/rpc/pmap_prot.h
* include/rpc/pmap_rmt.h, include/rpc/rpc.h
* include/rpc/rpc_msg.h, include/rpc/svc.h
* include/rpc/svc_auth.h, include/rpc/xdr.h
* include/rpcsvc/nis_callback.h, include/rpcsvc/nislib.h
* include/rpcsvc/yp.h, include/rpcsvc/ypclnt.h
* include/rpcsvc/ypupd.h, include/shadow.h
* include/stdio_ext.h, include/sys/epoll.h
* include/sys/file.h, include/sys/gmon.h, include/sys/ioctl.h
* include/sys/prctl.h, include/sys/profil.h
* include/sys/statfs.h, include/sys/sysctl.h
* include/sys/sysinfo.h, include/ttyent.h, include/utmp.h
* sysdeps/arm/nacl/include/bits/setjmp.h
* sysdeps/mips/include/sys/asm.h
* sysdeps/unix/sysv/linux/include/sys/sysinfo.h
* sysdeps/unix/sysv/linux/include/sys/timex.h
* sysdeps/x86/fpu/include/bits/fenv.h:
Add #ifndef _ISOMAC guard around internal declarations.
Add multiple-inclusion guard if not already present.
Diffstat (limited to 'include')
57 files changed, 220 insertions, 19 deletions
diff --git a/include/aliases.h b/include/aliases.h index f7cfafcd6c..ece69ebe43 100644 --- a/include/aliases.h +++ b/include/aliases.h @@ -1,6 +1,8 @@ #ifndef _ALIASES_H #include <inet/aliases.h> +# ifndef _ISOMAC + extern int __getaliasent_r (struct aliasent *__restrict __result_buf, char *__restrict __buffer, size_t __buflen, struct aliasent **__restrict __result) @@ -34,4 +36,5 @@ DECLARE_NSS_PROTOTYPES (nis) DECLARE_NSS_PROTOTYPES (nisplus) #undef DECLARE_NSS_PROTOTYPES +# endif /* !_ISOMAC */ #endif diff --git a/include/alloca.h b/include/alloca.h index 01500259b8..fd90664f0a 100644 --- a/include/alloca.h +++ b/include/alloca.h @@ -1,6 +1,9 @@ #ifndef _ALLOCA_H #include <stdlib/alloca.h> + +# ifndef _ISOMAC + #include <stackinfo.h> #undef __alloca @@ -73,4 +76,5 @@ libc_hidden_proto (__libc_alloca_cutoff) extend_alloca (buf, len, s__); }) #endif +# endif /* !_ISOMAC */ #endif diff --git a/include/argz.h b/include/argz.h index 4eab0b680b..0388c23277 100644 --- a/include/argz.h +++ b/include/argz.h @@ -2,8 +2,11 @@ #include <string/argz.h> +# ifndef _ISOMAC + libc_hidden_proto (argz_delete) libc_hidden_proto (__argz_count) libc_hidden_proto (__argz_stringify) +# endif /* !_ISOMAC */ #endif diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h index ce6f0238ed..cd7ab6e925 100644 --- a/include/arpa/nameser.h +++ b/include/arpa/nameser.h @@ -2,6 +2,8 @@ #include <resolv/arpa/nameser.h> +# ifndef _ISOMAC + /* If the machine allows unaligned access we can do better than using the NS_GET16, NS_GET32, NS_PUT16, and NS_PUT32 macros from the installed header. */ @@ -74,4 +76,5 @@ libresolv_hidden_proto (ns_samename) libresolv_hidden_proto (ns_makecanon) libresolv_hidden_proto (ns_format_ttl) +# endif /* !_ISOMAC */ #endif diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h index 2e735ede4c..69280009b5 100644 --- a/include/arpa/nameser_compat.h +++ b/include/arpa/nameser_compat.h @@ -1,8 +1,11 @@ #ifndef _ARPA_NAMESER_COMPAT_ #include <resolv/arpa/nameser_compat.h> +# ifndef _ISOMAC + /* Picksome unused number to represent lookups of IPv4 and IPv6 (i.e., T_A and T_AAAA). */ #define T_UNSPEC 62321 +# endif /* !_ISOMAC */ #endif diff --git a/include/elf.h b/include/elf.h index 60658c617c..f06a33f256 100644 --- a/include/elf.h +++ b/include/elf.h @@ -1,5 +1,8 @@ #ifndef _ELF_H -# include <elf/elf.h> +#include <elf/elf.h> + +# ifndef _ISOMAC + /* Some information which is not meant for the public and therefore not in <elf.h>. */ # include <dl-dtprocnum.h> @@ -9,4 +12,6 @@ # define DT_1_SUPPORTED_MASK \ (DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \ | DF_1_ORIGIN | DF_1_NODEFLIB) -#endif + +# endif /* !_ISOMAC */ +#endif /* elf.h */ diff --git a/include/envz.h b/include/envz.h index 8cfd9b57e9..633fcc6f40 100644 --- a/include/envz.h +++ b/include/envz.h @@ -2,7 +2,10 @@ #include <string/envz.h> +# ifndef _ISOMAC + libc_hidden_proto (envz_entry) libc_hidden_proto (envz_remove) +# endif /* !_ISOMAC */ #endif diff --git a/include/err.h b/include/err.h index 737dfc1b6f..382855938e 100644 --- a/include/err.h +++ b/include/err.h @@ -1,8 +1,14 @@ +#ifndef _ERR_H #include <misc/err.h> +# ifndef _ISOMAC + libc_hidden_proto (warn) libc_hidden_proto (warnx) libc_hidden_proto (vwarn) libc_hidden_proto (vwarnx) libc_hidden_proto (verr) libc_hidden_proto (verrx) + +# endif /* !_ISOMAC */ +#endif /* err.h */ diff --git a/include/execinfo.h b/include/execinfo.h index c929821e8c..0b132b089f 100644 --- a/include/execinfo.h +++ b/include/execinfo.h @@ -1,6 +1,8 @@ #ifndef _EXECINFO_H #include <debug/execinfo.h> +# ifndef _ISOMAC + extern int __backtrace (void **__array, int __size); libc_hidden_proto (__backtrace) @@ -10,4 +12,5 @@ extern void __backtrace_symbols_fd (void *const *__array, int __size, int __fd); libc_hidden_proto (__backtrace_symbols_fd) +# endif /* !_ISOMAC */ #endif diff --git a/include/fpu_control.h b/include/fpu_control.h index d0b5e9c0d1..4498a83b87 100644 --- a/include/fpu_control.h +++ b/include/fpu_control.h @@ -1,4 +1,10 @@ +#ifndef _FPU_CONTROL_H #include_next <fpu_control.h> +# ifndef _ISOMAC + /* Called at startup. It can be used to manipulate fpu control register. */ extern void __setfpucw (fpu_control_t); + +# endif /* !_ISOMAC */ +#endif /* fpu_control.h */ diff --git a/include/getopt.h b/include/getopt.h index 6f2693d21b..c094972c97 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -3,11 +3,10 @@ #include <features.h> /* Get __GNU_LIBRARY__ defined now. */ #include <posix/getopt.h> -# ifdef _GETOPT_H +# if defined _GETOPT_H && !defined _ISOMAC /* Now define the internal interfaces. */ extern void __getopt_clean_environment (char **__env); -# endif - +# endif /* _GETOPT_H && !_ISOMAC */ #endif diff --git a/include/gshadow.h b/include/gshadow.h index 8a981f688a..532801afd0 100644 --- a/include/gshadow.h +++ b/include/gshadow.h @@ -1,6 +1,8 @@ #ifndef _GSHADOW_H #include <gshadow/gshadow.h> +# ifndef _ISOMAC + extern int __fgetsgent_r (FILE *stream, struct sgrp *resbuf, char *buffer, size_t buflen, struct sgrp **result); extern int __sgetsgent_r (const char *string, struct sgrp *resbuf, @@ -12,4 +14,5 @@ extern int _nss_files_parse_sgent (char *line, struct sgrp *result, size_t datalen, int *errnop); libc_hidden_proto (_nss_files_parse_sgent) +# endif /* !_ISOMAC */ #endif diff --git a/include/ifaddrs.h b/include/ifaddrs.h index 2787f21115..54f4b7a3ce 100644 --- a/include/ifaddrs.h +++ b/include/ifaddrs.h @@ -1,5 +1,8 @@ #ifndef _IFADDRS_H #include <inet/ifaddrs.h> + +# ifndef _ISOMAC + #include <stdbool.h> #include <stdint.h> @@ -30,4 +33,5 @@ extern void __check_native (uint32_t a1_index, int *a1_native, extern uint32_t __bump_nl_timestamp (void) attribute_hidden; #endif +# endif /* !_ISOMAC */ #endif /* ifaddrs.h */ diff --git a/include/libintl.h b/include/libintl.h index 0551a04084..9a11367ec6 100644 --- a/include/libintl.h +++ b/include/libintl.h @@ -1,5 +1,8 @@ #ifndef _LIBINTL_H #include <intl/libintl.h> + +# ifndef _ISOMAC + #include <locale.h> /* Now define the internal i |
