https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103210
Bug ID: 103210
Summary: "warning: braces around scalar initializer" should
have a warning flag controlling it
[-Wmany-braces-around-scalar-init]
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: egallager at gcc dot gnu.org
CC: dmalcolm at gcc dot gnu.org, dodji at gcc dot gnu.org,
mpolacek at gcc dot gnu.org
Blocks: 44209
Target Milestone: ---
Example from libopcodes:
xstormy16-opc.c:1013:5: warning: braces around scalar initializer
1013 | { 0|A(ALIAS), { { { (1<<MACH_BASE), 0 } } } }
| ^
git grep says it comes from line 8851 in gcc/c/c-typeck.c:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/c/c-typeck.c;h=782414f8c8cb66b155a3cd7432706caed8828b32;hb=HEAD#l8851
...which has:
warning_init (input_location, 0, "braces around scalar initializer");
If warning_init() works like the other diagnostic functions, I'm assuming the
"0" for the second argument just needs to be changed to a warning flag?
This is an instance of bug 44209. I'm cc-ing the diagnostics maintainers, and
Marek Polacek, since git blame says he was the last to touch the line in
question.
As for a warning name, in bug 95559 it was mentioned that apparently clang
calls this -Wmany-braces-around-scalar-init, so maybe use that?
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44209
[Bug 44209] [meta-bug] Some warnings are not linked to diagnostics options