From patchwork Wed May 31 18:06:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 70403 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 844D5385703C for ; Wed, 31 May 2023 18:07:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 844D5385703C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685556430; bh=m+07daGeNZAdZgLfLaXjapcTUd1DSRq4OlXTe3KGKWY=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=PsI3zAUVfr4tNPTIF8oE+7ypcBh6nIMkiqzVutV14RBXj5KrKeqoBNOPJ0PPW/kHF 3rTMp49ms07vJ2uaUIn8FG7s0eDcjndcoLqH/jWVZDqh2dHShOuSxaqo1N3QuVJXDY wY/TfHPC9qPak76dIC49Har3BZsw9UFdKTFcFQ/Q= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 701883858C60 for ; Wed, 31 May 2023 18:06:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 701883858C60 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-623-JeYflZY2O4mr7AoZTOci_A-1; Wed, 31 May 2023 14:06:32 -0400 X-MC-Unique: JeYflZY2O4mr7AoZTOci_A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 74688802A55 for ; Wed, 31 May 2023 18:06:32 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.17.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5230140CFD45; Wed, 31 May 2023 18:06:32 +0000 (UTC) To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [PATCH 1/3] testsuite: move handle-multiline-outputs to before check for blank lines Date: Wed, 31 May 2023 14:06:28 -0400 Message-Id: <20230531180630.3127108-2-dmalcolm@redhat.com> In-Reply-To: <20230531180630.3127108-1-dmalcolm@redhat.com> References: <20230531180630.3127108-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: David Malcolm via Gcc-patches From: David Malcolm Reply-To: David Malcolm Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. --- .../c-c++-common/Wlogical-not-parentheses-2.c | 2 ++ .../gcc.dg/analyzer/malloc-macro-inline-events.c | 5 ----- gcc/testsuite/gcc.dg/missing-header-fixit-5.c | 10 ++++++++-- gcc/testsuite/lib/gcc-dg.exp | 5 +++++ gcc/testsuite/lib/multiline.exp | 7 ++++++- gcc/testsuite/lib/prune.exp | 7 ------- 6 files changed, 21 insertions(+), 15 deletions(-) diff --git a/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c b/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c index ba8dce84f5d..2d9382014c4 100644 --- a/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c +++ b/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-2.c @@ -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; ^~~~ ( ) diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c b/gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c index f08aee626a5..9134bb4781e 100644 --- a/gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c +++ b/gcc/testsuite/gcc.dg/analyzer/malloc-macro-inline-events.c @@ -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) | ^~~~~~~~~ diff --git a/gcc/testsuite/gcc.dg/missing-header-fixit-5.c b/gcc/testsuite/gcc.dg/missing-header-fixit-5.c index 916033c689c..bf44feb24a9 100644 --- a/gcc/testsuite/gcc.dg/missing-header-fixit-5.c +++ b/gcc/testsuite/gcc.dg/missing-header-fixit-5.c @@ -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 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 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 1 | { dg-end-multiline-output "" } */ diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index 4ed4233efff..6475cab46de 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -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 } { diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp index 73621a0bdbd..4c25bb76f43 100644 --- a/gcc/testsuite/lib/multiline.exp +++ b/gcc/testsuite/lib/multiline.exp @@ -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 diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp index cfe427c99ac..8d37b24e59b 100644 --- a/gcc/testsuite/lib/prune.exp +++ b/gcc/testsuite/lib/prune.exp @@ -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