diff --git a/ChangeLog b/ChangeLog index 47ea83666f..fa6d945ed1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +2016-09-23 Zack Weinberg + + * 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. + 2016-09-23 Zack Weinberg * sysdeps/generic/sys/ucontext.h diff --git a/Makefile b/Makefile index 4478c97126..1ae3281184 100644 --- a/Makefile +++ b/Makefile @@ -318,6 +318,29 @@ $(objpfx)begin-end-check.out: scripts/begin-end-check.pl $(evaluate-test) endif +ifneq "$(headers)" "" +# Special test of all the installed headers in this directory. +tests-special += $(objpfx)check-installed-headers-c.out +libof-check-installed-headers-c := nonlib +$(objpfx)check-installed-headers-c.out: \ + scripts/check-installed-headers.sh $(headers) + $(SHELL) $(..)scripts/check-installed-headers.sh c \ + "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \ + $(headers) > $@; \ + $(evaluate-test) + +ifneq "$(CXX)" "" +tests-special += $(objpfx)check-installed-headers-cxx.out +libof-check-installed-headers-cxx := nonlib +$(objpfx)check-installed-headers-cxx.out: \ + scripts/check-installed-headers.sh $(headers) + $(SHELL) $(..)scripts/check-installed-headers.sh c++ \ + "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \ + $(headers) > $@; \ + $(evaluate-test) +endif +endif + define summarize-tests @egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true @echo "Summary of test results$2:" diff --git a/Rules b/Rules index 8306d36a07..342d659408 100644 --- a/Rules +++ b/Rules @@ -80,6 +80,29 @@ $(common-objpfx)dummy.c: (echo 'extern void __dummy__ (void);'; \ echo 'void __dummy__ (void) { }') > $@ common-generated += dummy.o dummy.c + +ifneq "$(headers)" "" +# Special test of all the installed headers in this directory. +tests-special += $(objpfx)check-installed-headers-c.out +libof-check-installed-headers-c := nonlib +$(objpfx)check-installed-headers-c.out: \ + $(..)scripts/check-installed-headers.sh $(headers) + $(SHELL) $(..)scripts/check-installed-headers.sh c \ + "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \ + $(headers) > $@; \ + $(evaluate-test) + +ifneq "$(CXX)" "" +tests-special += $(objpfx)check-installed-headers-cxx.out +libof-check-installed-headers-cxx := nonlib +$(objpfx)check-installed-headers-cxx.out: \ + $(..)scripts/check-installed-headers.sh $(headers) + $(SHELL) $(..)scripts/check-installed-headers.sh c++ \ + "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \ + $(headers) > $@; \ + $(evaluate-test) +endif +endif # This makes all the auxiliary and test programs. 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 +# 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 + +# ifndef _ISOMAC + #include #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 +# 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 +# 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 +# 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 +#include + +# ifndef _ISOMAC + /* Some information which is not meant for the public and therefore not in . */ # include @@ -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 +# 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 +# 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 +# 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 +# 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 /* Get __GNU_LIBRARY__ defined now. */ #include -# 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 +# 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 + +# ifndef _ISOMAC + #include #include @@ -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 + +# ifndef _ISOMAC + #include /* Now define the internal interfaces. */ @@ -46,4 +49,5 @@ libc_hidden_proto (_libc_intl_domainname) # define _(msgid) \ __dcgettext (_libc_intl_domainname, msgid, LC_MESSAGES) +# endif /* !_ISOMAC */ #endif diff --git a/include/link.h b/include/link.h index 32a7392f38..055844285c 100644 --- a/include/link.h +++ b/include/link.h @@ -24,12 +24,18 @@ # error this should be impossible #endif +# ifndef _ISOMAC /* Get most of the contents from the public header, but we define a different `struct link_map' type for private use. The la_objopen prototype uses the type, so we have to declare it separately. */ -#define link_map link_map_public -#define la_objopen la_objopen_wrongproto +# define link_map link_map_public +# define la_objopen la_objopen_wrongproto +# endif + #include + +# ifndef _ISOMAC + #undef link_map #undef la_objopen @@ -341,4 +347,5 @@ extern int __dl_iterate_phdr (int (*callback) (struct dl_phdr_info *info, `ELF64_R_TYPE'. */ #define ELFW(type) _ElfW (ELF, __ELF_NATIVE_CLASS, type) +# endif /* !_ISOMAC */ #endif /* include/link.h */ diff --git a/include/malloc.h b/include/malloc.h index 42fc8ed696..70d32c7c84 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -1,6 +1,7 @@ #ifndef _MALLOC_H #include +# ifndef _ISOMAC /* In the GNU libc we rename the global variable `__malloc_initialized' to `__libc_malloc_initialized'. */ @@ -11,4 +12,5 @@ extern int __malloc_initialized attribute_hidden; struct malloc_state; typedef struct malloc_state *mstate; +# endif /* !_ISOMAC */ #endif diff --git a/include/mcheck.h b/include/mcheck.h index b0037a7107..8883c3d53e 100644 --- a/include/mcheck.h +++ b/include/mcheck.h @@ -2,7 +2,10 @@ #include +# ifndef _ISOMAC + libc_hidden_proto (mcheck) libc_hidden_proto (mcheck_check_all) +# endif /* !_ISOMAC */ #endif diff --git a/include/mntent.h b/include/mntent.h index b34674aa3e..169210fc66 100644 --- a/include/mntent.h +++ b/include/mntent.h @@ -1,6 +1,8 @@ #ifndef _MNTENT_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern FILE *__setmntent (const char *__file, const char *__mode); extern struct mntent *__getmntent_r (FILE *__stream, @@ -14,4 +16,5 @@ libc_hidden_proto (__setmntent) libc_hidden_proto (__getmntent_r) libc_hidden_proto (__endmntent) +# endif /* !_ISOMAC */ #endif diff --git a/include/netinet/ether.h b/include/netinet/ether.h index 2efe4c04e4..8bfe7e03ad 100644 --- a/include/netinet/ether.h +++ b/include/netinet/ether.h @@ -1,6 +1,8 @@ #ifndef _NETINET_ETHER_H #include +# ifndef _ISOMAC + libc_hidden_proto (ether_aton_r) libc_hidden_proto (ether_ntoa_r) @@ -39,4 +41,5 @@ DECLARE_NSS_PROTOTYPES (nisplus) #undef DECLARE_NSS_PROTOTYPES +# endif /* !_ISOMAC */ #endif diff --git a/include/nss.h b/include/nss.h index 1e8cc3910d..6358a10fd3 100644 --- a/include/nss.h +++ b/include/nss.h @@ -1,6 +1,8 @@ #ifndef _NSS_H #include +# ifndef _ISOMAC + #define NSS_INVALID_FIELD_CHARACTERS ":\n" extern const char __nss_invalid_field_characters[] attribute_hidden; @@ -11,4 +13,5 @@ _Bool __nss_valid_list_field (char **list) const char *__nss_rewrite_field (const char *value, char **to_be_freed) attribute_hidden internal_function; +# endif /* !_ISOMAC */ #endif /* _NSS_H */ diff --git a/include/obstack.h b/include/obstack.h index 349d59bb03..fe2e595381 100644 --- a/include/obstack.h +++ b/include/obstack.h @@ -1,3 +1,9 @@ +#ifndef _OBSTACK_H #include +# ifndef _ISOMAC + libc_hidden_proto (_obstack_newchunk) + +# endif /* !_ISOMAC */ +#endif /* obstack.h */ diff --git a/include/printf.h b/include/printf.h index b12b5dc971..984f263167 100644 --- a/include/printf.h +++ b/include/printf.h @@ -1,6 +1,9 @@ #ifndef _PRINTF_H #include + +# ifndef _ISOMAC + #include /* Now define the internal interfaces. */ @@ -13,4 +16,5 @@ extern int __printf_fp_l (FILE *, locale_t, const struct printf_info *, const void *const *); libc_hidden_proto (__printf_fp_l) +# endif /* !_ISOMAC */ #endif diff --git a/include/pty.h b/include/pty.h index a91be80852..4979bb765f 100644 --- a/include/pty.h +++ b/include/pty.h @@ -1,6 +1,9 @@ #ifndef _PTY_H #include +# ifndef _ISOMAC + libutil_hidden_proto (openpty) +# endif /* !_ISOMAC */ #endif diff --git a/include/resolv.h b/include/resolv.h index 52ac218666..699cc81569 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -1,17 +1,19 @@ #ifndef _RESOLV_H_ -#define RES_SET_H_ERRNO(r,x) \ +# ifndef _ISOMAC +# include +# define RES_SET_H_ERRNO(r,x) \ do \ { \ (r)->res_h_errno = x; \ __set_h_errno(x); \ } \ while (0) +# endif -#include #include -#ifdef _RESOLV_H_ +# if defined _RESOLV_H_ && !defined _ISOMAC # if IS_IN (libc) # define __resp __libc_resp @@ -97,6 +99,5 @@ libresolv_hidden_proto (__p_secstodate) extern const char *_res_opcodes[]; libresolv_hidden_proto (_res_opcodes) -#endif - +# endif /* _RESOLV_H_ && !_ISOMAC */ #endif diff --git a/include/rpc/auth.h b/include/rpc/auth.h index 0219fd9316..2e55cce11d 100644 --- a/include/rpc/auth.h +++ b/include/rpc/auth.h @@ -1,6 +1,8 @@ #ifndef _RPC_AUTH_H #include +# ifndef _ISOMAC + libc_hidden_proto (getnetname) libc_hidden_proto (netname2user) libc_hidden_proto (host2netname) @@ -41,4 +43,5 @@ libc_hidden_proto (key_setnet) libc_hidden_proto (key_setsecret) libc_hidden_proto (netname2host) +# endif /* !_ISOMAC */ #endif diff --git a/include/rpc/auth_des.h b/include/rpc/auth_des.h index 0e9db1a226..6afed56b71 100644 --- a/include/rpc/auth_des.h +++ b/include/rpc/auth_des.h @@ -2,6 +2,8 @@ #include +# ifndef _ISOMAC + libc_hidden_proto (getpublickey) libc_hidden_proto (getsecretkey) libc_hidden_proto (rtime) @@ -32,4 +34,5 @@ libc_hidden_proto (authdes_getucred) libc_hidden_proto (xdr_authdes_cred) libc_hidden_proto (xdr_authdes_verf) +# endif /* !_ISOMAC */ #endif diff --git a/include/rpc/auth_unix.h b/include/rpc/auth_unix.h index 07031c9bd9..019efa275a 100644 --- a/include/rpc/auth_unix.h +++ b/include/rpc/auth_unix.h @@ -1,3 +1,9 @@ +#ifndef _RPC_AUTH_UNIX_H #include +# ifndef _ISOMAC + libc_hidden_proto (xdr_authunix_parms) + +# endif /* !_ISOMAC */ +#endif /* rpc/auth_unix.h */ diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h index d79a6a7b5b..a397023a93 100644 --- a/include/rpc/clnt.h +++ b/include/rpc/clnt.h @@ -1,6 +1,8 @@ #ifndef _RPC_CLNT_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern int _openchild (const char *command, FILE **fto, FILE **ffrom); @@ -27,4 +29,5 @@ libc_hidden_proto (get_myaddress) libc_hidden_proto (clntunix_create) libc_hidden_proto (__libc_clntudp_bufcreate) +# endif /* !_ISOMAC */ #endif diff --git a/include/rpc/des_crypt.h b/include/rpc/des_crypt.h index 44f7e669b0..7a34957df8 100644 --- a/include/rpc/des_crypt.h +++ b/include/rpc/des_crypt.h @@ -1,6 +1,8 @@ #ifndef __DES_CRYPT_H__ #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern int xencrypt (char *secret, char *passwd); @@ -12,4 +14,5 @@ libc_hidden_proto (cbc_crypt) libc_hidden_proto (xencrypt) libc_hidden_proto (xdecrypt) +# endif /* !_ISOMAC */ #endif diff --git a/include/rpc/key_prot.h b/include/rpc/key_prot.h index 29d14cc8a0..4711a94edf 100644 --- a/include/rpc/key_prot.h +++ b/include/rpc/key_prot.h @@ -1,5 +1,8 @@ +#ifndef _KEY_PROT_H_RPCGEN #include +# ifndef _ISOMAC + libc_hidden_proto (xdr_cryptkeyarg) libc_hidden_proto (xdr_cryptkeyarg2) libc_hidden_proto (xdr_cryptkeyres) @@ -10,3 +13,6 @@ libc_hidden_proto (xdr_keystatus) libc_hidden_proto (xdr_getcredres) libc_hidden_proto (xdr_netnamestr) libc_hidden_proto (xdr_unixcred) + +# endif /* !_ISOMAC */ +#endif /* rpc/key_prot.h */ diff --git a/include/rpc/netdb.h b/include/rpc/netdb.h index 65af237e50..9b84668be7 100644 --- a/include/rpc/netdb.h +++ b/include/rpc/netdb.h @@ -1,6 +1,8 @@ #ifndef _RPC_NETDB_H #include +# ifndef _ISOMAC + extern int __getrpcbyname_r (const char *__name, struct rpcent *__result_buf, char *__buffer, size_t __buflen, struct rpcent **__result); @@ -48,4 +50,5 @@ DECLARE_NSS_PROTOTYPES (nisplus) #undef DECLARE_NSS_PROTOTYPES +# endif /* !_ISOMAC */ #endif diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h index 67628e0589..ec907c28cc 100644 --- a/include/rpc/pmap_clnt.h +++ b/include/rpc/pmap_clnt.h @@ -1,5 +1,7 @@ #ifndef _RPC_PMAP_CLNT_H -# include +#include + +# ifndef _ISOMAC libc_hidden_proto (pmap_getport) libc_hidden_proto (pmap_set) @@ -18,4 +20,5 @@ libc_hidden_proto (clnt_broadcast) libc_hidden_proto (pmap_getmaps) libc_hidden_proto (pmap_rmtcall) -#endif +# endif /* !_ISOMAC */ +#endif /* rpc/pmap_clnt.h */ diff --git a/include/rpc/pmap_prot.h b/include/rpc/pmap_prot.h index 2e9076ee3d..a2573d106f 100644 --- a/include/rpc/pmap_prot.h +++ b/include/rpc/pmap_prot.h @@ -1,4 +1,10 @@ +#ifndef _RPC_PMAP_PROT_H #include +# ifndef _ISOMAC + libc_hidden_proto (xdr_pmap) libc_hidden_proto (xdr_pmaplist) + +# endif /* !_ISOMAC */ +#endif /* rpc/pmap_prot.h */ diff --git a/include/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h index e8822dabe9..ae53a02652 100644 --- a/include/rpc/pmap_rmt.h +++ b/include/rpc/pmap_rmt.h @@ -1,4 +1,10 @@ +#ifndef _RPC_PMAP_RMT_H #include +# ifndef _ISOMAC + libc_hidden_proto (xdr_rmtcall_args) libc_hidden_proto (xdr_rmtcallres) + +# endif /* !_ISOMAC */ +#endif /* rpc/pmap_rmt.h */ diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h index 58bdef3cc9..4c9ee82617 100644 --- a/include/rpc/rpc.h +++ b/include/rpc/rpc.h @@ -1,5 +1,8 @@ #ifndef _RPC_RPC_H #include + +# ifndef _ISOMAC + #include /* Now define the internal interfaces. */ @@ -56,4 +59,5 @@ libc_hidden_proto (__rpc_thread_createerr) #endif /* _RPC_THREAD_SAFE_ */ +# endif /* !_ISOMAC */ #endif diff --git a/include/rpc/rpc_msg.h b/include/rpc/rpc_msg.h index be1f4838c9..93c5ab8764 100644 --- a/include/rpc/rpc_msg.h +++ b/include/rpc/rpc_msg.h @@ -1,6 +1,8 @@ #ifndef _RPC_MSG_H #include +# ifndef _ISOMAC + libc_hidden_proto (_seterr_reply) /* Now define the internal interfaces. */ @@ -14,4 +16,5 @@ libc_hidden_proto (xdr_callmsg) libc_hidden_proto (xdr_rejected_reply) libc_hidden_proto (xdr_replymsg) +# endif /* !_ISOMAC */ #endif diff --git a/include/rpc/svc.h b/include/rpc/svc.h index 61a8ab3503..465bf4427d 100644 --- a/include/rpc/svc.h +++ b/include/rpc/svc.h @@ -1,6 +1,8 @@ #ifndef _RPC_SVC_H #include +# ifndef _ISOMAC + libc_hidden_proto (xprt_register) libc_hidden_proto (xprt_unregister) libc_hidden_proto (svc_register) @@ -37,4 +39,5 @@ libc_hidden_proto (svc_getreq_poll) extern void __svc_accept_failed (void) attribute_hidden; +# endif /* !_ISOMAC */ #endif diff --git a/include/rpc/svc_auth.h b/include/rpc/svc_auth.h index 582bb31aea..2609d19544 100644 --- a/include/rpc/svc_auth.h +++ b/include/rpc/svc_auth.h @@ -1,6 +1,8 @@ #ifndef _RPC_SVC_AUTH_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern enum auth_stat _svcauth_unix (struct svc_req *rqst, struct rpc_msg *msg); @@ -9,4 +11,5 @@ extern enum auth_stat _svcauth_short (struct svc_req *rqst, libc_hidden_proto (_authenticate) +# endif /* !_ISOMAC */ #endif diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index 57971d0758..e1bff1cd1c 100644 --- a/include/rpc/xdr.h +++ b/include/rpc/xdr.h @@ -1,5 +1,8 @@ +#ifndef _RPC_XDR_H #include +# ifndef _ISOMAC + libc_hidden_proto (xdrstdio_create) libc_hidden_proto (xdr_array) libc_hidden_proto (xdr_bool) @@ -45,3 +48,6 @@ libc_hidden_proto (xdr_int64_t) libc_hidden_proto (xdr_uint64_t) libc_hidden_proto (xdr_quad_t) libc_hidden_proto (xdr_u_quad_t) + +# endif /* !_ISOMAC */ +#endif /* rpc/xdr.h */ diff --git a/include/rpcsvc/nis_callback.h b/include/rpcsvc/nis_callback.h index dfa9cd3ef7..0515d07887 100644 --- a/include/rpcsvc/nis_callback.h +++ b/include/rpcsvc/nis_callback.h @@ -1,7 +1,10 @@ #ifndef _RPCSVC_NIS_CALLBACK_H #include +# ifndef _ISOMAC + libnsl_hidden_proto (xdr_obj_p) libnsl_hidden_proto (xdr_cback_data) +# endif /* !_ISOMAC */ #endif diff --git a/include/rpcsvc/nislib.h b/include/rpcsvc/nislib.h index 635c513e4d..05b19877e7 100644 --- a/include/rpcsvc/nislib.h +++ b/include/rpcsvc/nislib.h @@ -1,6 +1,8 @@ #ifndef __RPCSVC_NISLIB_H__ #include +# ifndef _ISOMAC + libnsl_hidden_proto (nis_leaf_of_r) libnsl_hidden_proto (nis_name_of_r) libnsl_hidden_proto (nis_getnames) @@ -44,4 +46,5 @@ libnsl_hidden_proto (nis_clone_object) extern const_nis_name __nis_domain_of (const_nis_name) __THROW; +# endif /* !_ISOMAC */ #endif diff --git a/include/rpcsvc/yp.h b/include/rpcsvc/yp.h index 04a973eae7..b6d7c15f62 100644 --- a/include/rpcsvc/yp.h +++ b/include/rpcsvc/yp.h @@ -1,6 +1,8 @@ #ifndef __RPCSVC_YP_H__ #include +# ifndef _ISOMAC + libnsl_hidden_proto (xdr_ypstat) libnsl_hidden_proto (xdr_ypxfrstat) libnsl_hidden_proto (xdr_domainname) @@ -23,4 +25,5 @@ libnsl_hidden_proto (xdr_ypresp_order) libnsl_hidden_proto (xdr_ypbind_resp) libnsl_hidden_proto (xdr_ypresp_master) +# endif /* !_ISOMAC */ #endif diff --git a/include/rpcsvc/ypclnt.h b/include/rpcsvc/ypclnt.h index b38dc6bb4c..1b4e2f215c 100644 --- a/include/rpcsvc/ypclnt.h +++ b/include/rpcsvc/ypclnt.h @@ -1,10 +1,13 @@ #ifndef __RPCSVC_YPCLNT_H__ #include +# ifndef _ISOMAC + libnsl_hidden_proto (ypbinderr_string) libnsl_hidden_proto (yp_bind) libnsl_hidden_proto (yp_get_default_domain) libnsl_hidden_proto (ypprot_err) libnsl_hidden_proto (yp_master) +# endif /* !_ISOMAC */ #endif diff --git a/include/rpcsvc/ypupd.h b/include/rpcsvc/ypupd.h index 7601971512..6d179dd306 100644 --- a/include/rpcsvc/ypupd.h +++ b/include/rpcsvc/ypupd.h @@ -1,8 +1,11 @@ #ifndef __RPCSVC_YPUPD_H__ #include +# ifndef _ISOMAC + libnsl_hidden_proto (xdr_yp_buf) libnsl_hidden_proto (xdr_ypdelete_args) libnsl_hidden_proto (xdr_ypupdate_args) +# endif /* !_ISOMAC */ #endif diff --git a/include/shadow.h b/include/shadow.h index a3f897cba1..124a1ab50a 100644 --- a/include/shadow.h +++ b/include/shadow.h @@ -1,6 +1,8 @@ #ifndef _SHADOW_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern int __getspent_r (struct spwd *__result_buf, char *__buffer, size_t __buflen, struct spwd **__result) @@ -47,4 +49,5 @@ DECLARE_NSS_PROTOTYPES (nisplus) #undef DECLARE_NSS_PROTOTYPES +# endif /* !_ISOMAC */ #endif diff --git a/include/stdio_ext.h b/include/stdio_ext.h index 354146f8e8..29c6e68cdb 100644 --- a/include/stdio_ext.h +++ b/include/stdio_ext.h @@ -1,6 +1,7 @@ #ifndef _STDIO_EXT_H +#include -# include +# ifndef _ISOMAC libc_hidden_proto (__fsetlocking) @@ -18,5 +19,5 @@ libc_hidden_proto (__fsetlocking) __result; \ }) - -#endif +# endif /* !_ISOMAC */ +#endif /* stdio_ext.h */ diff --git a/include/sys/epoll.h b/include/sys/epoll.h index ce1c2e26d5..86e0a54e62 100644 --- a/include/sys/epoll.h +++ b/include/sys/epoll.h @@ -1,6 +1,9 @@ #ifndef _SYS_EPOLL_H #include_next +# ifndef _ISOMAC + libc_hidden_proto (epoll_pwait) +# endif /* !_ISOMAC */ #endif diff --git a/include/sys/file.h b/include/sys/file.h index e73a4d1c94..d0cd1f9e15 100644 --- a/include/sys/file.h +++ b/include/sys/file.h @@ -1,6 +1,10 @@ #ifndef _SYS_FILE_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern int __flock (int __fd, int __operation); + +# endif /* !_ISOMAC */ #endif diff --git a/include/sys/gmon.h b/include/sys/gmon.h index 55739cf00c..30889d8bc3 100644 --- a/include/sys/gmon.h +++ b/include/sys/gmon.h @@ -1,6 +1,8 @@ #ifndef _SYS_GMON_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ /* Write current profiling data to file. */ @@ -12,4 +14,6 @@ extern void __bb_init_func (struct __bb *bb); extern void __bb_exit_func (void); extern struct gmonparam _gmonparam attribute_hidden; + +# endif /* !_ISOMAC */ #endif diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h index ebadd526b9..bfc6909dbc 100644 --- a/include/sys/ioctl.h +++ b/include/sys/ioctl.h @@ -1,6 +1,10 @@ #ifndef _SYS_IOCTL_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern int __ioctl (int __fd, unsigned long int __request, ...); + +# endif /* !_ISOMAC */ #endif diff --git a/include/sys/prctl.h b/include/sys/prctl.h index 316f454c1c..0920ed642b 100644 --- a/include/sys/prctl.h +++ b/include/sys/prctl.h @@ -1,6 +1,9 @@ #ifndef _SYS_PRCTL_H #include_next +# ifndef _ISOMAC + extern int __prctl (int __option, ...); +# endif /* !_ISOMAC */ #endif diff --git a/include/sys/profil.h b/include/sys/profil.h index 7bf17003ad..2b1133073e 100644 --- a/include/sys/profil.h +++ b/include/sys/profil.h @@ -1,9 +1,12 @@ #ifndef _PROFIL_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern int __sprofil (struct prof *__profp, int __profcnt, struct timeval *__tvp, unsigned int __flags); +# endif /* !_ISOMAC */ #endif /* _PROFIL_H */ diff --git a/include/sys/statfs.h b/include/sys/statfs.h index e34ad02965..3fac4a3490 100644 --- a/include/sys/statfs.h +++ b/include/sys/statfs.h @@ -1,10 +1,14 @@ #ifndef _SYS_STATFS_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern int __statfs (const char *__file, struct statfs *__buf); libc_hidden_proto (__statfs) extern int __fstatfs (int __fildes, struct statfs *__buf); extern int __statfs64 (const char *__file, struct statfs64 *__buf); extern int __fstatfs64 (int __fildes, struct statfs64 *__buf); + +# endif /* !_ISOMAC */ #endif diff --git a/include/sys/sysctl.h b/include/sys/sysctl.h index 4fffb4ff49..2a15e91354 100644 --- a/include/sys/sysctl.h +++ b/include/sys/sysctl.h @@ -1,10 +1,13 @@ #ifndef _SYS_SYSCTL_H #include_next +# ifndef _ISOMAC + /* Read or write system parameters (Linux, FreeBSD specific). */ extern int __sysctl (int *__name, int __nlen, void *__oldval, size_t *__oldlenp, void *__newval, size_t __newlen); libc_hidden_proto (__sysctl) +# endif /* !_ISOMAC */ #endif /* _SYS_SYSCTL_H */ diff --git a/include/sys/sysinfo.h b/include/sys/sysinfo.h index d33055a2b3..c33eae2883 100644 --- a/include/sys/sysinfo.h +++ b/include/sys/sysinfo.h @@ -1,6 +1,8 @@ #ifndef _SYS_SYSINFO_H #include_next +# ifndef _ISOMAC + /* Now we define the internal interface. */ /* Return number of configured processors. */ @@ -18,4 +20,5 @@ extern long int __get_avphys_pages (void); /* Return maximum number of processes this real user ID can have. */ extern long int __get_child_max (void); +# endif /* !_ISOMAC */ #endif /* sys/sysinfo.h */ diff --git a/include/ttyent.h b/include/ttyent.h index 81e52116e5..53a66681d2 100644 --- a/include/ttyent.h +++ b/include/ttyent.h @@ -1,5 +1,7 @@ #ifndef _TTYENT_H -# include +#include + +# ifndef _ISOMAC extern __typeof (getttyent) __getttyent __THROW; libc_hidden_proto (__getttyent) @@ -8,4 +10,5 @@ libc_hidden_proto (__setttyent) extern __typeof (endttyent) __endttyent __THROW; libc_hidden_proto (__endttyent) -#endif +# endif /* !_ISOMAC */ +#endif /* ttyent.h */ diff --git a/include/utmp.h b/include/utmp.h index 28207d1282..6b2e262362 100644 --- a/include/utmp.h +++ b/include/utmp.h @@ -1,6 +1,8 @@ #ifndef _UTMP_H #include +# ifndef _ISOMAC + /* Now define the internal interfaces. */ extern void __updwtmp (const char *__wtmp_file, const struct utmp *__utmp); extern int __utmpname (const char *__file); @@ -18,4 +20,5 @@ extern int __getutline_r (const struct utmp *__line, libutil_hidden_proto (login_tty) +# endif /* !_ISOMAC */ #endif diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh new file mode 100644 index 0000000000..7fbc725c0f --- /dev/null +++ b/scripts/check-installed-headers.sh @@ -0,0 +1,146 @@ +#! /bin/sh +# Copyright (C) 2016 Free Software Foundation, Inc. +# This file is part of the GNU C Library. +# +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# The GNU C Library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +# Check installed headers for cleanliness. For each header, confirm +# that it's possible to compile a file that includes that header and +# does nothing else, in several different compilation modes. Also, +# scan the header for a set of obsolete typedefs that should no longer +# appear. + +# These compilation switches assume GCC or compatible, which is probably +# fine since we also assume that when _building_ glibc. +c_modes="-std=c89 -std=gnu89 -std=c11 -std=gnu11" +cxx_modes="-std=c++98 -std=gnu++98 -std=c++11 -std=gnu++11" + +# An exhaustive test of feature selection macros would take far too long. +# These are probably the most commonly used three. +lib_modes="-D_DEFAULT_SOURCE=1 -D_GNU_SOURCE=1 -D_XOPEN_SOURCE=700" + +# sys/types.h+bits/types.h have to define the obsolete types. +# rpc(svc)/* have the obsolete types too deeply embedded in their API +# to remove. +skip_obsolete_type_check='*/sys/types.h|*/bits/types.h|*/rpc/*|*/rpcsvc/*' +obsolete_type_re=\ +'\<((__)?(quad_t|u(short|int|long|_(char|short|int([0-9]+_t)?|long|quad_t))))\>' + +if [ $# -lt 3 ]; then + echo "usage: $0 c|c++ \"compile command\" header header header..." >&2 + exit 2 +fi +case "$1" in + (c) + lang_modes="$c_modes" + cih_test_c=$(mktemp ${TMPDIR-/tmp}/cih_test_XXXXXX.c) + already="$skip_obsolete_type_check" + ;; + (c++) + lang_modes="$cxx_modes" + cih_test_c=$(mktemp ${TMPDIR-/tmp}/cih_test_XXXXXX.cc) + # The obsolete-type check can be skipped for C++; it is + # sufficient to do it for C. + already="*" + ;; + (*) + echo "usage: $0 c|c++ \"compile command\" header header header..." >&2 + exit 2;; +esac +shift +cc_cmd="$1" +shift +trap "rm -f '$cih_test_c'" 0 + +failed=0 +is_x86_64=unknown +for header in "$@"; do + # Skip various headers for which this test gets a false failure. + case "$header" in + # bits/* are not meant to be included directly and usually #error + # out if you try it. + # regexp.h is a stub containing only an #error. + # Sun RPC's .x files are traditionally installed in + # $prefix/include/rpcsvc, but they are not C header files. + (bits/* | regexp.h | rpcsvc/*.x) + continue;; + + # sys/elf.h and sys/vm86.h are "unsupported on x86-64" and + # #error out on that target. + (sys/elf.h | sys/vm86.h) + case "$is_x86_64" in + (yes) continue;; + (no) ;; + (unknown) + cat >"$cih_test_c" < /dev/null 2>&1 + then + is_x86_64=no + else + is_x86_64=yes + continue + fi + ;; + esac + esac + + echo :: "$header" + for lang_mode in "" $lang_modes; do + for lib_mode in "" $lib_modes; do + echo :::: $lang_mode $lib_mode + if [ -z "$lib_mode" ]; then + expanded_lib_mode='/* default library mode */' + else + expanded_lib_mode=$(echo : $lib_mode | \ + sed 's/^: -D/#define /; s/=/ /') + fi + cat >"$cih_test_c" < +int avoid_empty_translation_unit; +EOF + if $cc_cmd -fsyntax-only $lang_mode "$cih_test_c" 2>&1 + then + includes=$($cc_cmd -fsyntax-only -H $lang_mode \ + "$cih_test_c" 2>&1 | sed -ne 's/^[.][.]* //p') + for h in $includes; do + # Don't repeat work. + eval 'case "$h" in ('"$already"') continue;; esac' + + if grep -qE "$obsolete_type_re" "$h"; then + echo "*** Obsolete types detected:" + grep -HE "$obsolete_type_re" "$h" + failed=1 + fi + already="$already|$h" + done + else + failed=1 + fi + done + done +done +exit $failed diff --git a/sysdeps/arm/nacl/include/bits/setjmp.h b/sysdeps/arm/nacl/include/bits/setjmp.h index 6b6a235871..e1fe5059a3 100644 --- a/sysdeps/arm/nacl/include/bits/setjmp.h +++ b/sysdeps/arm/nacl/include/bits/setjmp.h @@ -24,6 +24,8 @@ # include #endif +# ifndef _ISOMAC + /* Register list for a ldm/stm instruction to load/store the general registers from a __jmp_buf. @@ -35,4 +37,5 @@ /* Index of __jmp_buf where the sp register resides. */ #define __JMP_BUF_SP 0 +# endif /* _ISOMAC */ #endif /* include/bits/setjmp.h */ diff --git a/sysdeps/mips/include/sys/asm.h b/sysdeps/mips/include/sys/asm.h index 7e288df117..67acf74dc0 100644 --- a/sysdeps/mips/include/sys/asm.h +++ b/sysdeps/mips/include/sys/asm.h @@ -16,8 +16,9 @@ . */ #ifndef _SYS_ASM_H +#include_next -# include_next +# ifndef _ISOMAC # undef __mips_cfi_startproc # define __mips_cfi_startproc cfi_startproc @@ -50,4 +51,5 @@ cfi_restore (gp) # endif -#endif +# endif /* _ISOMAC */ +#endif /* sys/asm.h */ diff --git a/sysdeps/unix/sysv/linux/include/sys/sysinfo.h b/sysdeps/unix/sysv/linux/include/sys/sysinfo.h index 50077fb08c..b76f7e0d09 100644 --- a/sysdeps/unix/sysv/linux/include/sys/sysinfo.h +++ b/sysdeps/unix/sysv/linux/include/sys/sysinfo.h @@ -21,6 +21,9 @@ #include_next +# ifndef _ISOMAC + extern __typeof (sysinfo) __sysinfo __THROW; +# endif /* _ISOMAC */ #endif /* sys/sysinfo.h */ diff --git a/sysdeps/unix/sysv/linux/include/sys/timex.h b/sysdeps/unix/sysv/linux/include/sys/timex.h index ace90ee033..4b4ff88895 100644 --- a/sysdeps/unix/sysv/linux/include/sys/timex.h +++ b/sysdeps/unix/sysv/linux/include/sys/timex.h @@ -21,6 +21,9 @@ #include_next +# ifndef _ISOMAC + libc_hidden_proto (__adjtimex) +# endif /* _ISOMAC */ #endif /* sys/timex.h */ diff --git a/sysdeps/x86/fpu/include/bits/fenv.h b/sysdeps/x86/fpu/include/bits/fenv.h index 6e8b733f33..a410ed00d0 100644 --- a/sysdeps/x86/fpu/include/bits/fenv.h +++ b/sysdeps/x86/fpu/include/bits/fenv.h @@ -16,8 +16,11 @@ License along with the GNU C Library; if not, see . */ +#ifndef _BITS_FENV_H #include_next +# ifndef _ISOMAC + /* Ensure __feraiseexcept calls in glibc are optimized the same as feraiseexcept calls. */ @@ -40,3 +43,6 @@ __NTH (__feraiseexcept (int __excepts)) __END_DECLS #endif + +# endif /* _ISOMAC */ +#endif /* bits/fenv.h */