[all-commits] [llvm/llvm-project] 5d8aaa: [C2x] Implement support for empty brace initializa...
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Mon Apr 3 12:23:11 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5d8aaad4452f60ba8902e921d9bed606713a8f26
https://github.com/llvm/llvm-project/commit/5d8aaad4452f60ba8902e921d9bed606713a8f26
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2023-04-03 (Mon, 03 Apr 2023)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticCommonKinds.td
M clang/include/clang/Basic/DiagnosticGroups.td
M clang/include/clang/Basic/DiagnosticParseKinds.td
M clang/lib/CodeGen/CGExprAgg.cpp
M clang/lib/Parse/ParseInit.cpp
M clang/lib/Sema/SemaExpr.cpp
M clang/lib/Sema/SemaInit.cpp
A clang/test/C/C2x/n2900_n3011.c
A clang/test/C/C2x/n2900_n3011_2.c
M clang/test/Sema/array-init.c
M clang/test/Sema/complex-init-list.c
M clang/test/Sema/compound-literal.c
M clang/test/Sema/flexible-array-init.c
M clang/test/Sema/gnu-flags.c
M clang/test/Sema/sizeless-1.c
M clang/test/Sema/vla.c
M clang/test/SemaObjC/property.m
M clang/test/SemaOpenCL/intel-subgroup-avc-ext-types.cl
M clang/www/c_status.html
Log Message:
-----------
[C2x] Implement support for empty brace initialization (WG14 N2900 and WG14 N3011)
This implements support for allowing {} to consistently zero initialize
objects. We already supported most of this work as a GNU extension, but
the C2x feature goes beyond what the GNU extension allowed.
The changes in this patch are:
* Removed the -Wgnu-empty-initializer warning group. The extension is
now a C2x extension warning instead. Note that use of
`-Wno-gnu-empty-initializer seems` to be quite low in the wild
(https://sourcegraph.com/search?q=context%3Aglobal+-file%3A.*test.*+%22-Wno-gnu-empty-initializer%22&patternType=standard&sm=1&groupBy=repo
which currently only gives 8 hits total), so this is not expected to
be an overly disruptive change. But I'm adding the clang vendors
review group just in case this expectation is wrong.
* Reworded the diagnostic wording to be about a C2x extension, added a
pre-C2x compat warning.
* Allow {} to zero initialize a VLA
This functionality is exposed as an extension in all older C modes
(same as the GNU extension was), but does *not* allow the extension for
VLA initialization in C++ due to concern about handling non-trivially
constructible types.
Differential Revision: https://reviews.llvm.org/D147349
More information about the All-commits
mailing list