import re


def strip_useless_warnings(message):
    """Remove some known harmless warnings from an error/warning message."""
    # These are both only issued by pgcc.
    return re.sub(
        r".*\.ld contains output sections; did you forget -T\?"
        r"|.* last line of file ends without a newline.*\s*\^", "", message)