[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
Loading
Please sign in to comment