[PATCH] Make language setting tests more robust

Luis Machado lgustavo@codesourcery.com
Wed Feb 1 23:29:00 GMT 2017


On 02/01/2017 03:50 PM, Keith Seitz wrote:
> 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.

Thanks for the input. Nice to have that in mind for the future. It does 
look slightly convoluted.

>
> 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.

I'll check it out.



More information about the Gdb-patches mailing list