public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103210] New: "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init]
@ 2021-11-12 12:53 egallager at gcc dot gnu.org
2021-11-12 12:56 ` [Bug c/103210] " egallager at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-11-12 12:53 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/103210] "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init]
2021-11-12 12:53 [Bug c/103210] New: "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init] egallager at gcc dot gnu.org
@ 2021-11-12 12:56 ` egallager at gcc dot gnu.org
2021-11-12 13:01 ` redi at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-11-12 12:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103210
--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
Note that this also applies to the related "excess elements in scalar
initializer" pedwarn at lines 10574-10575 in the same file:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/c/c-typeck.c;h=782414f8c8cb66b155a3cd7432706caed8828b32;hb=HEAD#l10575
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/103210] "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init]
2021-11-12 12:53 [Bug c/103210] New: "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init] egallager at gcc dot gnu.org
2021-11-12 12:56 ` [Bug c/103210] " egallager at gcc dot gnu.org
@ 2021-11-12 13:01 ` redi at gcc dot gnu.org
2021-11-12 13:05 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-12 13:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103210
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #0)
> 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?
Just "many" doesn't make any sense for "too many" IMHO. They mean different
things. The clang name seems poor.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/103210] "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init]
2021-11-12 12:53 [Bug c/103210] New: "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init] egallager at gcc dot gnu.org
2021-11-12 12:56 ` [Bug c/103210] " egallager at gcc dot gnu.org
2021-11-12 13:01 ` redi at gcc dot gnu.org
@ 2021-11-12 13:05 ` redi at gcc dot gnu.org
2021-11-12 13:17 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2021-11-12 13:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103210
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
And GCC already has a distinct "too many braces around scalar initializer"
diagnostic (an error) for the cases covered by that Clang option. I think this
is a different case (although without a proper testcase I'm not sure exactly
what kind of initializer causes the warning).
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/103210] "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init]
2021-11-12 12:53 [Bug c/103210] New: "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init] egallager at gcc dot gnu.org
` (2 preceding siblings ...)
2021-11-12 13:05 ` redi at gcc dot gnu.org
@ 2021-11-12 13:17 ` rguenth at gcc dot gnu.org
2021-11-12 13:23 ` egallager at gcc dot gnu.org
2023-01-06 4:07 ` egallager at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-12 13:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103210
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2021-11-12
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/103210] "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init]
2021-11-12 12:53 [Bug c/103210] New: "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init] egallager at gcc dot gnu.org
` (3 preceding siblings ...)
2021-11-12 13:17 ` rguenth at gcc dot gnu.org
@ 2021-11-12 13:23 ` egallager at gcc dot gnu.org
2023-01-06 4:07 ` egallager at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-11-12 13:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103210
--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> And GCC already has a distinct "too many braces around scalar initializer"
> diagnostic (an error) for the cases covered by that Clang option. I think
> this is a different case (although without a proper testcase I'm not sure
> exactly what kind of initializer causes the warning).
I think that that one is for the C++ front-end, while this one is for the plain
C front-end.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c/103210] "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init]
2021-11-12 12:53 [Bug c/103210] New: "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init] egallager at gcc dot gnu.org
` (4 preceding siblings ...)
2021-11-12 13:23 ` egallager at gcc dot gnu.org
@ 2023-01-06 4:07 ` egallager at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-01-06 4:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103210
--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> ---
Downstream version of this issue:
https://github.com/cooljeanius/apple-gdb-1824/issues/9
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-01-06 4:07 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-12 12:53 [Bug c/103210] New: "warning: braces around scalar initializer" should have a warning flag controlling it [-Wmany-braces-around-scalar-init] egallager at gcc dot gnu.org
2021-11-12 12:56 ` [Bug c/103210] " egallager at gcc dot gnu.org
2021-11-12 13:01 ` redi at gcc dot gnu.org
2021-11-12 13:05 ` redi at gcc dot gnu.org
2021-11-12 13:17 ` rguenth at gcc dot gnu.org
2021-11-12 13:23 ` egallager at gcc dot gnu.org
2023-01-06 4:07 ` egallager at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).