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.
This commit is contained in:
Zack Weinberg 2016-08-23 21:19:17 -04:00
parent c66b29f9cc
commit 4775578486
66 changed files with 470 additions and 21 deletions

View File

@ -1,3 +1,42 @@
2016-09-23 Zack Weinberg <zackw@panix.com>
* 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 <zackw@panix.com>
* sysdeps/generic/sys/ucontext.h

View File

@ -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:"

23
Rules
View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -2,7 +2,10 @@
#include <string/envz.h>
# ifndef _ISOMAC
libc_hidden_proto (envz_entry)
libc_hidden_proto (envz_remove)
# endif /* !_ISOMAC */
#endif

View File

@ -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 */

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -1,5 +1,8 @@
#ifndef _LIBINTL_H
#include <intl/libintl.h>
# ifndef _ISOMAC
#include <locale.h>
/* 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

View File

@ -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 <elf/link.h>
# 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 */

View File

@ -1,6 +1,7 @@
#ifndef _MALLOC_H
#include <malloc/malloc.h>
# 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

View File

@ -2,7 +2,10 @@
#include <malloc/mcheck.h>
# ifndef _ISOMAC
libc_hidden_proto (mcheck)
libc_hidden_proto (mcheck_check_all)
# endif /* !_ISOMAC */
#endif

View File

@ -1,6 +1,8 @@
#ifndef _MNTENT_H
#include <misc/mntent.h>
# 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

View File

@ -1,6 +1,8 @@
#ifndef _NETINET_ETHER_H
#include <inet/netinet/ether.h>
# 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

View File

@ -1,6 +1,8 @@
#ifndef _NSS_H
#include <nss/nss.h>
# 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 */

View File

@ -1,3 +1,9 @@
#ifndef _OBSTACK_H
#include <malloc/obstack.h>
# ifndef _ISOMAC
libc_hidden_proto (_obstack_newchunk)
# endif /* !_ISOMAC */
#endif /* obstack.h */

View File

@ -1,6 +1,9 @@
#ifndef _PRINTF_H
#include <stdio-common/printf.h>
# ifndef _ISOMAC
#include <xlocale.h>
/* 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

View File

@ -1,6 +1,9 @@
#ifndef _PTY_H
#include <login/pty.h>
# ifndef _ISOMAC
libutil_hidden_proto (openpty)
# endif /* !_ISOMAC */
#endif

View File

@ -1,17 +1,19 @@
#ifndef _RESOLV_H_
#define RES_SET_H_ERRNO(r,x) \
# ifndef _ISOMAC
# include <stdbool.h>
# define RES_SET_H_ERRNO(r,x) \
do \
{ \
(r)->res_h_errno = x; \
__set_h_errno(x); \
} \
while (0)
# endif
#include <stdbool.h>
#include <resolv/resolv.h>
#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

View File

@ -1,6 +1,8 @@
#ifndef _RPC_AUTH_H
#include <sunrpc/rpc/auth.h>
# 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

View File

@ -2,6 +2,8 @@
#include <sunrpc/rpc/auth_des.h>
# 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

View File

@ -1,3 +1,9 @@
#ifndef _RPC_AUTH_UNIX_H
#include <sunrpc/rpc/auth_unix.h>
# ifndef _ISOMAC
libc_hidden_proto (xdr_authunix_parms)
# endif /* !_ISOMAC */
#endif /* rpc/auth_unix.h */

View File

@ -1,6 +1,8 @@
#ifndef _RPC_CLNT_H
#include <sunrpc/rpc/clnt.h>
# 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

View File

@ -1,6 +1,8 @@
#ifndef __DES_CRYPT_H__
#include <sunrpc/rpc/des_crypt.h>
# 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

View File

@ -1,5 +1,8 @@
#ifndef _KEY_PROT_H_RPCGEN
#include <sunrpc/rpc/key_prot.h>
# 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 */

View File

@ -1,6 +1,8 @@
#ifndef _RPC_NETDB_H
#include <sunrpc/rpc/netdb.h>
# 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

View File

@ -1,5 +1,7 @@
#ifndef _RPC_PMAP_CLNT_H
# include <sunrpc/rpc/pmap_clnt.h>
#include <sunrpc/rpc/pmap_clnt.h>
# 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 */

View File

@ -1,4 +1,10 @@
#ifndef _RPC_PMAP_PROT_H
#include <sunrpc/rpc/pmap_prot.h>
# ifndef _ISOMAC
libc_hidden_proto (xdr_pmap)
libc_hidden_proto (xdr_pmaplist)
# endif /* !_ISOMAC */
#endif /* rpc/pmap_prot.h */

View File

@ -1,4 +1,10 @@
#ifndef _RPC_PMAP_RMT_H
#include <sunrpc/rpc/pmap_rmt.h>
# ifndef _ISOMAC
libc_hidden_proto (xdr_rmtcall_args)
libc_hidden_proto (xdr_rmtcallres)
# endif /* !_ISOMAC */
#endif /* rpc/pmap_rmt.h */

View File

@ -1,5 +1,8 @@
#ifndef _RPC_RPC_H
#include <sunrpc/rpc/rpc.h>
# ifndef _ISOMAC
#include <libc-tsd.h>
/* Now define the internal interfaces. */
@ -56,4 +59,5 @@ libc_hidden_proto (__rpc_thread_createerr)
#endif /* _RPC_THREAD_SAFE_ */
# endif /* !_ISOMAC */
#endif

View File

@ -1,6 +1,8 @@
#ifndef _RPC_MSG_H
#include <sunrpc/rpc/rpc_msg.h>
# 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

View File

@ -1,6 +1,8 @@
#ifndef _RPC_SVC_H
#include <sunrpc/rpc/svc.h>
# 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

View File

@ -1,6 +1,8 @@
#ifndef _RPC_SVC_AUTH_H
#include <sunrpc/rpc/svc_auth.h>
# 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

View File

@ -1,5 +1,8 @@
#ifndef _RPC_XDR_H
#include <sunrpc/rpc/xdr.h>
# 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 */

View File

@ -1,7 +1,10 @@
#ifndef _RPCSVC_NIS_CALLBACK_H
#include <nis/rpcsvc/nis_callback.h>
# ifndef _ISOMAC
libnsl_hidden_proto (xdr_obj_p)
libnsl_hidden_proto (xdr_cback_data)
# endif /* !_ISOMAC */
#endif

View File

@ -1,6 +1,8 @@
#ifndef __RPCSVC_NISLIB_H__
#include <nis/rpcsvc/nislib.h>
# 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

View File

@ -1,6 +1,8 @@
#ifndef __RPCSVC_YP_H__
#include <nis/rpcsvc/yp.h>
# 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

View File

@ -1,10 +1,13 @@
#ifndef __RPCSVC_YPCLNT_H__
#include <nis/rpcsvc/ypclnt.h>
# 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

View File

@ -1,8 +1,11 @@
#ifndef __RPCSVC_YPUPD_H__
#include <nis/rpcsvc/ypupd.h>
# ifndef _ISOMAC
libnsl_hidden_proto (xdr_yp_buf)
libnsl_hidden_proto (xdr_ypdelete_args)
libnsl_hidden_proto (xdr_ypupdate_args)
# endif /* !_ISOMAC */
#endif

View File

@ -1,6 +1,8 @@
#ifndef _SHADOW_H
#include <shadow/shadow.h>
# 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

View File

@ -1,6 +1,7 @@
#ifndef _STDIO_EXT_H
#include <stdio-common/stdio_ext.h>
# include <stdio-common/stdio_ext.h>
# ifndef _ISOMAC
libc_hidden_proto (__fsetlocking)
@ -18,5 +19,5 @@ libc_hidden_proto (__fsetlocking)
__result; \
})
#endif
# endif /* !_ISOMAC */
#endif /* stdio_ext.h */

View File

@ -1,6 +1,9 @@
#ifndef _SYS_EPOLL_H
#include_next <sys/epoll.h>
# ifndef _ISOMAC
libc_hidden_proto (epoll_pwait)
# endif /* !_ISOMAC */
#endif

View File

@ -1,6 +1,10 @@
#ifndef _SYS_FILE_H
#include <misc/sys/file.h>
# ifndef _ISOMAC
/* Now define the internal interfaces. */
extern int __flock (int __fd, int __operation);
# endif /* !_ISOMAC */
#endif

View File

@ -1,6 +1,8 @@
#ifndef _SYS_GMON_H
#include <gmon/sys/gmon.h>
# 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

View File

@ -1,6 +1,10 @@
#ifndef _SYS_IOCTL_H
#include <misc/sys/ioctl.h>
# ifndef _ISOMAC
/* Now define the internal interfaces. */
extern int __ioctl (int __fd, unsigned long int __request, ...);
# endif /* !_ISOMAC */
#endif

View File

@ -1,6 +1,9 @@
#ifndef _SYS_PRCTL_H
#include_next <sys/prctl.h>
# ifndef _ISOMAC
extern int __prctl (int __option, ...);
# endif /* !_ISOMAC */
#endif

View File

@ -1,9 +1,12 @@
#ifndef _PROFIL_H
#include <gmon/sys/profil.h>
# 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 */

View File

@ -1,10 +1,14 @@
#ifndef _SYS_STATFS_H
#include <io/sys/statfs.h>
# 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

View File

@ -1,10 +1,13 @@
#ifndef _SYS_SYSCTL_H
#include_next <sys/sysctl.h>
# 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 */

View File

@ -1,6 +1,8 @@
#ifndef _SYS_SYSINFO_H
#include_next <sys/sysinfo.h>
# 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 */

View File

@ -1,5 +1,7 @@
#ifndef _TTYENT_H
# include <misc/ttyent.h>
#include <misc/ttyent.h>
# 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 */

View File

@ -1,6 +1,8 @@
#ifndef _UTMP_H
#include <login/utmp.h>
# 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

View File

@ -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
# <http://www.gnu.org/licenses/>.
# 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" <<EOF
#if defined __x86_64__ && __x86_64__
#error "is x86-64"
#endif
EOF
if $cc_cmd -fsyntax-only "$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" <<EOF
/* These macros may have been defined on the command line. They are
inappropriate for this test. */
#undef _LIBC
#undef _GNU_SOURCE
#undef _REENTRANT
/* The library mode is selected here rather than on the command line to
ensure that this selection wins. */
$expanded_lib_mode
#include <$header>
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

View File

@ -24,6 +24,8 @@
# include <sysdeps/arm/bits/setjmp.h>
#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 */

View File

@ -16,8 +16,9 @@
<http://www.gnu.org/licenses/>. */
#ifndef _SYS_ASM_H
#include_next <sys/asm.h>
# include_next <sys/asm.h>
# 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 */

View File

@ -21,6 +21,9 @@
#include_next <sys/sysinfo.h>
# ifndef _ISOMAC
extern __typeof (sysinfo) __sysinfo __THROW;
# endif /* _ISOMAC */
#endif /* sys/sysinfo.h */

View File

@ -21,6 +21,9 @@
#include_next <sys/timex.h>
# ifndef _ISOMAC
libc_hidden_proto (__adjtimex)
# endif /* _ISOMAC */
#endif /* sys/timex.h */

View File

@ -16,8 +16,11 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#ifndef _BITS_FENV_H
#include_next <bits/fenv.h>
# 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 */