Prune BFD warnings for unknown GNU properties
[deliverable/binutils-gdb.git] / binutils / testsuite / lib / binutils-common.exp
index b1ede4cdf60607c09b62862e0e280565023a5acc..bac140774b02cf86189280f03d4ea936e55b0dbf 100644 (file)
@@ -397,3 +397,50 @@ proc regexp_diff { file_1 file_2 args } {
 
     return $differences
 }
+
+# prune_warnings_extra -- delete extra warnings from TEXT.
+#
+# An example is:
+# ld: warning: /lib64/ld-linux-x86-64.so.2: unsupported GNU_PROPERTY_TYPE (5) type : 0xc0010001
+proc prune_warnings_extra { text } {
+    global experimental
+    # Warnings are only pruned from non-experimental code (ie code not
+    # on a release branch).  For experimental code we want the warnings
+    # as they indicate that the sources need to be updated to recognise
+    # the new properties.
+    if { "$experimental" == "false" } {
+       # The "\\1" is to try to preserve a "\n" but only if necessary.
+       regsub -all "(^|\n)(\[^\n\]*: warning:\[^\n\]*unsupported GNU_PROPERTY_TYPE\[^\n\]*\n?)+" $text "\\1" text
+    }
+    return $text
+}
+
+# This definition is taken from an unreleased version of DejaGnu.  Once
+# that version gets released, and has been out in the world for a few
+# months at least, it may be safe to delete this copy.
+if ![string length [info proc prune_warnings]] {
+    #
+    # prune_warnings -- delete various system verbosities from TEXT
+    #
+    # An example is:
+    # ld.so: warning: /usr/lib/libc.so.1.8.1 has older revision than expected 9
+    #
+    # Sites with particular verbose os's may wish to override this in site.exp.
+    #
+    proc prune_warnings { text } {
+       # This is from sun4's.  Do it for all machines for now.
+       # The "\\1" is to try to preserve a "\n" but only if necessary.
+       regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
+       # It might be tempting to get carried away and delete blank lines, etc.
+       # Just delete *exactly* what we're ask to, and that's it.
+       set text [prune_warnings_extra $text]
+       return $text
+    }
+} elseif { [info procs saved-prune_warnings] == [list] } {
+    rename prune_warnings saved-prune_warnings
+    proc prune_warnings { text } {
+       set text [saved-prune_warnings $text]
+       set text [prune_warnings_extra $text]
+       return $text
+    }
+}
This page took 0.024721 seconds and 4 git commands to generate.