]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite: move handle-multiline-outputs to before check for blank lines
authorDavid Malcolm <dmalcolm@redhat.com>
Thu, 22 Jun 2023 01:48:59 +0000 (21:48 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Thu, 22 Jun 2023 01:48:59 +0000 (21:48 -0400)
I have followup patches that require checking for multiline patterns
that have blank lines within them, so this moves the handling of
multiline patterns before the check for blank lines, allowing for such
multiline patterns.

Doing so uncovers some issues with existing multiline directives, which
the patch fixes.

gcc/testsuite/ChangeLog:
* c-c++-common/Wlogical-not-parentheses-2.c: Split up the
multiline directive.
* gcc.dg/analyzer/malloc-macro-inline-events.c: Remove redundant
dg-regexp directives.
* gcc.dg/missing-header-fixit-5.c: Split up the multiline
directives.
* lib/gcc-dg.exp (gcc-dg-prune): Move call to
handle-multiline-outputs from prune_gcc_output to here.
* lib/multiline.exp (dg-end-multiline-output): Move call to
maybe-handle-nn-line-numbers from prune_gcc_output to here.
* lib/prune.exp (prune_gcc_output): Move calls to
maybe-handle-nn-line-numbers and handle-multiline-outputs from
here to the above.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c
gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c
gcc/testsuite/gcc.dg/missing-header-fixit-5.c
gcc/testsuite/lib/gcc-dg.exp
gcc/testsuite/lib/multiline.exp
gcc/testsuite/lib/prune.exp

index ba8dce84f5dfb5346543b230c7261eb5af8eca2a..2d9382014c43a323cc7b43a3be315f09b66d3b9f 100644 (file)
@@ -12,6 +12,8 @@ foo (int aaa, int bbb)
 /* { dg-begin-multiline-output "" }
    r += !aaa == bbb;
              ^~
+   { dg-end-multiline-output "" } */
+/* { dg-begin-multiline-output "" }
    r += !aaa == bbb;
         ^~~~
         (   )
index f08aee626a5e02af6d8f6b13dd099d4ef5fb372f..9134bb4781e5549f448889e498c3c2de062e185d 100644 (file)
@@ -12,11 +12,6 @@ int test (void *ptr)
   WRAPPED_FREE (ptr); /* { dg-message "in expansion of macro 'WRAPPED_FREE'" } */
   WRAPPED_FREE (ptr); /* { dg-message "in expansion of macro 'WRAPPED_FREE'" } */
 
-  /* Erase the spans indicating the header file
-     (to avoid embedding path assumptions).  */
-  /* { dg-regexp "\[^|\]+/malloc-macro.h:\[0-9\]+:\[0-9\]+:" } */
-  /* { dg-regexp "\[^|\]+/malloc-macro.h:\[0-9\]+:\[0-9\]+:" } */
-
   /* { dg-begin-multiline-output "" }
    NN | #define WRAPPED_FREE(PTR) free(PTR)
       |                           ^~~~~~~~~
index 916033c689c90dcc8597a7a5bfa5f55e029d771d..bf44feb24a9f028481581641511be2b4a3caaf6d 100644 (file)
@@ -12,14 +12,18 @@ foo (char *m, int i)
   /* { dg-begin-multiline-output "" }
    11 |   if (isdigit (m[0]))
       |       ^~~~~~~
+     { dg-end-multiline-output "" } */
+  /* { dg-begin-multiline-output "" }
   +++ |+#include <ctype.h>
     1 | 
      { dg-end-multiline-output "" } */
     {
       return abs (i); /* { dg-warning "implicit declaration of function" } */
   /* { dg-begin-multiline-output "" }
-   19 |       return abs (i);
+   21 |       return abs (i);
       |              ^~~
+     { dg-end-multiline-output "" } */
+  /* { dg-begin-multiline-output "" }
   +++ |+#include <stdlib.h>
     1 | 
      { dg-end-multiline-output "" } */
@@ -27,8 +31,10 @@ foo (char *m, int i)
   else
     putchar (m[0]); /* { dg-warning "implicit declaration of function" } */
   /* { dg-begin-multiline-output "" }
-   28 |     putchar (m[0]);
+   32 |     putchar (m[0]);
       |     ^~~~~~~
+     { dg-end-multiline-output "" } */
+  /* { dg-begin-multiline-output "" }
   +++ |+#include <stdio.h>
     1 | 
      { dg-end-multiline-output "" } */
index 01c8c022a0377191de7988833381a2c24f612d14..28529f57ef60275ce9df6f710b798582a5038d87 100644 (file)
@@ -364,6 +364,11 @@ proc gcc-dg-prune { system text } {
     # Always remember to clear it in .exp file after executed all tests.
     global dg_runtest_extra_prunes
 
+    # Call into multiline.exp to handle any multiline output directives.
+    # This is done before the check for blank lines so that multiline
+    # output directives can have blank lines within them.
+    set text [handle-multiline-outputs $text]
+
     # Complain about blank lines in the output (PR other/69006)
     global allow_blank_lines
     if { !$allow_blank_lines } {
index 73621a0bdbdc3fd7091d734cbfbb7f26760a4c96..4c25bb76f43789587dd87b60861e768ac55412ad 100644 (file)
@@ -139,7 +139,7 @@ proc dg-end-multiline-output { args } {
     verbose "within dg-end-multiline-output: multiline_expected_outputs: $multiline_expected_outputs" 3
 }
 
-# Hook to be called by prune.exp's prune_gcc_output to
+# Hook to be called by gcc-dg.exp's gcc-dg-prune to
 # look for the expected multiline outputs, pruning them,
 # reporting PASS for those that are found, and FAIL for
 # those that weren't found.
@@ -149,6 +149,11 @@ proc dg-end-multiline-output { args } {
 proc handle-multiline-outputs { text } {
     global multiline_expected_outputs
     global testname_with_flags
+
+    # If dg-enable-nn-line-numbers was provided, then obscure source-margin
+    # line numbers by converting them to "NN" form.
+    set text [maybe-handle-nn-line-numbers $text]
+    
     set index 0
     foreach entry $multiline_expected_outputs {
        verbose "  entry: $entry" 3
index cfe427c99ace32de0e54cbd553f06d52d8443018..8d37b24e59ba1d5fc441cce042bf1d6812b229c6 100644 (file)
@@ -108,13 +108,6 @@ proc prune_gcc_output { text } {
     # Many tests that use visibility will still pass on platforms that don't support it.
     regsub -all "(^|\n)\[^\n\]*lto1: warning: visibility attribute not supported in this configuration; ignored\[^\n\]*" $text "" text
 
-    # If dg-enable-nn-line-numbers was provided, then obscure source-margin
-    # line numbers by converting them to "NN" form.
-    set text [maybe-handle-nn-line-numbers $text]
-    
-    # Call into multiline.exp to handle any multiline output directives.
-    set text [handle-multiline-outputs $text]
-
     #send_user "After:$text\n"
 
     return $text