[3/5] Fix weird quoting in stap-probe.c
Checks
| Context |
Check |
Description |
| linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
I found some code in stap-probe.c that split the quoting in a strange
way:
warning (_("unrecognized bitness %s%c' for probe `%s'"),
got_minus ? "`-" : "`", *cur,
Here the leading ` is not part of the format string. I found this odd
and so I split this fix out into its own patch.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34044
---
gdb/stap-probe.c | 4 ++--
gdb/testsuite/gdb.arch/amd64-stap-optional-prefix.exp | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
Comments
> From: Tom Tromey <tom@tromey.com>
> Date: Sat, 22 Aug 2026 14:30:05 -0600
> Cc: Tom Tromey <tom@tromey.com>
>
> I found some code in stap-probe.c that split the quoting in a strange
> way:
>
> warning (_("unrecognized bitness %s%c' for probe `%s'"),
> got_minus ? "`-" : "`", *cur,
>
> Here the leading ` is not part of the format string. I found this odd
> and so I split this fix out into its own patch.
This changes the quoting style of "-7" and the like. As the test
suite shows, it was previously quoted as `-7'. Is there a good reason
for this change? I'm not sure I understand what is weird about this
quoting or ` not being part of the format string. Is this just a
style-preference thing?
On 8/23/26 6:31 AM, Eli Zaretskii wrote:
>> From: Tom Tromey <tom@tromey.com>
>> Date: Sat, 22 Aug 2026 14:30:05 -0600
>> Cc: Tom Tromey <tom@tromey.com>
>>
>> I found some code in stap-probe.c that split the quoting in a strange
>> way:
>>
>> warning (_("unrecognized bitness %s%c' for probe `%s'"),
>> got_minus ? "`-" : "`", *cur,
>>
>> Here the leading ` is not part of the format string. I found this odd
>> and so I split this fix out into its own patch.
>
> This changes the quoting style of "-7" and the like. As the test
> suite shows, it was previously quoted as `-7'. Is there a good reason
> for this change?
I googled this a bit, and came across (
https://www.gnu.org/prep/standards/html_node/Quote-Characters.html#Quote-Characters
):
...
Although GNU programs traditionally used 0x60 (‘`’) for opening and 0x27
(‘'’) for closing quotes, nowadays quotes ‘`like this'’ are typically
rendered asymmetrically, so quoting ‘"like this"’ or ‘'like this'’
typically looks better.
...
> I'm not sure I understand what is weird about this
> quoting or ` not being part of the format string. Is this just a
> style-preference thing?
If we'd leave the quoting style unchanged, I would have preferred:
...
warning (_("unrecognized bitness `%s%c' for probe `%s'"),
got_minus ? "-" : "", *cur,
...
which I find easier to read.
Thanks,
- Tom
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
>> warning (_("unrecognized bitness %s%c' for probe `%s'"),
>> got_minus ? "`-" : "`", *cur,
>>
>> Here the leading ` is not part of the format string. I found this odd
>> and so I split this fix out into its own patch.
Eli> This changes the quoting style of "-7" and the like. As the test
Eli> suite shows, it was previously quoted as `-7'. Is there a good reason
Eli> for this change? I'm not sure I understand what is weird about this
Eli> quoting or ` not being part of the format string. Is this just a
Eli> style-preference thing?
There are two parts to this particular patch.
First, putting the opening quote into an argument string, rather than in
the format string, is a weird choice, IMO.
Second, I am slowly changing gdb to standardize on "..." quoting.
Removing `...' quoting is the first part of this.
Tom
@@ -1304,8 +1304,8 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch)
{
/* We have an error, because we don't expect anything
except 1, 2, 4 and 8. */
- warning (_("unrecognized bitness %s%c' for probe `%s'"),
- got_minus ? "`-" : "`", *cur,
+ warning (_("unrecognized bitness \"%s%c\" for probe \"%s\""),
+ got_minus ? "-" : "", *cur,
this->get_name ().c_str ());
return;
}
@@ -79,7 +79,7 @@ foreach probe_name $normal_probes_names \
with_test_prefix "fail_probe" {
goto_probe "fail_probe"
- gdb_test "print \$_probe_arg0" "warning: unrecognized bitness `-7' for probe `fail_probe'\r\nInvalid probe argument 0 -- probe has 0 arguments available"
+ gdb_test "print \$_probe_arg0" "warning: unrecognized bitness \"-7\" for probe \"fail_probe\"\r\nInvalid probe argument 0 -- probe has 0 arguments available"
}
with_test_prefix "fail2_probe" {