This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] Avoid gcc specific compiler flags
>> I was talking about the following fragment:
>>
>> + set nowarnings [lsearch -exact $options nowarnings]
>> + if {$nowarnings != -1} {
>> + if [target_info exists gdb,nowarnings_flag] {
>> + set flag "additional_flags=[target_info gdb,nowarnings_flag]"
>> + } else {
>> + set flag "additional_flags=-w"
>> + }
>> + set options [lreplace $options $nowarnings $nowarnings $flag]
>>
>> There's a double $nowarnings on that last line. or is that intentional?
>> In that case I don't understand this code completely, and it needs a
>> comment to explain it.
>
> That's deliberate.
>
> The code replaces the "nowarnings" option with
> additional_flags=[something]
> $nowarnings is the index of the nowarnings option in the list of options.
> The lreplace function replaces a range of list items. In this case we want
> to
> replace a single list element so the start and end of the range are the
> same.
>
> I've added the following comment and applied the patch.
>
> # Replace the "nowarnings" option with the appropriate additional_flags
> # to disable compiler warnings.
That sounds good to me! Please commit.
Mark