Skip to contentSkip to conversation

UAPI: Check headers by compiling all together as C++

RFC Alexey Dobriyan 4 participants 9 messages Sep 5, 2018 – Sep 13, 2018

lore
Share & tools
lore
#0 lore raw
Quoted 9 lines · David Howells
Quoted 5 lines

Here's a set of patches that inserts a step into the build process to make sure that the UAPI headers can all be built together with C++ (if the compiler being used supports C++). All but the final patch perform fixups, including:

Wait, why do we care? What has recently changed to start to directly import kernel uapi files into C++ code?

I think David is seriously trying to compile kernel with C++ compiler and this is first step.

He isn't alone. Resistance is futile. :^)

#1 lore raw
Quoted 7 lines · Alexey Dobriyan
Quoted 7 lines · David Howells
Quoted 5 lines

Here's a set of patches that inserts a step into the build process to make sure that the UAPI headers can all be built together with C++ (if the compiler being used supports C++). All but the final patch perform fixups, including:

Quoted 7 lines
Quoted 2 lines

Wait, why do we care? What has recently changed to start to directly import kernel uapi files into C++ code?

I think David is seriously trying to compile kernel with C++ compiler and this is first step.

He isn't alone. Resistance is futile. :^)

"struct class" is going to be a hard one to overcome :)

#2 lore raw
Quoted 11 lines · Greg KH
Quoted 10 lines · Alexey Dobriyan
Quoted 9 lines · David Howells
Quoted 5 lines

Here's a set of patches that inserts a step into the build process to make sure that the UAPI headers can all be built together with C++ (if the compiler being used supports C++). All but the final patch perform fixups, including:

Wait, why do we care? What has recently changed to start to directly import kernel uapi files into C++ code?

Quoted 6 lines
Quoted 4 lines

I think David is seriously trying to compile kernel with C++ compiler and this is first step.

He isn't alone. Resistance is futile. :^)

"struct class" is going to be a hard one to overcome :)

"struct class" makes you hostis publicus #1 of the Linux++ empire. :^)

#3 lore raw
In reply to Alexey Dobriyan
Quoted 12 lines · Alexey Dobriyan
Quoted 11 lines · Greg KH
Quoted 10 lines · Alexey Dobriyan
Quoted 9 lines · David Howells
Quoted 5 lines

Here's a set of patches that inserts a step into the build process to make sure that the UAPI headers can all be built together with C++ (if the compiler being used supports C++). All but the final patch perform fixups, including:

Wait, why do we care? What has recently changed to start to directly import kernel uapi files into C++ code?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I think David is seriously trying to compile kernel with C++ compiler and this is first step.

He isn't alone. Resistance is futile. :^)

"struct class" is going to be a hard one to overcome :)

"struct class" makes you hostis publicus #1 of the Linux++ empire. :^)

Don't tempt me...

#4 lore raw
Quoted 16 lines · Al Viro
Quoted 15 lines · Alexey Dobriyan
Quoted 14 lines · Greg KH
Quoted 13 lines · Alexey Dobriyan
Quoted 9 lines · David Howells
Quoted 5 lines

Here's a set of patches that inserts a step into the build process to make sure that the UAPI headers can all be built together with C++ (if the compiler being used supports C++). All but the final patch perform fixups, including:

Wait, why do we care? What has recently changed to start to directly import kernel uapi files into C++ code?

I think David is seriously trying to compile kernel with C++ compiler and this is first step.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

He isn't alone. Resistance is futile. :^)

"struct class" is going to be a hard one to overcome :)

"struct class" makes you hostis publicus #1 of the Linux++ empire. :^)

Don't tempt me...

<= g++-8 doesn't support C99 style initializers.
g++-8 mostly does: for example

	.foo = {
		[BAR] = 1,
	},

doesn't work, but regular .foo = 42 does. Additionally, g++ makes noise about order of initializators. C++20 is supposed to make things better.

g++ supports -fpermissive which is a blessing.

clang doesn't support -fpermissive which makes everything way more tedious and it has problems with alternatives (and IIRC vdso code).

Now with gcc version bumped recently I think __attribute__((cleanup)) is supported which makes destructor-like behaviour possible:

	with_spinlock(&p->l) {
		return 0;
	}

	with_mutex(&m) {
	}

	with_rcu() {
	}
#5 lore raw
Quoted 5 lines · Alexey Dobriyan
Quoted 1 line

Don't tempt me...

<= g++-8 doesn't support C99 style initializers.
g++-8 mostly does: for example

Quoted 7 lines
	.foo = {
		[BAR] = 1,
	},

doesn't work, but regular .foo = 42 does. Additionally, g++ makes noise about order of initializators. C++20 is supposed to make things better.

It's too early for AFD postings. And you *are* tempting
me to throw into the tree as many anti-C++ devices as can be done tastefully, just to stop somebody attempting that insanity in the earnest.

#6 lore raw
Quoted 4 lines · Al Viro

It's too early for AFD postings. And you *are* tempting
me to throw into the tree as many anti-C++ devices as can be done tastefully, just to stop somebody attempting that insanity in the earnest.

You would deliberately break the UAPI header files to make sure that they couldn't be used with C++?

David

#7 lore raw
Quoted 9 lines · David Howells
Quoted 4 lines · Al Viro

It's too early for AFD postings. And you *are* tempting
me to throw into the tree as many anti-C++ devices as can be done tastefully, just to stop somebody attempting that insanity in the earnest.

You would deliberately break the UAPI header files to make sure that they couldn't be used with C++?

UAPI - no; userland folks can use INTERCAL, for all I care. Kernel-side, though, it's quite tempting...