From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTPS id 8E7CF3858033 for ; Tue, 26 Oct 2021 21:27:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8E7CF3858033 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-495-jH2NRpWnOeuQX4OCD2GolA-1; Tue, 26 Oct 2021 17:27:48 -0400 X-MC-Unique: jH2NRpWnOeuQX4OCD2GolA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B8B88180830C for ; Tue, 26 Oct 2021 21:27:47 +0000 (UTC) Received: from t14s.localdomain.com (ovpn-113-202.phx2.redhat.com [10.3.113.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E22319D9D; Tue, 26 Oct 2021 21:27:47 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Subject: [PATCH] assert_streq: add newlines to failure message Date: Tue, 26 Oct 2021 17:27:46 -0400 Message-Id: <20211026212746.671762-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-13.0 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_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Tue, 26 Oct 2021 21:27:52 -0000 Adding newlines so that the two strings line up makes string equality failures considerably easier to read. Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. OK for trunk? gcc/ChangeLog: * selftest.c (assert_streq): Add newlines when emitting non-equal non-NULL strings. Signed-off-by: David Malcolm --- gcc/selftest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/selftest.c b/gcc/selftest.c index 8f1cde0cc19..0db56f3b240 100644 --- a/gcc/selftest.c +++ b/gcc/selftest.c @@ -89,7 +89,7 @@ assert_streq (const location &loc, if (strcmp (val1, val2) == 0) pass (loc, "ASSERT_STREQ"); else - fail_formatted (loc, "ASSERT_STREQ (%s, %s) val1=\"%s\" val2=\"%s\"", + fail_formatted (loc, "ASSERT_STREQ (%s, %s)\n val1=\"%s\"\n val2=\"%s\"\n", desc_val1, desc_val2, val1, val2); } } -- 2.26.3