From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gproxy2-pub.mail.unifiedlayer.com (gproxy2-pub.mail.unifiedlayer.com [69.89.18.3]) by sourceware.org (Postfix) with ESMTPS id D56F13858C66 for ; Tue, 14 Feb 2023 20:23:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D56F13858C66 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw12.mail.unifiedlayer.com (unknown [10.0.90.127]) by progateway4.mail.pro1.eigbox.com (Postfix) with ESMTP id E249C10047A45 for ; Tue, 14 Feb 2023 20:23:40 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id S1q0p6oz0Fh3zS1q0pWfHw; Tue, 14 Feb 2023 20:23:40 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=QpabYX+d c=1 sm=1 tr=0 ts=63ebedcc a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10:nop_charset_1 a=m04uMKEZRckA:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=2Hwf15CJv0IExURGYekA:9 a=QEXdDO2ut3YA:10:nop_charset_2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=To:In-Reply-To:References:Message-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:Subject:Date:From:Sender:Reply-To:Cc: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=MdPpSvPEoSdA/qf/eGYQNvd90RSPu/s7ON6weXCYyIc=; b=hmdJM0SRadGSYzxt4FEHr2OuU1 mVuK6lrmf/XUb3OK4ZyNw+sZkZcjtVv4IuljiSrUSU5F/DCxJEHEwNRgStdPAVTDh1cSKjrDxQpzj fyC6HF1EtJEXz5j3jf/QSoeFY; Received: from 75-166-130-93.hlrn.qwest.net ([75.166.130.93]:49794 helo=[192.168.0.21]) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pS1q0-002zny-Kv for gdb-patches@sourceware.org; Tue, 14 Feb 2023 13:23:40 -0700 From: Tom Tromey Date: Tue, 14 Feb 2023 13:23:33 -0700 Subject: [PATCH 3/6] Change value::m_initialized to bool MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230214-submit-more-value-stuff-v1-3-2fb85efbaa72@tromey.com> References: <20230214-submit-more-value-stuff-v1-0-2fb85efbaa72@tromey.com> In-Reply-To: <20230214-submit-more-value-stuff-v1-0-2fb85efbaa72@tromey.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.12.0 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.130.93 X-Source-L: No X-Exim-ID: 1pS1q0-002zny-Kv X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-130-93.hlrn.qwest.net ([192.168.0.21]) [75.166.130.93]:49794 X-Source-Auth: tom+tromey.com X-Email-Count: 4 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3027.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This changes value::m_initialized to be a bool and updates the various uses. --- gdb/dwarf2/expr.c | 4 ++-- gdb/dwarf2/expr.h | 6 +++--- gdb/value.h | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 60d9bf5f1f9..760c5c4b0d0 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -1496,7 +1496,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr, type *address_type = this->address_type (); this->m_location = DWARF_VALUE_MEMORY; - this->m_initialized = 1; /* Default is initialized. */ + this->m_initialized = true; /* Default is initialized. */ if (this->m_recursion_depth > this->m_max_recursion_depth) error (_("DWARF-2 expression error: Loop detected (%d)."), @@ -2192,7 +2192,7 @@ dwarf_expr_context::execute_stack_op (const gdb_byte *op_ptr, error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always " "be the very last op.")); - this->m_initialized = 0; + this->m_initialized = false; goto no_push; case DW_OP_call2: diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h index 44fc645116a..7a64316160e 100644 --- a/gdb/dwarf2/expr.h +++ b/gdb/dwarf2/expr.h @@ -164,9 +164,9 @@ struct dwarf_expr_context ULONGEST m_len = 0; const gdb_byte *m_data = nullptr; - /* Initialization status of variable: Non-zero if variable has been - initialized; zero otherwise. */ - int m_initialized = 0; + /* Initialization status of variable: True if variable has been + initialized; false otherwise. */ + bool m_initialized = false; /* A vector of pieces. diff --git a/gdb/value.h b/gdb/value.h index 233f42d32a0..41327ebe3b8 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -134,7 +134,7 @@ struct value explicit value (struct type *type_) : m_modifiable (true), m_lazy (true), - m_initialized (1), + m_initialized (true), m_stack (0), m_is_zero (false), m_in_history (false), @@ -338,11 +338,11 @@ struct value /* Set or return field indicating whether a variable is initialized or not, based on debugging information supplied by the compiler. - 1 = initialized; 0 = uninitialized. */ - int initialized () const + true = initialized; false = uninitialized. */ + bool initialized () const { return m_initialized; } - void set_initialized (int value) + void set_initialized (bool value) { m_initialized = value; } /* If lval == lval_memory, return the address in the inferior. If @@ -638,7 +638,7 @@ struct value bool m_lazy : 1; /* If value is a variable, is it initialized or not. */ - unsigned int m_initialized : 1; + bool m_initialized : 1; /* If value is from the stack. If this is set, read_stack will be used instead of read_memory to enable extra caching. */ -- 2.39.1