[patch] Avoid gcc specific compiler flags
Paul Brook
paul@codesourcery.com
Tue Mar 7 17:46:00 GMT 2006
> 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.
Paul
More information about the Gdb-patches
mailing list