def extend_flag_list(flag_list, new_flags):
    'Extend a list of flags, preserving order and precedence.\n\n    Add new_flags at the end of flag_list.  If any flags in new_flags are\n    already in flag_list, they are moved to the end so that they take\n    higher precedence on the compile line.\n\n    '
    for flag in new_flags:
        if (flag in flag_list):
            flag_list.remove(flag)
        flag_list.append(flag)
Extend a list of flags, preserving order and precedence.

Add new_flags at the end of flag_list.  If any flags in new_flags are
already in flag_list, they are moved to the end so that they take
higher precedence on the compile line.
def extend_flag_list(flag_list, new_flags):
    'Extend a list of flags, preserving order and precedence.\n\n    Add new_flags at the end of flag_list.  If any flags in new_flags are\n    already in flag_list, they are moved to the end so that they take\n    higher precedence on the compile line.\n\n    '
    for flag in new_flags:
        if (flag in flag_list):
            flag_list.remove(flag)
        flag_list.append(flag)