aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-object-export.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2025-03-19 19:21:38 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2025-03-19 19:21:38 +0100
commit7ecf468c9a30b5a6da86812b912fe3368437c8b9 (patch)
treebe8034ce8d28561adcb601b4867c7f45deb63ee6 /gcc/rust/rust-object-export.cc
parent12b2c414b6d0e0d1b3d328b58d654c19c30bee8c (diff)
downloadgcc-7ecf468c9a30b5a6da86812b912fe3368437c8b9.zip
gcc-7ecf468c9a30b5a6da86812b912fe3368437c8b9.tar.gz
gcc-7ecf468c9a30b5a6da86812b912fe3368437c8b9.tar.bz2
c: pedwarn on flexible array member initialization with {} for C23+ [PR119350]
Even in C23/C2Y any initialization of flexible array member is still invalid, so we should emit a pedwarn on it. But we no longer do for initialization with {}. The reason is that for C17 and earlier, we already emitted a pedwarn on the {} initializer and so emitting another pedwarn on the flexible array member initialization would be diagnosing the same thing multiple times. In C23 we no longer pedwarn on {}, it is standard. The following patch arranges a pedwarning for that for C23+, so that at least one pedwarning is emitted. So that we don't "regress" from C17 to C23 on nested flexible array member initialization with no -pedantic/-pedantic-errors/-Wpedantic, the patch emits even the initialization of flexible array member in a nested context diagnostic as pedwarn in the {} case, after all, it doesn't cause much trouble, we just ignore it like before, it wouldn't initialize anything. 2025-03-19 Jakub Jelinek <jakub@redhat.com> PR c/119350 * c-typeck.cc (pop_init_level): Don't ignore empty brackets for flag_isoc23, still set constructor_type to NULL in that case but emit a pedwarn_init in that case. * gcc.dg/pr119350-1.c: New test. * gcc.dg/pr119350-2.c: New test. * gcc.dg/pr119350-3.c: New test.
Diffstat (limited to 'gcc/rust/rust-object-export.cc')
0 files changed, 0 insertions, 0 deletions