From 11160cb76f56e0a711686e34881a4eaf1ad2fa0e Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Sun, 21 Aug 2016 15:38:41 -0400 Subject: Installed-header hygiene (BZ#20366): obsolete BSD u_* types. The types u_char, u_short, u_int, u_long, ushort, uint, ulong, u_int8_t, u_int16_t, u_int32_t, u_int64_t, quad_t, and u_quad_t are BSDisms that have never been standardized. While glibc should continue to *provide* these types for compatibility's sake, its public headers should not use them. The meat of this change was mechanically generated by the following shell command: perl -pi~ -e ' s/\b(__)?u_char\b/unsigned char/g; s/\b(__)?u_?short\b/unsigned short/g; s/\b(__)?u_?int\b/unsigned int/g; s/\b(__)?u_?long\b/unsigned long/g; s/\b(__)?u_int8_t\b/uint8_t/g; s/\b(__)?u_int16_t\b/uint16_t/g; s/\b(__)?u_int32_t\b/uint32_t/g; s/\b(__)?u_int64_t\b/uint64_t/g; s/\b(__)?u_quad_t\b/uint64_t/g; s/\b(__)?quad_t\b/uint64_t/g; ' $(grep -lE -e '\<((__)?(quad_t|u(short|int|long|_(char|short|int([0-9]+_t)?|long|quad_t))))\>' \ $(grep -LE '\<(_(SYS|BITS)_TYPES_H|rpc/(rpc|rpc_msg|types|xdr)\.h)\>' \ $(find . \( -false $(sed 's/^/-o -name /' all-installed-headers) \ \) -printf '%P\n' | sort -u))) where 'all-installed-headers' was a list of the basenames of all installed header files, manually extracted from the Makefiles. Non-installed wrapper headers in include/ are also adjusted, for consistency. I then manually fixed up indentation and line-wrapping. sys/types.h and bits/types.h are excluded because they must continue to define the u_* types (under __USE_MISC) for compatibility with applications. They do not use these types themselves. All headers that (transitively) include rpc/types.h are also excluded, for three reasons. First, the u_* types are defined by rpc/types.h, unconditionally (not just under __USE_MISC) so they are logically part of the SunRPC API. Second, many of those headers appear to be machine-generated. Third, it's my understanding that we are getting rid of as much of SunRPC as possible in the near future. (The one file under sunrpc/ that's touched, sunrpc/rpc/rpc_des.h, does *not* include rpc/types.h. This may itself be a bug.) After changing from u_intNN_t to uintNN_t, a number of headers now need to include stdint.h to pick up those types. It might be more hygenic, namespace-wise, to use __uintNN_t instead, but none of these headers are bound by ISO or POSIX to do so, and it's unlikely that anyone using them will be bothered. (The two files that were using __-prefixed versions of the u_types, sysdeps/mach/hurd/net/route.h and sysdeps/unix/sysv/linux/net/route.h, both already also contained uses of the unprefixed versions.) Some of these files directly included features.h and/or sys/cdefs.h, which I removed, as the style generally seems to be to let sys/types.h do that for us. (This does not change the set of definitions exposed by any header; sys/types.h unconditionally includes both features.h and sys/cdefs.h.) One file included asm/types.h unnecessarily. * bits/in.h, gmon/sys/gmon.h, inet/netinet/igmp.h * inet/protocols/routed.h, inet/protocols/talkd.h * inet/protocols/timed.h, io/fts.h, nptl_db/thread_db.h * resolv/arpa/nameser.h, resolv/resolv.h, sunrpc/rpc/rpc_des.h * sysdeps/generic/netinet/if_ether.h * sysdeps/generic/netinet/in_systm.h * sysdeps/generic/netinet/ip.h, sysdeps/generic/netinet/tcp.h * sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h * sysdeps/gnu/netinet/udp.h, sysdeps/mach/hurd/net/ethernet.h * sysdeps/mach/hurd/net/if_arp.h * sysdeps/mach/hurd/net/if_ppp.h * sysdeps/mach/hurd/net/route.h, sysdeps/mach/sys/reboot.h * sysdeps/unix/sysv/linux/bits/in.h * sysdeps/unix/sysv/linux/net/ethernet.h * sysdeps/unix/sysv/linux/net/if_arp.h * sysdeps/unix/sysv/linux/net/if_ppp.h * sysdeps/unix/sysv/linux/net/if_shaper.h * sysdeps/unix/sysv/linux/net/route.h * sysdeps/unix/sysv/linux/netinet/if_ether.h * sysdeps/unix/sysv/linux/netinet/if_fddi.h * sysdeps/unix/sysv/linux/netinet/if_tr.h * sysdeps/unix/sysv/linux/netipx/ipx.h * sysdeps/unix/sysv/linux/sys/acct.h * include/arpa/nameser.h, include/resolv.h: Change all uses of u_char to unsigned char, u_short and ushort to unsigned short, u_int and uint to unsigned int, u_long and ulong to unsigned long, u_int8_t to uint8_t, u_int16_t to uint16_t, u_int32_t to uint32_t, quad_t to int64_t, and u_int64_t and u_quad_t to uint64_t. * mach/sys/reboot.h: Remove two casts of integer literals to the types they already have. * bits/in.h: Correct error in description of IP_MULTICAST_LOOP. * sysdeps/unix/sysv/linux/bits/in.h: Likewise. * sysdeps/unix/sysv/linux/netinet/if_ether.h: Change a comment from referring to 'unsigned char' to 'uint8_t' for consistency with the macro definition below. * gmon/sys/gmon.h, inet/netinet/igmp.h, inet/protocols/talkd.h * io/fts.h, resolv/arpa/nameser.h, resolv/resolv.h * sunrpc/rpc/rpc_des.h, sysdeps/generic/netinet/ip.h * sysdeps/gnu/netinet/tcp.h, sysdeps/gnu/netinet/udp.h * sysdeps/mach/hurd/net/if_ppp.h, sysdeps/unix/sysv/linux/net/if_ppp.h * sysdeps/unix/sysv/linux/sys/acct.h * include/arpa/nameser.h, include/resolv.h: Fix indentation disrupted by mechanical edits. * inet/protocols/talkd.h, resolv/arpa/nameser.h * sysdeps/generic/netinet/in_systm.h * sysdeps/gnu/netinet/ip_icmp.h, sysdeps/gnu/netinet/tcp.h * sysdeps/gnu/netinet/udp.h * sysdeps/unix/sysv/linux/net/ethernet.h * sysdeps/unix/sysv/linux/net/if_arp.h * sysdeps/unix/sysv/linux/net/if_ppp.h * sysdeps/unix/sysv/linux/net/if_shaper.h * sysdeps/unix/sysv/linux/netinet/if_fddi.h * sysdeps/unix/sysv/linux/netinet/if_tr.h * sysdeps/unix/sysv/linux/netipx/ipx.h * sysdeps/unix/sysv/linux/sys/acct.h Include stdint.h for uintNN_t definitions. Don't include sys/cdefs.h, features.h, or asm/types.h directly. --- include/arpa/nameser.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/arpa/nameser.h') diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h index 57f7457848..ce6f0238ed 100644 --- a/include/arpa/nameser.h +++ b/include/arpa/nameser.h @@ -47,8 +47,8 @@ extern const struct _ns_flagdata _ns_flagdata[] attribute_hidden; #endif -extern u_int __ns_get16 (const u_char *) __THROW; -extern u_long __ns_get32 (const u_char *) __THROW; +extern unsigned int __ns_get16 (const unsigned char *) __THROW; +extern unsigned long __ns_get32 (const unsigned char *) __THROW; #define ns_msg_getflag(handle, flag) \ (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift) -- cgit v1.2.3 From 4775578486c8ee2aa09b402eb272eb932e7e0691 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Tue, 23 Aug 2016 21:19:17 -0400 Subject: 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. --- ChangeLog | 39 +++++++ Makefile | 23 ++++ Rules | 23 ++++ include/aliases.h | 3 + include/alloca.h | 4 + include/argz.h | 3 + include/arpa/nameser.h | 3 + include/arpa/nameser_compat.h | 3 + include/elf.h | 9 +- include/envz.h | 3 + include/err.h | 6 ++ include/execinfo.h | 3 + include/fpu_control.h | 6 ++ include/getopt.h | 5 +- include/gshadow.h | 3 + include/ifaddrs.h | 4 + include/libintl.h | 4 + include/link.h | 11 +- include/malloc.h | 2 + include/mcheck.h | 3 + include/mntent.h | 3 + include/netinet/ether.h | 3 + include/nss.h | 3 + include/obstack.h | 6 ++ include/printf.h | 4 + include/pty.h | 3 + include/resolv.h | 11 +- include/rpc/auth.h | 3 + include/rpc/auth_des.h | 3 + include/rpc/auth_unix.h | 6 ++ include/rpc/clnt.h | 3 + include/rpc/des_crypt.h | 3 + include/rpc/key_prot.h | 6 ++ include/rpc/netdb.h | 3 + include/rpc/pmap_clnt.h | 7 +- include/rpc/pmap_prot.h | 6 ++ include/rpc/pmap_rmt.h | 6 ++ include/rpc/rpc.h | 4 + include/rpc/rpc_msg.h | 3 + include/rpc/svc.h | 3 + include/rpc/svc_auth.h | 3 + include/rpc/xdr.h | 6 ++ include/rpcsvc/nis_callback.h | 3 + include/rpcsvc/nislib.h | 3 + include/rpcsvc/yp.h | 3 + include/rpcsvc/ypclnt.h | 3 + include/rpcsvc/ypupd.h | 3 + include/shadow.h | 3 + include/stdio_ext.h | 7 +- include/sys/epoll.h | 3 + include/sys/file.h | 4 + include/sys/gmon.h | 4 + include/sys/ioctl.h | 4 + include/sys/prctl.h | 3 + include/sys/profil.h | 3 + include/sys/statfs.h | 4 + include/sys/sysctl.h | 3 + include/sys/sysinfo.h | 3 + include/ttyent.h | 7 +- include/utmp.h | 3 + scripts/check-installed-headers.sh | 146 ++++++++++++++++++++++++++ sysdeps/arm/nacl/include/bits/setjmp.h | 3 + sysdeps/mips/include/sys/asm.h | 6 +- sysdeps/unix/sysv/linux/include/sys/sysinfo.h | 3 + sysdeps/unix/sysv/linux/include/sys/timex.h | 3 + sysdeps/x86/fpu/include/bits/fenv.h | 6 ++ 66 files changed, 470 insertions(+), 21 deletions(-) create mode 100644 scripts/check-installed-headers.sh (limited to 'include/arpa/nameser.h') 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 */ -- cgit v1.2.3 From 44f28da7cab271b659551c4fe1a7d2e420803576 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 4 Apr 2017 14:36:02 +0200 Subject: nss_dns: Replace local declarations with declarations from a header file --- ChangeLog | 11 +++++++++++ include/arpa/nameser.h | 3 +++ resolv/nss_dns/dns-host.c | 8 +------- resolv/nss_dns/dns-network.c | 8 +------- 4 files changed, 16 insertions(+), 14 deletions(-) (limited to 'include/arpa/nameser.h') diff --git a/ChangeLog b/ChangeLog index 406b961f62..f2d13c4640 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2017-04-04 Florian Weimer + + * include/arpa/nameser.h (__ns_name_ntop, __ns_name_unpack): + Declare. + * resolv/nss_dns/dns-network.c: Include . + (NS_MAXCDNAME): Remove definition. + (__ns_name_ntop, __ns_name_unpack): Remove declaration. + * resolv/nss_dns/dns-host.c: Include . + (NS_MAXCDNAME): Remove definition. + (__ns_name_ntop, __ns_name_unpack): Remove declaration. + 2017-04-04 Florian Weimer * resolv/nss_dns/dns-network.c (getanswer_r): Remove __dn_expand diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h index cd7ab6e925..7a8290e1f2 100644 --- a/include/arpa/nameser.h +++ b/include/arpa/nameser.h @@ -51,6 +51,9 @@ extern const struct _ns_flagdata _ns_flagdata[] attribute_hidden; extern unsigned int __ns_get16 (const unsigned char *) __THROW; extern unsigned long __ns_get32 (const unsigned char *) __THROW; +int __ns_name_ntop (const unsigned char *, char *, size_t) __THROW; +int __ns_name_unpack (const unsigned char *, const unsigned char *, + const unsigned char *, unsigned char *, size_t) __THROW; #define ns_msg_getflag(handle, flag) \ (((handle)._flags & _ns_flagdata[flag].mask) >> _ns_flagdata[flag].shift) diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c index 01864dc96e..705b3c9c07 100644 --- a/resolv/nss_dns/dns-host.c +++ b/resolv/nss_dns/dns-host.c @@ -80,6 +80,7 @@ #include #include "nsswitch.h" +#include /* Get implementeation for some internal functions. */ #include @@ -106,13 +107,6 @@ typedef union querybuf u_char buf[MAXPACKET]; } querybuf; -/* These functions are defined in res_comp.c. */ -#define NS_MAXCDNAME 255 /* maximum compressed domain name */ -extern int __ns_name_ntop (const u_char *, char *, size_t); -extern int __ns_name_unpack (const u_char *, const u_char *, - const u_char *, u_char *, size_t); - - static enum nss_status getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype, struct hostent *result, char *buffer, diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c index fd8c5656c0..2be72d33a3 100644 --- a/resolv/nss_dns/dns-network.c +++ b/resolv/nss_dns/dns-network.c @@ -66,6 +66,7 @@ #include "nsswitch.h" #include +#include /* Maximum number of aliases we allow. */ #define MAX_NR_ALIASES 48 @@ -92,13 +93,6 @@ typedef union querybuf u_char buf[MAXPACKET]; } querybuf; -/* These functions are defined in res_comp.c. */ -#define NS_MAXCDNAME 255 /* maximum compressed domain name */ -extern int __ns_name_ntop (const u_char *, char *, size_t) __THROW; -extern int __ns_name_unpack (const u_char *, const u_char *, - const u_char *, u_char *, size_t) __THROW; - - /* Prototypes for local functions. */ static enum nss_status getanswer_r (const querybuf *answer, int anslen, struct netent *result, char *buffer, -- cgit v1.2.3