From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id j89jM0ra4GqkrS8AWB0awg (envelope-from ) for ; Tue, 27 Oct 2026 13:07:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1793120842; bh=rIqYxESTQLEAsmO5Z0Zw0tXd0Vl9zmzAVIdX2JJHURo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=q7qjBJgzYj2jhLwnXuoJXTRXPTygOeHbUVOgBZ2cJvrQpTTtfSNz4kVeyIBs/csSr O92WXFz9tu7MQmVG7Xw/741rittgsmSHOsc/4cjs4yF2aaRmNIB9tO8rBGQDdDwjQn 14NxYbNR3LngmlmljenO7tNV3kkMdgxFqKYYZE1s= Received: by simark.ca (Postfix, from userid 112) id BFE701E033; Tue, 27 Oct 2026 13:07:22 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=aOs0OFv2; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id EF3A31E007 for ; Tue, 27 Oct 2026 13:07:21 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D8B84BA2E38 for ; Tue, 27 Oct 2026 17:07:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D8B84BA2E38 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=aOs0OFv2 Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 1890C4BA2E31; Tue, 27 Oct 2026 17:06:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1890C4BA2E31 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 1890C4BA2E31 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793120792; cv=none; b=C9+s6HGcoTppKWC1vTHaps3i3l10uq2u1iZfJeGOQV7SxQPToCa/1y6qnX+d/nAxTgRvkwcNEeiT4xtuKSPm3fY3txcUKh71+Yy3KKcRvUjapXXRVd2QeiCqLulXW8xaYoGo4p8zqanwhmj7m4sN56OkHwPup6PIN2ABc9LcNpI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793120792; c=relaxed/simple; bh=rIqYxESTQLEAsmO5Z0Zw0tXd0Vl9zmzAVIdX2JJHURo=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=vCSLCSyk9sAEj4X/yS+ZUtU2Jduj6IfXD7O2YP1gxmj3az7ai74Y7kuh5DZsJu7/kdFevve2z0ftpR2j975hEJLBauZxUcumLZ6YrGRPBr5MQUpi6gV9K8w/4shNzZFVH+GHymTNmtzqCVsOrfZXYuuJ4vetXtLBgiGeM98NLdc= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=aOs0OFv2 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1890C4BA2E31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1793120791; bh=rIqYxESTQLEAsmO5Z0Zw0tXd0Vl9zmzAVIdX2JJHURo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=aOs0OFv2nNmKtO5wXrXWvRvVlg1nNX3SUNgRFM6ZQurcEXHojRAhbomdcwaGAFy3m a3jJRAZITisSwDVKkQ5WkJ4YK/XVra+1c1KyVHm11FXw9HEZtOtlSOlWJf95/P9Ofw XASELu6396iJOJB+Z+dSZcKTqHCCLZl/Q+bHv5IQ= Received: by simark.ca (Postfix) id F153B1E007; Tue, 27 Oct 2026 13:06:29 -0400 (EDT) Message-ID: <0b939e47-36e7-4de4-883f-63aa39586ea1@simark.ca> Date: Tue, 27 Oct 2026 13:06:29 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 5/6] gdbsupport/selftest: print operand values when a SELF_CHECK fails To: Tom Tromey , Simon Marchi Cc: gcc-patches@sourceware.org, gdb-patches@sourceware.org References: <20261019165929.792697-1-simon.marchi@efficios.com> <20261019165929.792697-6-simon.marchi@efficios.com> <87qzhbp6xy.fsf@tromey.com> Content-Language: fr From: Simon Marchi In-Reply-To: <87qzhbp6xy.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 10/27/26 10:13 AM, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> Some previously used constructs are now rejected at compile time, and > Simon> require a few changes in the tests: > > Simon> - A top-level && or ||. > > I think this approach is very clever but I'm not really a fan of the result. > It seems completely reasonable to me to want to write || or && in a test. If you really need it (you only really "need" it for ||), you can always add extra parentheses. > Simon> - A lone non-bool value, like SELF_CHECK (ptr). > > This isn't really that weird either. We could make it work, I just chose not to because of our coding style. > Simon> Operands are printed using a value_to_string function that is a long > Simon> series of "if constexpr" to print various types of operands. It ends > Simon> with an always-false static_assert, such that trying to print an > Simon> unsupported type will cause a build failure, and will require telling > Simon> the function how to print said type. > > Why this way and not overloads? I guess you mean templates with SFINAE to select the right printer? If so: because it's easier to understand than separate templated functions, especially the order in which rules are applied. With templates, you have to know the template deduction rules, which isn't obvious. With a single function, the decision tree is right there, easy to follow. > It seems to me that the drawback of this approach is that now the test > framework has to have visibility on every possible thing that could be > printed. We can abstract it somewhat by having the test framework just call `val.to_string()` or `to_string(val)`, and then the specific `to_string` implementations are not known by the test framework. Simon