This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] Testsuite: Add gdb_can_simple_compile
>>>>> "Alan" == Alan Hayward <Alan.Hayward@arm.com> writes:
Alan> + } executable {$lang}]
>> This hunk seems incorrect -- it over-quotes $lang. I think instead the
>> {} around that should be removed.
>>
>> This is ok with this fixed (or explained if I'm incorrect :).
Alan> The flags parameter for gdb_can_simple_compile is a list, so I’m passing in {$lang}.
Alan> I don’t think I can pass in just $lang (I’m learning tcl syntax as I write these
Alan> patches, so I’m not sure).
If I did the editing ok the proc looks like:
proc gdb_int128_helper {lang} {
return [gdb_can_simple_compile "i128-for-$lang" {
__int128 x;
int main() { return 0; }
} executable {$lang}]
}
This passes the exact text (without substitution) $lang to
gdb_can_simple_compile, because {} prevents substitutions.
Here's an interactive example:
% proc print {arg} {
puts $arg
}
% print 23
23
% set lang 23
23
% print $lang
23
% print {$lang}
$lang
If you want to pass a list, but have variable values in the list, then
use [list]:
% print [list $lang]
23
(In Tcl a list with a single "simple" element is just the element, which
can be confusing if you look at the actual bits. But if you pretend
there is a type system then it all works out.)
You can see the difference if the list needs quoting:
% set list "a b"
a b
% print $list
a b
% print [list $list]
{a b}
Or:
% llength $list
2
% llength [list $list]
1
Not sure if I'm helping or harming at this point.
Tom