[all-commits] [llvm/llvm-project] e7300e: Diagnose extensions in 'offsetof'
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Wed Jan 18 05:51:38 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e7300e75b51a7e7d4e81975b4be7a6c65f9a8286
https://github.com/llvm/llvm-project/commit/e7300e75b51a7e7d4e81975b4be7a6c65f9a8286
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2023-01-18 (Wed, 18 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/CodeGen/offsetof.c
M clang/test/Parser/declarators.c
M clang/test/Sema/offsetof.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
Reverts the revert of 39da55e8f548a11f7dadefa73ea73d809a5f1729
Co-authored-by: Yingchi Long <i at lyc.dev>
Co-authored-by: Aaron Ballman <aaron at aaronballman.com>
Differential Revision: https://reviews.llvm.org/D133574
More information about the All-commits
mailing list