about summary refs log tree commit diff
path: root/include/rpc
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2016-08-23 21:19:17 -0400
committerZack Weinberg <zackw@panix.com>2016-09-23 08:43:56 -0400
commit4775578486c8ee2aa09b402eb272eb932e7e0691 (patch)
treebbf7bd888aec1d626a492c2bece4ef0efd50169a /include/rpc
parentc66b29f9cce9bf7c67d55879dff5e4cd03ecfac1 (diff)
downloadglibc-4775578486c8ee2aa09b402eb272eb932e7e0691.tar.gz
glibc-4775578486c8ee2aa09b402eb272eb932e7e0691.tar.xz
glibc-4775578486c8ee2aa09b402eb272eb932e7e0691.zip
Installed header hygiene (BZ#20366): Test of installed headers.
This adds a test to ensure that the problems fixed in the last several
patches do not recur.  Each directory checks the headers that it
installs for two properties: first, each header must be compilable in
isolation, as both C and C++, under a representative combination of
language and library conformance levels; second, there is a blacklist
of identifiers that may not appear in any installed header, currently
consisting of the legacy BSD typedefs.  (There is an exemption for the
headers that define those typedefs, and for the RPC headers.  It may be
necessary to make this more sophisticated if we add more stuff to the
blacklist in the future.)

In order for this test to work correctly, every wrapper header
that actually defines something must guard those definitions with
 #ifndef _ISOMAC.  This is the existing mechanism used by the conform/
tests to tell wrapper headers not to define anything that the public
header wouldn't, and not to use anything from libc-symbols.h.  conform/
only cares for headers that we need to check for standards conformance,
whereas this test applies to *every* header.  (Headers in include/ that
are either installed directly, or are internal-use-only and do *not*
correspond to any installed header, are not affected.)

	* scripts/check-installed-headers.sh: New script.
	* Rules: In each directory that defines header files to be installed,
	run check-installed-headers.sh on them as a special test.
	* Makefile: Likewise for the headers installed at top level.

	* include/aliases.h, include/alloca.h, include/argz.h
	* include/arpa/nameser.h, include/arpa/nameser_compat.h
	* include/elf.h, include/envz.h, include/err.h
	* include/execinfo.h, include/fpu_control.h, include/getopt.h
	* include/gshadow.h, include/ifaddrs.h, include/libintl.h
	* include/link.h, include/malloc.h, include/mcheck.h
	* include/mntent.h, include/netinet/ether.h
	* include/nss.h, include/obstack.h, include/printf.h
	* include/pty.h, include/resolv.h, include/rpc/auth.h
	* include/rpc/auth_des.h, include/rpc/auth_unix.h
	* include/rpc/clnt.h, include/rpc/des_crypt.h
	* include/rpc/key_prot.h, include/rpc/netdb.h
	* include/rpc/pmap_clnt.h, include/rpc/pmap_prot.h
	* include/rpc/pmap_rmt.h, include/rpc/rpc.h
	* include/rpc/rpc_msg.h, include/rpc/svc.h
	* include/rpc/svc_auth.h, include/rpc/xdr.h
	* include/rpcsvc/nis_callback.h, include/rpcsvc/nislib.h
	* include/rpcsvc/yp.h, include/rpcsvc/ypclnt.h
	* include/rpcsvc/ypupd.h, include/shadow.h
	* include/stdio_ext.h, include/sys/epoll.h
	* include/sys/file.h, include/sys/gmon.h, include/sys/ioctl.h
	* include/sys/prctl.h, include/sys/profil.h
	* include/sys/statfs.h, include/sys/sysctl.h
	* include/sys/sysinfo.h, include/ttyent.h, include/utmp.h
	* sysdeps/arm/nacl/include/bits/setjmp.h
	* sysdeps/mips/include/sys/asm.h
	* sysdeps/unix/sysv/linux/include/sys/sysinfo.h
	* sysdeps/unix/sysv/linux/include/sys/timex.h
	* sysdeps/x86/fpu/include/bits/fenv.h:
	Add #ifndef _ISOMAC guard around internal declarations.
	Add multiple-inclusion guard if not already present.
Diffstat (limited to 'include/rpc')
-rw-r--r--include/rpc/auth.h3
-rw-r--r--include/rpc/auth_des.h3
-rw-r--r--include/rpc/auth_unix.h6
-rw-r--r--include/rpc/clnt.h3
-rw-r--r--include/rpc/des_crypt.h3
-rw-r--r--include/rpc/key_prot.h6
-rw-r--r--include/rpc/netdb.h3
-rw-r--r--include/rpc/pmap_clnt.h7
-rw-r--r--include/rpc/pmap_prot.h6
-rw-r--r--include/rpc/pmap_rmt.h6
-rw-r--r--include/rpc/rpc.h4
-rw-r--r--include/rpc/rpc_msg.h3
-rw-r--r--include/rpc/svc.h3
-rw-r--r--include/rpc/svc_auth.h3
-rw-r--r--include/rpc/xdr.h6
15 files changed, 63 insertions, 2 deletions
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 <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
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 <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
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 <sunrpc/rpc/auth_unix.h>
 
+# 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 <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
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 <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
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 <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 */
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 <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
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 <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 */
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 <sunrpc/rpc/pmap_prot.h>
 
+# 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 <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 */
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 <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
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 <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
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 <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
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 <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
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 <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 */