[all-commits] [llvm/llvm-project] f1f0a0: Diagnose extensions in 'offsetof'
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Tue Jan 17 11:31:21 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f1f0a0d8e8fdd2e534d9423b2e64c6b8aaa53aee
https://github.com/llvm/llvm-project/commit/f1f0a0d8e8fdd2e534d9423b2e64c6b8aaa53aee
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2023-01-17 (Tue, 17 Jan 2023)
Changed paths:
M clang/docs/LanguageExtensions.rst
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticGroups.td
M clang/include/clang/Basic/DiagnosticParseKinds.td
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Parse/Parser.h
M clang/include/clang/Parse/RAIIObjectsForParser.h
M clang/include/clang/Sema/Sema.h
M clang/lib/Parse/ParseDecl.cpp
M clang/lib/Parse/ParseDeclCXX.cpp
M clang/lib/Parse/ParseExpr.cpp
M clang/lib/Sema/SemaDecl.cpp
M clang/lib/Sema/SemaDeclCXX.cpp
M clang/lib/Sema/SemaTemplate.cpp
A clang/test/C/C2x/n2350.c
M clang/test/C/drs/dr4xx.c
M clang/test/CXX/drs/dr4xx.cpp
M clang/test/Parser/declarators.c
M clang/test/SemaCXX/offsetof.cpp
Log Message:
-----------
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: Yingchi Long <i at lyc.dev>
Co-authored-by: Aaron Ballman <aaron at aaronballman.com>
More information about the All-commits
mailing list