[5/5] gdb: make deprecated_show_value_hack static
Commit Message
The deprecated_show_value_hack function is now only used inside
cli-setshow.c, so lets make the function static to discourage its use
anywhere else.
There should be no user visible changes after this commit
---
gdb/cli/cli-setshow.c | 2 +-
gdb/command.h | 7 +------
2 files changed, 2 insertions(+), 7 deletions(-)
Comments
>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:
Andrew> The deprecated_show_value_hack function is now only used inside
Andrew> cli-setshow.c, so lets make the function static to discourage its use
Andrew> anywhere else.
Andrew> There should be no user visible changes after this commit
FWIW I wouldn't mind if we removed nearly all "show" functions and just
made some variant of deprecated_show_value_hack the standard way to
print things. Instead of munging the help text (which is
i18n-unfriendly) it could just print the option name:
(gdb) show mumble var
Current setting of "mumble variable": 23
For "auto" variables, I guess we'd eventually need to implement that
"second getter" idea and then we could remove even more of these
functions, maybe all of them.
Tom
Tom Tromey <tom@tromey.com> writes:
>>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> Andrew> The deprecated_show_value_hack function is now only used inside
> Andrew> cli-setshow.c, so lets make the function static to discourage its use
> Andrew> anywhere else.
>
> Andrew> There should be no user visible changes after this commit
>
> FWIW I wouldn't mind if we removed nearly all "show" functions and just
> made some variant of deprecated_show_value_hack the standard way to
> print things. Instead of munging the help text (which is
> i18n-unfriendly) it could just print the option name:
>
> (gdb) show mumble var
> Current setting of "mumble variable": 23
I have a branch which I occasionally work on which is filling in all the
missing show functions -- which is the opposite to what you are
suggesting.
Didn't plan to post it anytime soon though, as I only work on it when
I'm /really/ bored.
Thanks,
Andrew
>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes:
>> FWIW I wouldn't mind if we removed nearly all "show" functions and just
>> made some variant of deprecated_show_value_hack the standard way to
>> print things. Instead of munging the help text (which is
>> i18n-unfriendly) it could just print the option name:
>>
>> (gdb) show mumble var
>> Current setting of "mumble variable": 23
Andrew> I have a branch which I occasionally work on which is filling in all the
Andrew> missing show functions -- which is the opposite to what you are
Andrew> suggesting.
Forgot to reply to this when you first sent it.
For me the attraction of removing these is that it simplifies things --
less code, less to get wrong. Maybe it would require us to also
regularize & automate the "auto means xyz in this context" concept, but
that would also be beneficial (I think there's a bug in the Python
component about this). I also don't really mind having a "computer-ish"
output format here, as opposed to natural language text.
However if you want to do it the other way, that's also fine.
Tom
@@ -117,7 +117,7 @@ parse_cli_boolean_value (const char *arg)
}
-void
+static void
deprecated_show_value_hack (struct ui_file *ignore_file,
int ignore_from_tty,
struct cmd_list_element *c,
@@ -656,16 +656,11 @@ extern void complete_on_enum (completion_tracker &tracker,
extern void help_list (struct cmd_list_element *, const char *,
enum command_class, struct ui_file *);
-/* Method for show a set/show variable's VALUE on FILE. If this
- method isn't supplied deprecated_show_value_hack() is called (which
- is not good). */
+/* Method for show a set/show variable's VALUE on FILE. */
typedef void (show_value_ftype) (struct ui_file *file,
int from_tty,
struct cmd_list_element *cmd,
const char *value);
-/* NOTE: i18n: This function is not i18n friendly. Callers should
- instead print the value out directly. */
-extern show_value_ftype deprecated_show_value_hack;
/* Various sets of extra literals accepted. */
extern const literal_def integer_unlimited_literals[];