From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id AdjCLdeDSWpIASgAWB0awg (envelope-from ) for ; Sat, 04 Jul 2026 18:06:15 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=WhZYT7Wa; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B6A471E098; Sat, 04 Jul 2026 18:06:15 -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.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 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 399F51E024 for ; Sat, 04 Jul 2026 18:06:15 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6A5624B9DB4D for ; Sat, 4 Jul 2026 22:06:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A5624B9DB4D Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=WhZYT7Wa Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id D6B784BA23DE for ; Sat, 4 Jul 2026 22:05:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D6B784BA23DE Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D6B784BA23DE Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783202724; cv=none; b=I62jEOhO6Jvola29BHlU/+PjNh3Nt40KL/Beiv3xX13A9BbHcqeGvtiikBZa43X8ox6hR+xIV+JOZQWz+Q2BLGUJizPnAEC9QZZ6ieN8BvRqaxzz/G6SJLIlbKyq2a0nzv2cdmGseZVVpoNIbdS1/uJKk79BOd2Fiuruw7z+rgY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783202724; c=relaxed/simple; bh=SsZwdGfHXZcMwX2nhirw89WWnwYfHzbF5tyT7CcQ6GY=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=VMMCOD1zeGfAKprJxpVge0V/FJEaNzB10ptRKqNX70sYoAAyvgG6nKSayWHiKxNui3rVhNERC5dgq7rlszcKQcXuj4waYeBGEfVOsMK7Luq+7d9kC4OB8fawcAjpEp+lRuoEKZUqYCvdDL8rO3TWnpDgVv4wIDKSSx8LFaARHV8= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=WhZYT7Wa reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6B784BA23DE Received: from eig-obgw-6004b.ext.cloudfilter.net ([10.0.30.210]) by cmsmtp with ESMTPS id g1K1whop9jgweg8UEwe6v8; Sat, 04 Jul 2026 22:05:22 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id g8UEwn0kaJzb7g8UEwn1WA; Sat, 04 Jul 2026 22:05:22 +0000 X-Authority-Analysis: v=2.4 cv=Quhe3Uyd c=1 sm=1 tr=0 ts=6a4983a2 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=ItBw4LHWJt0A:10 a=Kr4I2_zn5nk_NQb6_8sA:9 a=QEXdDO2ut3YA:10 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rNDZjoOPnI2D41PD9Cx6G3CuSiRhHq/EU1LL53Xqszk=; b=WhZYT7Wa5z7IS3tAJGWOl+6gGi ZHjV3Uzacr10rcKyMcvJJ7uhpQWIHK5GIZhqkQCpxSVjZrnxSNY0Y7pVWeQb+y1idAFwDJDR6a4vd Tw9o2InNPvretBjtQg9Ref8rB; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:38412 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.2) (envelope-from ) id 1wg8UD-00000000OSH-3cds; Sat, 04 Jul 2026 16:05:21 -0600 From: Tom Tromey Date: Sat, 04 Jul 2026 16:05:16 -0600 Subject: [PATCH 2/9] Return value_print_options from get_no_prettyformat_print_options MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260704-print-opts-cleanup-v1-2-fb54a5112a8d@tromey.com> References: <20260704-print-opts-cleanup-v1-0-fb54a5112a8d@tromey.com> In-Reply-To: <20260704-print-opts-cleanup-v1-0-fb54a5112a8d@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.14.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.225.82 X-Source-L: No X-Exim-ID: 1wg8UD-00000000OSH-3cds X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net ([192.168.122.1]) [75.166.225.82]:38412 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfDujLW+yo/3RkzmLgzvgbOVTyRs0IUEAoajn3q01l9AF5ZyAZI9NLddCY9TqhA99yR08NQDF/AFfoyjGfnwg0aXrPUeRbLzUpFqvbWxntvTymCsF+SCH NU/poPfGfBvOvQZ9uokilN7YEhPDymffKUTxMA72pQ0Dq351/lFT8e9+Ua2w8EaTBeo0IpSOPJhOmRQuNTAavPMvcApl95Kox3o= 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 This changes get_no_prettyformat_print_options to return the value_print_options object. --- gdb/cli/cli-cmds.c | 3 +-- gdb/cp-valprint.c | 3 +-- gdb/mi/mi-cmd-stack.c | 4 +--- gdb/mi/mi-main.c | 8 ++------ gdb/stack.c | 4 ++-- gdb/valprint.c | 13 +++++++------ gdb/valprint.h | 6 +++--- 7 files changed, 17 insertions(+), 24 deletions(-) diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index f5c85dfc352..3aa5f0038a9 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -2702,8 +2702,7 @@ shell_internal_fn (struct gdbarch *gdbarch, if (!language->is_string_type_p (type)) error (_("Argument must be a string.")); - value_print_options opts; - get_no_prettyformat_print_options (&opts); + value_print_options opts = get_no_prettyformat_print_options (); string_file stream; value_print (val, &stream, &opts); diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 349a0d6bf9e..0558cad87c0 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -779,8 +779,7 @@ test_print_fields (gdbarch *arch) gdbarch_byte_order (arch), 0xe9); string_file out; - struct value_print_options opts; - get_no_prettyformat_print_options (&opts); + value_print_options opts = get_no_prettyformat_print_options (); cp_print_value_fields(val, &out, 0, &opts, NULL, 0); SELF_CHECK (out.string () == "{A = false, B = 5, C = true}"); diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 280a08d121e..ce58ab15e7f 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -543,9 +543,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, { try { - struct value_print_options opts; - - get_no_prettyformat_print_options (&opts); + value_print_options opts = get_no_prettyformat_print_options (); opts.deref_ref = true; if (arg->sym->is_argument ()) opts.raw = fp_opts.print_raw_frame_arguments; diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 200d29309ba..b1c42ddfd24 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2491,9 +2491,7 @@ print_variable_or_computed (const char *expression, enum print_values values) uiout->field_stream ("type", stb); if (mi_simple_type_p (val->type ())) { - struct value_print_options opts; - - get_no_prettyformat_print_options (&opts); + value_print_options opts = get_no_prettyformat_print_options (); opts.deref_ref = true; common_val_print (val, &stb, 0, &opts, current_language); uiout->field_stream ("value", stb); @@ -2501,9 +2499,7 @@ print_variable_or_computed (const char *expression, enum print_values values) break; case PRINT_ALL_VALUES: { - struct value_print_options opts; - - get_no_prettyformat_print_options (&opts); + value_print_options opts = get_no_prettyformat_print_options (); opts.deref_ref = true; common_val_print (val, &stb, 0, &opts, current_language); uiout->field_stream ("value", stb); diff --git a/gdb/stack.c b/gdb/stack.c index e084976eabf..5d725803c1e 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -455,7 +455,6 @@ print_frame_arg (const frame_print_options &fp_opts, try { const struct language_defn *language; - struct value_print_options vp_opts; /* Avoid value_print because it will deref ref parameters. We just want to print their addresses. Print ??? for args whose @@ -472,7 +471,8 @@ print_frame_arg (const frame_print_options &fp_opts, else language = current_language; - get_no_prettyformat_print_options (&vp_opts); + value_print_options vp_opts + = get_no_prettyformat_print_options (); vp_opts.deref_ref = true; vp_opts.raw = fp_opts.print_raw_frame_arguments; diff --git a/gdb/valprint.c b/gdb/valprint.c index cf2bc8e135c..0c385f6ad52 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -104,13 +104,14 @@ get_user_print_options (struct value_print_options *opts) *opts = user_print_options; } -/* Initialize *OPTS to be a copy of the user print options, but with - pretty-formatting disabled. */ -void -get_no_prettyformat_print_options (struct value_print_options *opts) +/* See valprint.h. */ + +value_print_options +get_no_prettyformat_print_options () { - *opts = user_print_options; - opts->prettyformat = Val_no_prettyformat; + value_print_options opts = user_print_options; + opts.prettyformat = Val_no_prettyformat; + return opts; } /* See valprint.h. */ diff --git a/gdb/valprint.h b/gdb/valprint.h index 775ff333646..b38af46f344 100644 --- a/gdb/valprint.h +++ b/gdb/valprint.h @@ -147,9 +147,9 @@ extern struct value_print_options user_print_options; /* Initialize *OPTS to be a copy of the user print options. */ extern void get_user_print_options (struct value_print_options *opts); -/* Initialize *OPTS to be a copy of the user print options, but with - pretty-formatting disabled. */ -extern void get_no_prettyformat_print_options (struct value_print_options *); +/* Return a copy of the user print options, but with pretty-formatting + disabled. */ +extern value_print_options get_no_prettyformat_print_options (); /* Return a copy of the user print options, but using FORMAT as the formatting option. */ -- 2.49.0