re PR other/69006 (Extraneous newline emitted between error messages in GCC 6)
authorJakub Jelinek <jakub@redhat.com>
Fri, 15 Feb 2019 07:52:50 +0000 (08:52 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 15 Feb 2019 07:52:50 +0000 (08:52 +0100)
PR other/69006
PR testsuite/88920
* lib/gcc-dg.exp: If llvm_binutils effective target, set
allow_blank_lines to 2 during initialization.
(dg-allow-blank-lines-in-output): Set allow_blank_lines to 1 only if
it was previously zero.
(gcc-dg-prune): Don't check for llvm_binutils effective target here.
Clear allow_blank_lines afterwards whenever it was 1.
* gdc.test/gdc-test.exp (dmd2dg): Don't call
dg-allow-blank-lines-in-output here.
(gdc-do-test): Set allow_blank_lines to 3 if it is 0 before running
the tests and restore it back at the end.

From-SVN: r268930

gcc/testsuite/ChangeLog
gcc/testsuite/gdc.test/gdc-test.exp
gcc/testsuite/lib/gcc-dg.exp

index 1223b68..6c2a674 100644 (file)
@@ -1,5 +1,18 @@
 2019-02-15  Jakub Jelinek  <jakub@redhat.com>
 
+       PR other/69006
+       PR testsuite/88920
+       * lib/gcc-dg.exp: If llvm_binutils effective target, set
+       allow_blank_lines to 2 during initialization.
+       (dg-allow-blank-lines-in-output): Set allow_blank_lines to 1 only if
+       it was previously zero.
+       (gcc-dg-prune): Don't check for llvm_binutils effective target here.
+       Clear allow_blank_lines afterwards whenever it was 1.
+       * gdc.test/gdc-test.exp (dmd2dg): Don't call
+       dg-allow-blank-lines-in-output here.
+       (gdc-do-test): Set allow_blank_lines to 3 if it is 0 before running
+       the tests and restore it back at the end.
+
        * c-c++-common/ubsan/opts-1.c: New test.
        * c-c++-common/ubsan/opts-2.c: New test.
        * c-c++-common/ubsan/opts-3.c: New test.
index b8b6b40..4ab072d 100644 (file)
@@ -277,9 +277,6 @@ proc dmd2dg { base test } {
     set out_line "// { dg-prune-output .* }"
     puts $fdout $out_line
 
-    # Since GCC 6-20160131 blank lines are not allowed in the output by default.
-    dg-allow-blank-lines-in-output { 1 }
-
     # Compilable files are successful if an output is generated.
     # Fail compilable are successful if an output is not generated.
     # Runnable must compile, link, and return 0 to be successful by default.
@@ -360,6 +357,13 @@ proc gdc-do-test { } {
     # Initialize `dg'.
     dg-init
 
+    # Allow blank linkes in output for all of gdc.test.
+    global allow_blank_lines
+    set save_allow_blank_lines $allow_blank_lines
+    if { !$allow_blank_lines } {
+       set allow_blank_lines 2
+    }
+
     # Create gdc.test link so test names include that subdir.
     catch { file link $subdir . }
 
@@ -430,6 +434,8 @@ proc gdc-do-test { } {
         file delete $filename
     }
 
+    set allow_blank_lines $save_allow_blank_lines
+
     # All done.
     dg-finish
 }
index d4e2d97..c56e8e8 100644 (file)
@@ -344,14 +344,24 @@ proc gcc-dg-test { prog do_what extra_tool_flags } {
 # Global: should blank lines be allowed in the output?
 # By default, they should not be.  (PR other/69006)
 # However, there are some ways for them to validly occur.
+# If this variable is 0, blank lines are not allowed in output,
+# if it is 1, they are allowed for a single testcase only and gcc-dg-prune
+# will clear it again after checking it, if it is 2, they are disabled
+# for all tests.
 set allow_blank_lines 0
 
+if { [check_effective_target_llvm_binutils] } {
+    set allow_blank_lines 2
+}
+
 # A command for use by testcases to mark themselves as expecting
 # blank lines in the output.
 
 proc dg-allow-blank-lines-in-output { args } {
     global allow_blank_lines
-    set allow_blank_lines 1
+    if { !$allow_blank_lines } {
+       set allow_blank_lines 1
+    }
 }
 
 proc gcc-dg-prune { system text } {
@@ -363,12 +373,14 @@ proc gcc-dg-prune { system text } {
 
     # Complain about blank lines in the output (PR other/69006)
     global allow_blank_lines
-    if { !$allow_blank_lines && ![check_effective_target_llvm_binutils]} {
+    if { !$allow_blank_lines } {
        set num_blank_lines [llength [regexp -all -inline "\n\n" $text]]
        if { $num_blank_lines } {
            global testname_with_flags
            fail "$testname_with_flags $num_blank_lines blank line(s) in output"
        }
+    }
+    if { $allow_blank_lines == 1 } {
        set allow_blank_lines 0
     }