From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id AQU8I31S4ml6Ex8AWB0awg (envelope-from ) for ; Fri, 17 Apr 2026 11:32:13 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=J7aBDbuK; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 88C881E0B1; Fri, 17 Apr 2026 11:32:13 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED 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 DE8701E04F for ; Fri, 17 Apr 2026 11:32:12 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 87A044CCCA35 for ; Fri, 17 Apr 2026 15:32:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87A044CCCA35 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=J7aBDbuK Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 60C8D4CCCA28 for ; Fri, 17 Apr 2026 15:30:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60C8D4CCCA28 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 60C8D4CCCA28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776439853; cv=none; b=eGYB21UMxlRqKhI9gDzfhmEG8jTkGK5nxBKU5tYFXGCbJbv6QI2LHlCnLF3z+LTktKtBtV76KeKlX4i5F7CKIJxHkZ/TPQMR14Py73uuKpMDrzuc/jiXLheF1LT3CJewpf1YXSSt9Ykuhle6M65s2ES6tUHuE/mKd9GTBjBTHpM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776439853; c=relaxed/simple; bh=JveZRb0tpk6r1ZrnjOyh12EM0gh1UdsOqN/lT3o5unE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=k8BkjNxYpGHs2dD1Rk9SQvIN7MQq6yNMsHpCi5nl4zk1GHJaCwgwKZSY/5Pqe8kT6pBF1IHQC+EdKWZXWZcgubeXI7+/pbECF3QBaR9WvjGdy3mSkCnCGl0mutC8byMIXXnMv2c24z+kq3zL29GIu2RF1mxaxDNr4DUZaUIIPFE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60C8D4CCCA28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776439853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=atQcBs+MVL1qTxk7j70+//4ttJGzDlhh2WUlB6dlUV0=; b=J7aBDbuK74txvaR7ypR/t+EAcQ3tYgPlex+EWjvi1VPGlXyjvND28zqDIpzE3ng4VqiFFe MYMPBpuTLjfUsGnoCPxEJVqEq80c8QmQwnP2EYUAhw+Wug4NBud8wYVTFslUOytIMIJPZq sKvTdsZaHRzCnGUNcD8ZwX2vEZGmZJI= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-100-z6UUAyulOqG5e_6JJaF4Xg-1; Fri, 17 Apr 2026 11:30:51 -0400 X-MC-Unique: z6UUAyulOqG5e_6JJaF4Xg-1 X-Mimecast-MFC-AGG-ID: z6UUAyulOqG5e_6JJaF4Xg_1776439851 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-43e52dc8a04so684505f8f.3 for ; Fri, 17 Apr 2026 08:30:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776439850; x=1777044650; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=atQcBs+MVL1qTxk7j70+//4ttJGzDlhh2WUlB6dlUV0=; b=nqb2SUS6mCWE2PYHMBibQOcB0lsMVzn4xvO0LN4RhOQ8ItQrcDDsSyoFiuTUYVsfGX XOy5DRqEjeqYGR61TPQT7M+lpWi0X2pBXEb6jhQF9WhanQG5dEb482ThofV3mS1m4mEz bXiT3Gj5CC1xm6/kfZfQZ6ql1LwdFHO84ByRoF3cMzeQDTubIjpHjCZpERO/2l6CNXDk ngVrSu2t2ODI+U4tXLq59o8p00vu/DRK7M5BUypeZaNh+g5VUnDiIwQcdDe0cL9YKzyV Ia4mmk56lXVo8aAifc7Z2LA5zpTmy8C8ZW0quWl6+xzc8fQRPRl9zTrBQ6q6ilylWRoL 490A== X-Gm-Message-State: AOJu0YyRVOuxgPqpb5VfSHt+hUIDWwKjNtv+svgb2VemnUgohayFHmvK TkU3SbBxr+x7c0w45Bok1/bAU4R+zjMUWV+zTlC6WQitaZP0GUDeAzYuWSi00WjKnUyyMXtAAVt WCYyZIrXpfwQvliiJFUuAl3rykIlV4lTIzGAMxMW+2b2Cc8Zm6P3AE5qTBpTSWvD4uB4ld7g= X-Gm-Gg: AeBDietb25ilxh28fKnhsAD/QHL9ynvHijTz5be4IwU+1gIKN8rVMnh7oo88dPwaj6Q OBxK8hUVDhFTI9z3ZFtG53q/fHq8vlcPk0KDOi4UZvhpoMAB6vu2yEc6I/yQMau5CJX9cmhrs6Q qmsXStaUO73izSI4gHHw91sT1IuJWa0N/81MO6XMPTdfiSxLvqw4oN5yrm+aDajZx6racdaM4uX EfWbnO5z6hdo7fXIdR48jKOuz9HTWtaSLSCvs3wlRfMObMAv+IAm4KZfo1J9DkEJVcjSnc0tb6N rK22JpBtJKeQKk359xOQzJA2IyPqyNz4oHgnQD/KWa2Vy0HPZX59sp3mnu6EizzMI0bU+O2yyEa TBskT9VAgmwZq7UhK1IjS+QyeaFE= X-Received: by 2002:a05:6000:18a6:b0:43d:1c59:2dc with SMTP id ffacd0b85a97d-43fe3e0dafemr5282407f8f.28.1776439850222; Fri, 17 Apr 2026 08:30:50 -0700 (PDT) X-Received: by 2002:a05:6000:18a6:b0:43d:1c59:2dc with SMTP id ffacd0b85a97d-43fe3e0dafemr5282334f8f.28.1776439849642; Fri, 17 Apr 2026 08:30:49 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43fe4e4d525sm5035358f8f.31.2026.04.17.08.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2026 08:30:49 -0700 (PDT) From: Andrew Burgess To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] gdb: int to bool in struct entry_info In-Reply-To: <87fr4tty5h.fsf@tromey.com> Date: Fri, 17 Apr 2026 16:30:48 +0100 Message-ID: <87cxzx4n9z.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: su_dWt4okO_UBiKZ2p56xfvCOKB5yf7hhJCrs5Em508_1776439851 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess writes: > > Andrew> Convert 'struct entry_info' to use bool for flag fields. The places > Andrew> where these flags are set are updated too. > > Andrew> There should be no user visible changes after this commit. > > Andrew> - /* Set to 1 iff ENTRY_POINT contains a valid value. */ > Andrew> - unsigned entry_point_p : 1; > Andrew> + /* Set to true iff ENTRY_POINT contains a valid value. */ > Andrew> + bool entry_point_p : 1; > > Andrew> - /* Set to 1 iff this object was initialized. */ > Andrew> - unsigned initialized : 1; > Andrew> + /* Set to true iff this object was initialized. */ > Andrew> + bool initialized : 1; > > I think we should only use bit fields where space is at a premium. > Perhaps when using 'unsigned' here this was done to convey that these > are 1-bit entities? I am not sure. But anyway I think removing the ": > 1" would be an improvement, and since you're touching this line anyway > updating it would be good. Revised patch below. Thanks, Andrew --- commit db24e933773242df7a23159c03b20bf8b509544c Author: Andrew Burgess gdb: int to bool in struct entry_info Convert 'struct entry_info' to use bool for flag fields. The places where these flags are set are updated too. I have also removed the bit width specifier ": 1" from the flag field definitions. There is one entry_info struct per BFD in GDB, which is not a huge number, so forcing the bool fields to 1-bit doesn't seen necessary. There should be no user visible changes after this commit. diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 89ac559ce81..537116e985c 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -115,11 +115,11 @@ struct entry_info /* The index of the section in which the entry point appears. */ int the_bfd_section_index; - /* Set to 1 iff ENTRY_POINT contains a valid value. */ - unsigned entry_point_p : 1; + /* Set to true iff ENTRY_POINT contains a valid value. */ + bool entry_point_p; - /* Set to 1 iff this object was initialized. */ - unsigned initialized : 1; + /* Set to true iff this object was initialized. */ + bool initialized; }; #define SECT_OFF_DATA(objfile) \ diff --git a/gdb/symfile.c b/gdb/symfile.c index d0ea9506c63..d583960d430 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -776,7 +776,7 @@ init_entry_point_info (struct objfile *objfile) if (ei->initialized) return; - ei->initialized = 1; + ei->initialized = true; /* Save startup file's range of PC addresses to help blockframe.c decide where the bottom of the stack is. */ @@ -786,7 +786,7 @@ init_entry_point_info (struct objfile *objfile) /* Executable file -- record its entry point so we'll recognize the startup file because it contains the entry point. */ ei->entry_point = bfd_get_start_address (objfile->obfd.get ()); - ei->entry_point_p = 1; + ei->entry_point_p = true; } else if (bfd_get_file_flags (objfile->obfd.get ()) & DYNAMIC && bfd_get_start_address (objfile->obfd.get ()) != 0) @@ -795,12 +795,12 @@ init_entry_point_info (struct objfile *objfile) runnable. There's no clear way to indicate this, so just check for values other than zero. */ ei->entry_point = bfd_get_start_address (objfile->obfd.get ()); - ei->entry_point_p = 1; + ei->entry_point_p = true; } else { /* Examination of non-executable.o files. Short-circuit this stuff. */ - ei->entry_point_p = 0; + ei->entry_point_p = false; } if (ei->entry_point_p)