Re: FYI: fix PR gdb/8869

Tom Tromey
2009-08-12T22:38:41Z

>>>>> "Pedro" == Pedro Alves <pedro@codesourcery.com> writes:

Sorry for the delay on this.

Pedro> One issue is that "set language" without an argument doesn't show that
Pedro> larger help list of known languages, because the enum command machinary
Pedro> takes care of handling the case of no argument itself. I've moved that
Pedro> listing to "help set language", which I think is a better place for it
Pedro> anyway.

Yeah.

If you put this in you might as well revert my cli-decode.c changes.

Pedro> (add_language): Install or reinstall the "set language" command
Pedro> here, and make it an enum command. Build the enumeration and the
Pedro> help string from the current list of known languages.

This is also ugly, IMO, though differently so. Re-registering the
command means a lot of allocation for something that we could fully know
at build time.

I suppose it would be possible to count the languages and only call
add_setshow_enum_cmd on the last call to add_language.

If we are to compare ugliness (in what units? I suggest negative
helens), though, I would say that yours is the less ugly.

Pedro> Register the "auto" "local" and "unknown" languages in that
Pedro> order.

I was curious to know the rationale for this particular change. If
order matters, this does not seem correct, because nothing guarantees
that _initialize_language will be called before any other call to
add_language. Instead the sorting would have to be done in
add_language. If order does not matter, then there's no need for the
change.

Tom