Skip to contentSkip to conversation

uapi/linux/stddef.h: Provide __always_inline to userspace headers

PATCH In review Denys Vlasenko 3 participants 3 messages Mar 29, 2016 – Mar 30, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 uapi/linux/stddef.h: Provide __always_inline to userspace headers

Recent change to uapi/linux/swab.h needs this.

Unfortunately, UAPI headers don't include compiler.h and fixing it there is not enough.

Tested. Testcase: "make headers_install" and try to compile this:

	#include <linux/swab.h>
	void main() {}
CC Josh Boyer <[email protected]>
CC Thomas Graf <[email protected]>
CC Peter Zijlstra <[email protected]>
CC David Rientjes <[email protected]>
CC Arnd Bergmann <[email protected]>
CC Ingo Molnar <[email protected]>
CC Andrew Morton <[email protected]>
CC Linus Torvalds <[email protected]>
---
 include/uapi/linux/stddef.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/stddef.h +4 -0
index aa9f104..621fa8a 100644
@@ -1 +1,5 @@
 #include <linux/compiler.h>
+
+#ifndef __always_inline
+#define __always_inline inline
+#endif
Signature · 1 line
1.8.1.4
#1 lore raw
uapi/linux/stddef.h: Provide __always_inline to userspace headers
Commit-ID:  283d757378371e8044d873e661b1dccee46c5887
Gitweb:     http://git.kernel.org/tip/283d757378371e8044d873e661b1dccee46c5887
Author:     Denys Vlasenko <[email protected]>
AuthorDate: Wed, 30 Mar 2016 00:14:57 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 30 Mar 2016 12:50:17 +0200

uapi/linux/stddef.h: Provide __always_inline to userspace headers

Josh Boyer reported that my recent change to uapi/linux/swab.h broke the Qemu build:

bc27fb68aaad ("include/uapi/linux/byteorder, swab: force inlining of some byteswap operations")

Unfortunately, UAPI headers don't include compiler.h so fixing it there is not enough, add an __always_inline definition to uapi/linux/stddef.h instead.

Testcase: "make headers_install" and try to compile this:

	#include <linux/swab.h>
	void main() {}
---
 include/uapi/linux/stddef.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/stddef.h +4 -0
index aa9f104..621fa8a 100644
@@ -1 +1,5 @@
 #include <linux/compiler.h>
+
+#ifndef __always_inline
+#define __always_inline inline
+#endif
Tested-by on v1 1/1
#2 lore raw
In reply to Denys Vlasenko
Quoted 28 lines · Denys Vlasenko

Recent change to uapi/linux/swab.h needs this.

Unfortunately, UAPI headers don't include compiler.h and fixing it there is not enough.

Tested. Testcase: "make headers_install" and try to compile this:

        #include <linux/swab.h>
        void main() {}
CC Josh Boyer <[email protected]>
CC Thomas Graf <[email protected]>
CC Peter Zijlstra <[email protected]>
CC David Rientjes <[email protected]>
CC Arnd Bergmann <[email protected]>
CC Ingo Molnar <[email protected]>
CC Andrew Morton <[email protected]>
CC Linus Torvalds <[email protected]>
---
 include/uapi/linux/stddef.h | 4 ++++
 1 file changed, 4 insertions(+)
include/uapi/linux/stddef.h +0 -0
index aa9f104..621fa8a 100644

include/uapi/linux/stddef.h line 5

Quoted 5 lines
include/uapi/linux/stddef.h +4 -0
@@ -1 +1,5 @@
 #include <linux/compiler.h>
+
+#ifndef __always_inline
+#define __always_inline inline
+#endif

This does appear to fix the compile failure, so from that point of view you can add:

if you'd like.

One thing I did notice that is somewhat unrelated is that the installed linux/stddef.h is devoid of any header guards. So it is a file that literally just has the hunk you've patched in and doesn't have the somewhat standard:

#ifndef _UAPI_LINUX_STDDEF_H
#define _UAPI_LINUX_STDDEF_H

...

#endif

I'm not sure how important that is, but it might be nice to add for consistency's sake.

josh