This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[COMMITTED] Fix linux/stddef.h coordination with glibc (Bug 20215)
- From: Carlos O'Donell <carlos at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>, Denys Vlasenko <dvlasenk at redhat dot com>, Mikko Rapeli <mikko dot rapeli at iki dot fi>
- Cc: Josh Boyer <jwboyer at fedoraproject dot org>
- Date: Fri, 10 Jun 2016 15:08:16 -0400
- Subject: [COMMITTED] Fix linux/stddef.h coordination with glibc (Bug 20215)
- Authentication-results: sourceware.org; auth=none
- References: <575699F9 dot 6080903 at redhat dot com>
On 06/07/2016 05:55 AM, Carlos O'Donell wrote:
> Denys,
>
> In recent linux 4.6.0 headers we have this:
>
> git blame include/uapi/linux/stddef.h
> ~~~
> 607ca46e (David Howells 2012-10-13 10:46:48 +0100 1) #include <linux/compiler.h>
> 283d7573 (Denys Vlasenko 2016-03-30 00:14:57 +0200 2)
> 283d7573 (Denys Vlasenko 2016-03-30 00:14:57 +0200 3) #ifndef __always_inline
> 283d7573 (Denys Vlasenko 2016-03-30 00:14:57 +0200 4) #define __always_inline inline
> 283d7573 (Denys Vlasenko 2016-03-30 00:14:57 +0200 5) #endif
> ~~~
>
> The definition of __always_inline breaks certain header include
> ordering between glibc and linux headers.
OK, I've gone ahead and committed this change to fix the header
inclusion issue with Linux's stddef.h.
Tested using a number of regression tests that I'll commit once
they get more review.
--
Cheers,
Carlos.
2016-06-09 Carlos O'Donell <carlos@redhat.com>
[BZ #20215]
* misc/sys/cdefs.h [__GNUC_PREREQ (3,2)]: Undef __always_inline first.
[!__GNUC_PREREQ (3,2)]: Likewise.
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 7fd4154..a3c2429 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -304,8 +304,13 @@
/* Forces a function to be always inlined. */
#if __GNUC_PREREQ (3,2)
+/* The Linux kernel defines __always_inline in stddef.h (283d7573), and
+ it conflicts with this definition. Therefore undefine it first to
+ allow either header to be included first. */
+# undef __always_inline
# define __always_inline __inline __attribute__ ((__always_inline__))
#else
+# undef __always_inline
# define __always_inline __inline
#endif