def drop_bad_flags(flags):
    """
    Drop flags that are problematic for compiling old scipy versions
    """
    if not flags:
        return flags
    return " ".join(x for x in flags.split()
                    if not (x.startswith("-Werror")
                            or x in ("-pedantic-errors",)))