From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Wb32EVqEsWnoyyMAWB0awg (envelope-from ) for ; Wed, 11 Mar 2026 11:03:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1773241434; bh=tTnOovFJfAmmz18gpkhm2W6IUoLNXgUWdCR8Fnjz7pM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SOiHEIZhdmVAHWKyU/jOt2wtxkqFy+tTab4N0fU1fA1X3OCJrFqborEbjJ0i/6L53 qfrS3Mw+A0dDOzC4Ub6IDsggXJ/fROzpKiGssvucxP/hTYCXIl1cm3udDFERvCNo90 Chl3tdeCoE7hrc026hHXuNWM8ya2nzyBmno34uPQ= Received: by simark.ca (Postfix, from userid 112) id 3820E1E0DD; Wed, 11 Mar 2026 11:03:54 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.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,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED 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=gZK24MaE; dkim-atps=neutral Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 334061E089 for ; Wed, 11 Mar 2026 11:03:53 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 3765E4BB58C2 for ; Wed, 11 Mar 2026 15:03:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3765E4BB58C2 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=gZK24MaE Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 0E79C4BB3BFA for ; Wed, 11 Mar 2026 15:03:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0E79C4BB3BFA 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 0E79C4BB3BFA Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773241407; cv=none; b=lPtxG91KiX9vVtCWfhQ7jVarAC6P/Tm9UjNklVXJwZvcBnhVn4fxcDJM+UJ8aHq5QL6x+TOglzxLZPC5X0+xqNzI6T1tmxSIK0ceU0qS9PyVBQx976+p0YjiKzXIve64GJvCwoMWh1xkiH7+QaT9BXbmeY9ZnfmWAp8BfSKc4T8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773241407; c=relaxed/simple; bh=tTnOovFJfAmmz18gpkhm2W6IUoLNXgUWdCR8Fnjz7pM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=ucDaN6dCPF36bYuB5Is4y0C3YJEaGGt8Az60VKUTK4xBJD6TEien8t3QLjsbE+qFeJfQadLIls3YG8zsQ1No5uzvDl76vIGAbm97NZYuXPW0xHO9SkdXqR+24xJr4vW38hahi7CDnNYs/qze4lhM4oMIj6OWltaayFdlRHMt8e8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0E79C4BB3BFA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1773241405; bh=tTnOovFJfAmmz18gpkhm2W6IUoLNXgUWdCR8Fnjz7pM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=gZK24MaEzzThEqWQbpE4P2QO3ab2HtWBGpH0sEySYYbHVvMB+FBmLNVOx/7NBTMW8 YuXj1JK0LYbm6Qb0uctLX12CRir9tLI5uLYV8q3FN85joIzb6L5vA882Ri9LUAiKz7 ScWyho40oQlWz1doPNo6tJsjxJ5cd4AxoGvn7vp4= Received: by simark.ca (Postfix) id 89D211E089; Wed, 11 Mar 2026 11:03:24 -0400 (EDT) Message-ID: <0762aa68-ad5c-4edc-b1ad-72109e613301@simark.ca> Date: Wed, 11 Mar 2026 11:03:24 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/7] gdb: introduce rgb_color type to simplify existing code To: Tom Tromey , Matthieu Longo Cc: gdb-patches@sourceware.org References: <20260309175624.236491-1-matthieu.longo@arm.com> <20260309175624.236491-2-matthieu.longo@arm.com> <87eclsx0xn.fsf@tromey.com> Content-Language: fr From: Simon Marchi In-Reply-To: <87eclsx0xn.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 3/9/26 3:22 PM, Tom Tromey wrote: >>>>>> Matthieu Longo writes: > >> This patch replaces the raw uint8[3] buffer used to represent RGB values >> with a more convenient wrapper, rgb_color, around std::array. >> It also changes the return type of ui_file_style::color::get_rgb to >> rgb_color instead of filling a caller-provided buffer, and updates all >> callers accordingly. > > One tiny nit. > >> if (target_space == color_space::RGB_24BIT) >> { >> - uint8_t rgb[3]; >> - get_rgb (rgb); >> - return color (rgb[0], rgb[1], rgb[2]); >> + return color (get_rgb ()); >> } > > Since there's only one statement now, the braces should be removed. > > This is ok with this change. > Approved-By: Tom Tromey > > Tom This appears to have caused a build failure on armhf: https://builder.sourceware.org/buildbot/#/builders/72/builds/7402/steps/4/logs/stdio Sample: ../../binutils-gdb/gdb/tui/tui-io.c: In function ‘bool get_color(const ui_file_style::color&, int*)’: ../../binutils-gdb/gdb/tui/tui-io.c:260:38: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [-Werror] 260 | if (init_color (next, rgb[0] * 1000 / 255, rgb[1] * 1000 / 255, | ^ In file included from ./../../binutils-gdb/gdb/ui-file.h:23, from ./../../binutils-gdb/gdb/defs.h:60, from : ./../../binutils-gdb/gdb/ui-style.h:78:22: note: candidate 1: ‘constexpr uint8_t& rgb_color::operator[](std::size_t)’ 78 | constexpr uint8_t &operator[] (std::size_t idx) noexcept | ^~~~~~~~ ../../binutils-gdb/gdb/tui/tui-io.c:260:38: note: candidate 2: ‘operator[](uint8_t* {aka unsigned char*}, int)’ (built-in) 260 | if (init_color (next, rgb[0] * 1000 / 255, rgb[1] * 1000 / 255, | ^ It seems to be because an rgb_color can be implicitly converted to a `uint8_t *`, which can be subscripted, but also has an operator[]. Not sure why the uint8_t* operator is needed, but it compiles fine here if I remove it. If really needed, I think that an explicit method (`.data()`) would be preferable, to avoid unwanted conversions. Simon