http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57482

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Christophe from comment #3)
> Reading target.def is really instructive, but I still do not understand
> (yet) how the optimizations list is built, and how options are
> overwritten... All this is very confusing.

How options are set is a bit of a mess. For fshort-enums, there is the main
definition in the c.opt file, there is the dummy value that denotes
uninitialized in ./opts.c, and toplev.c that calls the target hook if
short_enums is uninitialized. The options help list is built before calling the
target hook, so it probably uses "2" and understands that as "enabled". The way
to fix this is to call process_options before print_specific_help (In fact,
print_specific_help is called too early, --help=optimizers ignores everything
that appears after it in the command-line).

Ideally, the fact that fshort-enums requires a target hook to set its value if
uninitialized should be encoded in the .opt files. And it should not use a
magic uninitialized value "2", but opts_set to test whether the solution was
set.

Reply via email to