https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119603
Bug ID: 119603
Summary: Weird help output for -Werror
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
Assignee: unassigned at gcc dot gnu.org
Reporter: sandra at gcc dot gnu.org
Target Milestone: ---
I noticed this while working on PR58973.
In common.opt, we have
Werror
Common Var(warnings_are_errors)
Turn all warnings into errors.
Werror=
Common Joined
Turn the specified warning into an error.
and in c-family/c.opt there is
Werror
C ObjC C++ ObjC++
; Documented in common.opt
gcc --help=common prints only the help for the -Werror= form.
gcc --help=c prints help for Werror -- using the description provided by
common.opt.
In the generated options.cc file in the build directory, I see
/* [637] = */ {
"-Werror",
"Turn all warnings into errors.",
NULL,
NULL,
NULL, NULL, N_OPTS, N_OPTS, 6, /* .neg_idx = */ 637,
CL_C | CL_CXX | CL_D | CL_ObjC | CL_ObjCXX | CL_COMMON,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
offsetof (struct gcc_options, x_warnings_are_errors), 0, CLVC_INTEGER, 0,
-1, -1 },
/* [639] = */ {
"-Werror=",
"Turn the specified warning into an error.",
NULL,
NULL,
NULL, NULL, N_OPTS, N_OPTS, 7, /* .neg_idx = */ 639,
CL_COMMON | CL_JOINED,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
(unsigned short) -1, 0, CLVC_STRING, 0, -1, -1 },
which looks to me like it has correctly merged the two entries, so I guess this
is a bug in the code that turns this into --help=common output?
Another weird thing I noticed is that --help=c also prints
-Werror-implicit-function-declaration This switch is deprecated; use
-Werror=implicit-function-declaration instead.
Same as -Werror=.
The "Same as -Werror=." is clearly wrong. The entry for this in c-family/c.opt
says "Alias(Werror=, implicit-function-declaration)" and that is also reflected
in the generated options.cc, so it must be the help printer that is failing to
combine the two pieces of alias information.
Both of these things are probably generic bugs that apply to other options too,
I just happened to notice it because I was looking at tweaking the -Werror
text.