From patchwork Tue Oct 26 21:27:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 1546630 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=UihrWSir; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Hf4gW67cGz9sR4 for ; Wed, 27 Oct 2021 08:28:23 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9E42E3858010 for ; Tue, 26 Oct 2021 21:28:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E42E3858010 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635283701; bh=toWVaC8dqc5jSA7u1cTTuVdRgk/clyVGtqQzjH8li2I=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=UihrWSirR0iMArzblZoCNV56kqC+ul+r/y3nslTNZO4Y6afy5NNapyyAn9E908egm aq7GQ8aY8HNfNA9Iic5VIzpy2HWaoS5os7qfp2LRfvLAO1uTs1j7oWiwRXD0UJxwN0 5Q/ubHpIwmyBsR5dAuu1H/vjIUIpZ2IO8tXdtUt8= 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 [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) 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 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-Patchwork-Original-From: David Malcolm via Gcc-patches From: David Malcolm Reply-To: David Malcolm Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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); } }