aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2016-08-22 08:06:30 -0400
committerZack Weinberg <zackw@panix.com>2016-09-23 08:43:55 -0400
commitcb765808fbffca30a1c67cf01ffdce30f8e6df3e (patch)
tree018dee14ad5381453a9b10de4b41d7e9d667bb33 /sysdeps
parent3a35923e97a6e6e67f95a59ba7e45be22b45cd0b (diff)
downloadglibc-cb765808fbffca30a1c67cf01ffdce30f8e6df3e.tar
glibc-cb765808fbffca30a1c67cf01ffdce30f8e6df3e.tar.gz
glibc-cb765808fbffca30a1c67cf01ffdce30f8e6df3e.tar.bz2
glibc-cb765808fbffca30a1c67cf01ffdce30f8e6df3e.zip
Installed-header hygiene (BZ#20366): Simple self-contained fixes.
Some headers did not include all of their prerequisite headers. * rpcsvc/nislib.h: Include rpcsvc/nis.h. * sysdeps/unix/sysv/linux/netrose/rose.h: Include sys/socket.h and netax25/ax25.h. <endian.h> only defines BYTE_ORDER, BIG_ENDIAN, LITTLE_ENDIAN, etc. under __USE_MISC; glibc's headers should use __BYTE_ORDER, __BIG_ENDIAN, __LITTLE_ENDIAN, etc. instead. * inet/netinet/icmp6.h, inet/netinet/ip6.h * resolv/arpa/nameser_compat.h: Use __BYTE_ORDER etc. instead of BYTE_ORDER etc. sys/types.h only conditionally defines caddr_t and clockid_t. * sysdeps/unix/sysv/linux/sys/quota.h: Use __caddr_t instead of caddr_t. * sysdeps/unix/sysv/linux/sys/timerfd.h: Use __clockid_t instead of clockid_t. Remove a #warning that was the sole actual problem with using sys/ipc.h without _GNU_SOURCE/_XOPEN_SOURCE. * sysvipc/sys/ipc.h: Remove unnecessary #warning. _LIBC, __USE_XOPEN2K8, and __STDC_VERSION__ are not always defined. It seems to me that _LIBC should not appear in installed headers, but avoiding that for argp specifically would require more surgery than feels appropriate for this patch set. It's possible that "#ifdef _LIBC" would be sufficient, but I wanted to be conservative. All three versions of bits/socket.h want to know whether __flexarr will produce a real flexible array member -- specifically, one that doesn't alter sizeof(the structure containing it). They were testing for this with a complicated #if condition that did not agree with sys/cdefs.h and that tripped -Wundef warnings under -std=c90. I added a new macro to sys/cdefs.h, __glibc_c99_flexarr_available, which reveals exactly what these headers want to know. I also took the opportunity to flatten the rather messy conditional nest defining __flexarr. * argp/argp.h: Check whether _LIBC is defined before expanding it. * posix/glob.h: Check whether __USE_XOPEN2K8 is defined instead of expanding it. * misc/sys/cdefs.h: Tidy up conditional nest defining __flexarr. Define __glibc_c99_flexarr_available to 1 when the compiler supports C99-compatible flexible array members, 0 otherwise. * sysdeps/unix/sysv/linux/bits/socket.h * sysdeps/mach/hurd/bits/socket.h * bits/socket.h: Use __glibc_c99_flexarr_available in definitions of struct cmsghdr and CMSG_DATA.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/bits/socket.h4
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h4
-rw-r--r--sysdeps/unix/sysv/linux/netrose/rose.h3
-rw-r--r--sysdeps/unix/sysv/linux/sys/quota.h2
-rw-r--r--sysdeps/unix/sysv/linux/sys/timerfd.h2
5 files changed, 9 insertions, 6 deletions
diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h
index 257e438ed2..5a8cd89fee 100644
--- a/sysdeps/mach/hurd/bits/socket.h
+++ b/sysdeps/mach/hurd/bits/socket.h
@@ -220,13 +220,13 @@ struct cmsghdr
of cmsghdr structure. */
int cmsg_level; /* Originating protocol. */
int cmsg_type; /* Protocol specific type. */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
__extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
#endif
};
/* Ancillary data object manipulation macros. */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
#else
# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index 2266047e04..514c373635 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -273,13 +273,13 @@ struct cmsghdr
with this. */
int cmsg_level; /* Originating protocol. */
int cmsg_type; /* Protocol specific type. */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
__extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data. */
#endif
};
/* Ancillary data object manipulation macros. */
-#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
+#if __glibc_c99_flexarr_available
# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
#else
# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
diff --git a/sysdeps/unix/sysv/linux/netrose/rose.h b/sysdeps/unix/sysv/linux/netrose/rose.h
index 3cb7f84eb0..762d3f5888 100644
--- a/sysdeps/unix/sysv/linux/netrose/rose.h
+++ b/sysdeps/unix/sysv/linux/netrose/rose.h
@@ -21,6 +21,9 @@
#ifndef _NETROSE_ROSE_H
#define _NETROSE_ROSE_H 1
+#include <sys/socket.h>
+#include <netax25/ax25.h>
+
/* Socket level values. */
#define SOL_ROSE 260
diff --git a/sysdeps/unix/sysv/linux/sys/quota.h b/sysdeps/unix/sysv/linux/sys/quota.h
index 1deafdaa19..f34e741ef0 100644
--- a/sysdeps/unix/sysv/linux/sys/quota.h
+++ b/sysdeps/unix/sysv/linux/sys/quota.h
@@ -128,7 +128,7 @@ struct dqinfo
__BEGIN_DECLS
extern int quotactl (int __cmd, const char *__special, int __id,
- caddr_t __addr) __THROW;
+ __caddr_t __addr) __THROW;
__END_DECLS
diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h
index 3286997cc0..d037213049 100644
--- a/sysdeps/unix/sysv/linux/sys/timerfd.h
+++ b/sysdeps/unix/sysv/linux/sys/timerfd.h
@@ -35,7 +35,7 @@ enum
__BEGIN_DECLS
/* Return file descriptor for new interval timer source. */
-extern int timerfd_create (clockid_t __clock_id, int __flags) __THROW;
+extern int timerfd_create (__clockid_t __clock_id, int __flags) __THROW;
/* Set next expiration time of interval timer source UFD to UTMR. If
FLAGS has the TFD_TIMER_ABSTIME flag set the timeout value is