]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Installed header hygiene (BZ#20366): Test of installed headers.
authorZack Weinberg <zackw@panix.com>
Wed, 24 Aug 2016 01:19:17 +0000 (21:19 -0400)
committerZack Weinberg <zackw@panix.com>
Fri, 23 Sep 2016 12:43:56 +0000 (08:43 -0400)
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.

66 files changed:
ChangeLog
Makefile
Rules
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
scripts/check-installed-headers.sh [new file with mode: 0644]
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

index 47ea83666f7844f07131941e58dced76afe27339..fa6d945ed12c6266758108aed0d481e11b9f6815 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 4478c971262ac7fc961dc6d70ad4c96bb67c76af..1ae3281184e5b23c221de747f53b6109b49849bd 100644 (file)
--- 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 8306d36a078b9cd4c6f8d48a4c7dd75bca06db29..342d659408cfb571bb653d58a67572ddcac57ad4 100644 (file)
--- 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
 \f
 # This makes all the auxiliary and test programs.
 
index f7cfafcd6ca6d7351ed9a37b7ea073118e2c003b..ece69ebe433fbec52d547275aeff48e025bacb0c 100644 (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
index 01500259b8482c459738181e58cc138ad494e11a..fd90664f0a17cd6df5f1d82eaa79c89c24f35b25 100644 (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
index 4eab0b680bed7f1d81b7dc4b258b3fb891da35fc..0388c23277ed9c4ccdf011210615b14d56ee607c 100644 (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
index ce6f0238edeee9ddf2be4d3e23df2be68a9767e2..cd7ab6e925b2568759171e0b90f04e5b37461865 100644 (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
index 2e735ede4c0e922bf08849603d0c1a85235d679c..69280009b565ebfcc5b18baea4123e4a786b2a68 100644 (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
index 60658c617cc262fc21622ccbfd590cc2f743a922..f06a33f256b27f6a2f92a063f04b6c18a0c8dca5 100644 (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 */
index 8cfd9b57e975b397bb87c6996645b1c554d24e41..633fcc6f4071835147ea2d35af4e46f9fbf286cd 100644 (file)
@@ -2,7 +2,10 @@
 
 #include <string/envz.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (envz_entry)
 libc_hidden_proto (envz_remove)
 
+# endif /* !_ISOMAC */
 #endif
index 737dfc1b6f8852a26868ca5e03d2bc3fa744601e..382855938e3542468e4498930d09def2635d7f2d 100644 (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 */
index c929821e8caa1b32e3a98215ce900dbb268d8ddb..0b132b089f0a75bd82104735aa382cf411fa19e1 100644 (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
index d0b5e9c0d1c4d5cc06cb335a832a82360d55b6ee..4498a83b878acb5a2daf356db4f03bfecf881237 100644 (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 */
index 6f2693d21bd1411cc43a547570c9dab973a2634f..c094972c97d3d1c7cecef81b25617b15a270074e 100644 (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
index 8a981f688a8ee6f5ba6e2d369c5adeb954cbfd7b..532801afd041e9c7a5f18ac54c80878291f12c4e 100644 (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
index 2787f2111568e004c809ed94d8004e8250e52265..54f4b7a3cec9b21020309626d9718a356cc96e5c 100644 (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 */
index 0551a04084b4ebb4358dddd4eb0533e9c5a290ad..9a11367ec64fd0590b76334ab1729075c980968d 100644 (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
index 32a7392f38dc6dfeeaad3d2f42287d0f482cdf5b..055844285c15f73c1760f56c2245aa4d6991bed2 100644 (file)
 # 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 */
index 42fc8ed6963141d5edc0567f32e9a221a44709aa..70d32c7c84163f62f2cbfdacd3b434c106a188ec 100644 (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
index b0037a7107ee48bb3c169779c9736626d9de05d1..8883c3d53e8cf5b376e11aab2883f04587375231 100644 (file)
@@ -2,7 +2,10 @@
 
 #include <malloc/mcheck.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (mcheck)
 libc_hidden_proto (mcheck_check_all)
 
+# endif /* !_ISOMAC */
 #endif
index b34674aa3efd759fbaaf27990bc3d564841348eb..169210fc6602efe6eabb177cc3d51f1a4f0f6ee0 100644 (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
index 2efe4c04e4e1f173dcdb0734b79eadbe73016ae2..8bfe7e03ad4d1c03c285be7763c88aaffd83b117 100644 (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
index 1e8cc3910d3b318731f6808049181617aa0b3c72..6358a10fd37867cbb90650827eab8913770cf58c 100644 (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 */
index 349d59bb0330a6bb3c81bbdc77d0267a5442586a..fe2e595381461e4b627602443ac2c07403cddbfa 100644 (file)
@@ -1,3 +1,9 @@
+#ifndef _OBSTACK_H
 #include <malloc/obstack.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (_obstack_newchunk)
+
+# endif /* !_ISOMAC */
+#endif /* obstack.h */
index b12b5dc971ea482cd214f4c89d74bd3289c47cb3..984f2631677f7ba858b5c5c51466315285a43a30 100644 (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
index a91be808528ec29314046e8f9ce9c270e07d64c3..4979bb765f56f6ca854b96ba7dffc70ba5aa51a6 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef _PTY_H
 #include <login/pty.h>
 
+# ifndef _ISOMAC
+
 libutil_hidden_proto (openpty)
 
+# endif /* !_ISOMAC */
 #endif
index 52ac21866674c275220c29539975010feb706a51..699cc815694c69d838f14b93285822958f2c8269 100644 (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
index 0219fd93161a996370e3bde62e33fdcf3be02635..2e55cce11de2dbe005b7db4c7f371da5db2e6867 100644 (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
index 0e9db1a226f4df95ba36a8a865e17b8c615ccfd0..6afed56b71920800a274b5c298c053ad9ad5d3fa 100644 (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
index 07031c9bd998e5514d8d29514eda60a239097d13..019efa275ab03e8f92d16c573047520ffea8a430 100644 (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 */
index d79a6a7b5b2e5e2d321c8b21ec4227bb43605773..a397023a9312bf5105eb4d796eb8666888c8ee77 100644 (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
index 44f7e669b003868e6069d0d47b23d38ce8ac3049..7a34957df89e66bf6013f249ad646ae72fa56f71 100644 (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
index 29d14cc8a044306ab0c87953e4800cf15e2c4da9..4711a94edf166a81ec54f9db4633f5472447f94a 100644 (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 */
index 65af237e5052c1a8ec4e0889f52d2b43cb2771f4..9b84668be7ff2c14046da7fe9822f6897366f295 100644 (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
index 67628e0589474470274f80736551e52950215d47..ec907c28ccd73e0231ffcf42652fc921dbf4997e 100644 (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 */
index 2e9076ee3dd3b64f72c451d6b9e9b60bfbbe1271..a2573d106f8263f7c61529b91c04ac9a88658ad7 100644 (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 */
index e8822dabe914a6bd979b5c8871eb04116855a2d5..ae53a02652b4e456be987cb85752f5599bf352bb 100644 (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 */
index 58bdef3cc9986e5e31c20c52386bcfb1a19be450..4c9ee826177ae39afa47d570a325c5565c1caf81 100644 (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
index be1f4838c965c44b8d68b42a35e127ec27a66748..93c5ab87649407c2d6ef2f815865695c523c3850 100644 (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
index 61a8ab3503aa63b904e93bb19c60990c4443ca5a..465bf4427d3c7e493e23832ba3a11f7820c27fe8 100644 (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
index 582bb31aea42d513e86302220f3f0916aef83d19..2609d195448751ce9bed6239cf30a30356f70e84 100644 (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
index 57971d0758f6d95e6aebdfcbad19ab68df90c868..e1bff1cd1cd65713a2d94f3881f01631a699188f 100644 (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 */
index dfa9cd3ef76f83e3e6ec906243a1cb6f8cfbf59d..0515d07887978836e5796d54070ce2a9e891f4e4 100644 (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
index 635c513e4dcdc8a4b785d85a684138098d958aaa..05b19877e7edab386574b2b0439ef21f76d37bcf 100644 (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
index 04a973eae77d98e5ab84906290e2660082d172fb..b6d7c15f6225fcf85514fa9f670f59c8d75de293 100644 (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
index b38dc6bb4cf040116efae140e83112c02c700d95..1b4e2f215cac7efc2d6a67fcc2a0e3e231144975 100644 (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
index 76019715124c11fb2b7d22fdcf18c089669f25f9..6d179dd306a0adc20a3f0d105ec672ef694c7bfc 100644 (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
index a3f897cba1cf1e4148813cc53515aba0695af293..124a1ab50ace422db2b7749550bb4d8543b1413e 100644 (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
index 354146f8e8438ce73260e382eec18b853fb9da96..29c6e68cdb201b1e8eb55b744250276890952464 100644 (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 */
index ce1c2e26d5f8ad081ad46dc8465f5460c15edff1..86e0a54e62a5628b078ddd9ae757acb4f625f773 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef _SYS_EPOLL_H
 #include_next <sys/epoll.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (epoll_pwait)
 
+# endif /* !_ISOMAC */
 #endif
index e73a4d1c94ae4e9c2f6858342d5020ed9495122a..d0cd1f9e15f7c7a4d5a045e5aa6b658415ae0908 100644 (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
index 55739cf00cb8991abfb571f4f42ac265adcd4b7e..30889d8bc38847e90973192c7da9e1989d399b65 100644 (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
index ebadd526b9f960ab2341b1300b22f0d0b7ecb5df..bfc6909dbce2c0ac224ef4556cc626425cc7f102 100644 (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
index 316f454c1c62c0702c034e423aca8cafa131cb34..0920ed642b43bbc6b462e1d7a66ae59455c84bda 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef _SYS_PRCTL_H
 #include_next <sys/prctl.h>
 
+# ifndef _ISOMAC
+
 extern int __prctl (int __option, ...);
 
+# endif /* !_ISOMAC */
 #endif
index 7bf17003adf797d926448e6fe6ab699d321b2fcd..2b1133073e8360e83c7af37e1a5819818956a6be 100644 (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 */
index e34ad029653668123f94de3b9efff6f17dec87ae..3fac4a34905641b6caac4240aeb76bec7642d155 100644 (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
index 4fffb4ff497dec2afc882496dd2ec16762656250..2a15e91354d0174d928b15b6d9d2b92308212795 100644 (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 */
index d33055a2b3eaaa500428d84953e3d966f186609e..c33eae28835ffc4659e89a0e87dc336154ddaff9 100644 (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 */
index 81e52116e529a76b26c144858d7c1f7000a8cd1e..53a66681d2a68f5cda8da3327e2a122e19198b2e 100644 (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 */
index 28207d1282e81730018ebabd9d8484a86d55bdc6..6b2e262362d7fb1b3025ffbc5638e81ba9ec32c1 100644 (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
diff --git a/scripts/check-installed-headers.sh b/scripts/check-installed-headers.sh
new file mode 100644 (file)
index 0000000..7fbc725
--- /dev/null
@@ -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
index 6b6a23587104069538810deb693dd99d2cf91c9d..e1fe5059a3d818278f20abd786a063c6c79efa4a 100644 (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 */
index 7e288df1179e6a61f3ebcc41160c014bd20d2b19..67acf74dc03310b9c1b796d7e54aa46d2db0c454 100644 (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 */
index 50077fb08c22b04bccd0bca38c9d8a4ed5396a74..b76f7e0d094cf6ccd8f1d05662c662677e32f5fb 100644 (file)
@@ -21,6 +21,9 @@
 
 #include_next <sys/sysinfo.h>
 
+# ifndef _ISOMAC
+
 extern __typeof (sysinfo) __sysinfo __THROW;
 
+# endif /* _ISOMAC */
 #endif /* sys/sysinfo.h */
index ace90ee033360211e7788ad4038ec527918c4737..4b4ff888950aa59b6950e6708d4199f9e1e0cda6 100644 (file)
@@ -21,6 +21,9 @@
 
 #include_next <sys/timex.h>
 
+# ifndef _ISOMAC
+
 libc_hidden_proto (__adjtimex)
 
+# endif /* _ISOMAC */
 #endif /* sys/timex.h */
index 6e8b733f3373e4454e7a0a29119fc97d372627ea..a410ed00d0a6aceec2a477f5ab24d05ebbe046d4 100644 (file)
    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 */