This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Make language setting tests more robust
Not to belabor the point, but...
On 02/01/2017 10:38 AM, Simon Marchi wrote:
>>
>> +# Set the language and handle possible warnings output by GDB if we
>> select a
>> +# language that differs from the current frame's language.
>> +#
>> +# The first argument is the language to set.
>> +# The second argument is an optional message to be output by the test.
>> +
>> +proc set_language { args } {
>
> Instead of "args", it might be clearer to use a default argument for the
> second arg:
>
> proc set_language { language { message "" } } {
>
> And lower:
>
> if { $message == "" } {
> set message $command
> }
>
> Not sure about the exact TCL syntax, but I think you get the point :).
>
Yes, your syntax looks correct to me. [I was in the process of writing
exactly the same thing.]
Regarding gdb_test_no_output et al, this grokking of args needs to be
banished from the test suite. It adds unnecessary complexity. I would
encourage maintainers to request revision when such a thing is proposed
for the test suite.
As a heads up/reminder, we also have parse_args, which is suitable for
more advanced use cases, involving multiple optional arguments and
flags. mi_make_breakpoint is one such place that demonstrates the use of
this facility.
Keith