Skip to content
Commit f1f0a0d8 authored by Aaron Ballman's avatar Aaron Ballman
Browse files

Diagnose extensions in 'offsetof'

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm

 made very
clear that it is an UB having type definitions with in offsetof.
Clang supports defining a type as the first argument as a conforming
extension due to how many projects use the construct in C99 and earlier
to calculate the alignment of a type. GCC also supports defining a type
as the first argument.

This adds extension warnings and documentation for the functionality
Clang explicitly supports.

Fixes #57065

Co-authored-by: default avatarYingchi Long <i@lyc.dev>
Co-authored-by: default avatarAaron Ballman <aaron@aaronballman.com>
parent 09e44499
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment