mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
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.
This commit is contained in:
parent
3a35923e97
commit
cb765808fb
29
ChangeLog
29
ChangeLog
@ -1,3 +1,32 @@
|
||||
2016-09-23 Zack Weinberg <zackw@panix.com>
|
||||
|
||||
* rpcsvc/nislib.h: Include rpcsvc/nis.h.
|
||||
* sysdeps/unix/sysv/linux/netrose/rose.h:
|
||||
Include sys/socket.h and netax25/ax25.h.
|
||||
|
||||
* inet/netinet/icmp6.h, inet/netinet/ip6.h
|
||||
* resolv/arpa/nameser_compat.h:
|
||||
Use __BYTE_ORDER etc. instead of BYTE_ORDER etc.
|
||||
|
||||
* 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.
|
||||
|
||||
* sysvipc/sys/ipc.h: Remove unnecessary #warning.
|
||||
|
||||
* 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.
|
||||
|
||||
2016-09-23 Florian Weimer <fweimer@redhat.com>
|
||||
|
||||
* manual/nss.texi (NSS Modules Interface): Adjust function return
|
||||
|
@ -511,7 +511,7 @@ extern void *__argp_input (const struct argp *__restrict __argp,
|
||||
|
||||
#ifdef __USE_EXTERN_INLINES
|
||||
|
||||
# if !_LIBC
|
||||
# if !(defined _LIBC && _LIBC)
|
||||
# define __argp_usage argp_usage
|
||||
# define __argp_state_help argp_state_help
|
||||
# define __option_is_short _option_is_short
|
||||
@ -546,7 +546,7 @@ __NTH (__option_is_end (const struct argp_option *__opt))
|
||||
return !__opt->key && !__opt->name && !__opt->doc && !__opt->group;
|
||||
}
|
||||
|
||||
# if !_LIBC
|
||||
# if !(defined _LIBC && _LIBC)
|
||||
# undef __argp_usage
|
||||
# undef __argp_state_help
|
||||
# undef __option_is_short
|
||||
|
@ -216,13 +216,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))
|
||||
|
@ -160,11 +160,11 @@ struct nd_neighbor_advert /* neighbor advertisement */
|
||||
#define nd_na_code nd_na_hdr.icmp6_code
|
||||
#define nd_na_cksum nd_na_hdr.icmp6_cksum
|
||||
#define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0]
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
#define ND_NA_FLAG_ROUTER 0x80000000
|
||||
#define ND_NA_FLAG_SOLICITED 0x40000000
|
||||
#define ND_NA_FLAG_OVERRIDE 0x20000000
|
||||
#else /* BYTE_ORDER == LITTLE_ENDIAN */
|
||||
#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
|
||||
#define ND_NA_FLAG_ROUTER 0x00000080
|
||||
#define ND_NA_FLAG_SOLICITED 0x00000040
|
||||
#define ND_NA_FLAG_OVERRIDE 0x00000020
|
||||
@ -298,10 +298,10 @@ struct rr_pco_use /* use prefix part */
|
||||
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x20
|
||||
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x10
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80000000
|
||||
# define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40000000
|
||||
#elif BYTE_ORDER == LITTLE_ENDIAN
|
||||
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80
|
||||
# define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40
|
||||
#endif
|
||||
@ -315,10 +315,10 @@ struct rr_result /* router renumbering result message */
|
||||
struct in6_addr rrr_prefix;
|
||||
};
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define ICMP6_RR_RESULT_FLAGS_OOB 0x0002
|
||||
# define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0001
|
||||
#elif BYTE_ORDER == LITTLE_ENDIAN
|
||||
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define ICMP6_RR_RESULT_FLAGS_OOB 0x0200
|
||||
# define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100
|
||||
#endif
|
||||
|
@ -101,11 +101,11 @@ struct ip6_frag
|
||||
uint32_t ip6f_ident; /* identification */
|
||||
};
|
||||
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define IP6F_OFF_MASK 0xfff8 /* mask out offset from _offlg */
|
||||
# define IP6F_RESERVED_MASK 0x0006 /* reserved bits in ip6f_offlg */
|
||||
# define IP6F_MORE_FRAG 0x0001 /* more-fragments flag */
|
||||
#else /* BYTE_ORDER == LITTLE_ENDIAN */
|
||||
#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
|
||||
# define IP6F_OFF_MASK 0xf8ff /* mask out offset from _offlg */
|
||||
# define IP6F_RESERVED_MASK 0x0600 /* reserved bits in ip6f_offlg */
|
||||
# define IP6F_MORE_FRAG 0x0100 /* more-fragments flag */
|
||||
@ -175,11 +175,11 @@ struct ip6_opt_router
|
||||
};
|
||||
|
||||
/* Router alert values (in network byte order) */
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define IP6_ALERT_MLD 0x0000
|
||||
# define IP6_ALERT_RSVP 0x0001
|
||||
# define IP6_ALERT_AN 0x0002
|
||||
#else /* BYTE_ORDER == LITTLE_ENDING */
|
||||
#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
|
||||
# define IP6_ALERT_MLD 0x0000
|
||||
# define IP6_ALERT_RSVP 0x0100
|
||||
# define IP6_ALERT_AN 0x0200
|
||||
|
@ -153,21 +153,27 @@
|
||||
# define __errordecl(name, msg) extern void name (void)
|
||||
#endif
|
||||
|
||||
/* Support for flexible arrays. */
|
||||
#if __GNUC_PREREQ (2,97)
|
||||
/* GCC 2.97 supports C99 flexible array members. */
|
||||
/* Support for flexible arrays.
|
||||
Headers that should use flexible arrays only if they're "real"
|
||||
(e.g. only if they won't affect sizeof()) should test
|
||||
#if __glibc_c99_flexarr_available. */
|
||||
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
|
||||
# define __flexarr []
|
||||
# define __glibc_c99_flexarr_available 1
|
||||
#elif __GNUC_PREREQ (2,97)
|
||||
/* GCC 2.97 supports C99 flexible array members as an extension,
|
||||
even when in C89 mode or compiling C++ (any version). */
|
||||
# define __flexarr []
|
||||
# define __glibc_c99_flexarr_available 1
|
||||
#elif defined __GNUC__
|
||||
/* Pre-2.97 GCC did not support C99 flexible arrays but did have
|
||||
an equivalent extension with slightly different notation. */
|
||||
# define __flexarr [0]
|
||||
# define __glibc_c99_flexarr_available 1
|
||||
#else
|
||||
# ifdef __GNUC__
|
||||
# define __flexarr [0]
|
||||
# else
|
||||
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
|
||||
# define __flexarr []
|
||||
# else
|
||||
/* Some other non-C99 compiler. Approximate with [1]. */
|
||||
# define __flexarr [1]
|
||||
# endif
|
||||
# endif
|
||||
# define __flexarr [1]
|
||||
# define __glibc_c99_flexarr_available 0
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
#ifndef __RPCSVC_NISLIB_H__
|
||||
#define __RPCSVC_NISLIB_H__
|
||||
|
||||
#include <features.h>
|
||||
#include <rpcsvc/nis.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
@ -25,7 +25,7 @@ __BEGIN_DECLS
|
||||
/* We need `size_t' for the following definitions. */
|
||||
#ifndef __size_t
|
||||
typedef __SIZE_TYPE__ __size_t;
|
||||
# if defined __USE_XOPEN || __USE_XOPEN2K8
|
||||
# if defined __USE_XOPEN || defined __USE_XOPEN2K8
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
# endif
|
||||
#else
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
typedef struct {
|
||||
unsigned id :16; /*%< query identification number */
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||
/* fields in third byte */
|
||||
unsigned qr: 1; /*%< response flag */
|
||||
unsigned opcode: 4; /*%< purpose of message */
|
||||
@ -54,7 +54,7 @@ typedef struct {
|
||||
unsigned cd: 1; /*%< checking disabled by resolver */
|
||||
unsigned rcode :4; /*%< response code */
|
||||
#endif
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN || __BYTE_ORDER == __PDP_ENDIAN
|
||||
/* fields in third byte */
|
||||
unsigned rd :1; /*%< recursion desired */
|
||||
unsigned tc :1; /*%< truncated message */
|
||||
|
@ -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))
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -20,10 +20,6 @@
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#if !defined __USE_MISC && !defined __USE_XOPEN && __GNUC__ >= 2
|
||||
# warning "Files using this header must be compiled with _GNU_SOURCE or _XOPEN_SOURCE"
|
||||
#endif
|
||||
|
||||
/* Get system dependent definition of `struct ipc_perm' and more. */
|
||||
#include <bits/ipctypes.h>
|
||||
#include <bits/ipc.h>
|
||||
|
Loading…
Reference in New Issue
Block a user