offsetof() backports for clang-16+

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Greg and Sasha,

Clang 16 (current main, next major release) errors when offsetof() has a
type defintion in it, in response to language in newer C standards
stating it is undefined behavior.

https://github.com/llvm/llvm-project/commit/e327b52766ed497e4779f4e652b9ad237dfda8e6
https://reviews.llvm.org/D133574

While this might be eventually demoted to just a warning, the kernel has
already cleaned up places that had this construct, so we can apply them
to the stable trees and avoid the issue altogether.

Please find attached mbox files for all supported stable trees, which
fix up the relevant instances for each tree using the upstream commits:

55228db2697c ("x86/fpu: Use _Alignof to avoid undefined behavior in TYPE_ALIGN")
09794a5a6c34 ("tracing: Use alignof__(struct {type b;}) instead of offsetof()")

The fpu commit uses _Alignof, which as far as I can tell was only
supported in GCC 4.7.0+. This is not a problem for mainline due to
requiring GCC 5.1.0+ but it could be relevant for old trees like 4.14,
which have an older minimum supported version. I hope people are not
using ancient compilers like that but I suppose if they are using 4.14,
they might just be stuck with old software...

If there are any issues or comments, please let me know.
Nathan

Attachment: 4.14.mbox
Description: application/mbox

Attachment: 4.19.mbox
Description: application/mbox

Attachment: 5.4.mbox
Description: application/mbox

Attachment: 5.10.mbox
Description: application/mbox

Attachment: 5.15.mbox
Description: application/mbox

Attachment: 6.1.mbox
Description: application/mbox


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux