From patchwork Thu Feb 23 17:35:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 65530 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 23A903857437 for ; Thu, 23 Feb 2023 17:36:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 23A903857437 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677173775; bh=B+ECo4feOtTCr40dOmfWODB/57rwrgG73YcAKGT7+3Q=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=HF7ERFbcJ6Bxpdq0R/2ZF+z3lScdWMRvue8eCO7/5UDwYz2h0GVwLuyvigctIhCW2 N5GtTLAOLy5kf02XjGR8g+3JK4NmQDZmW2vWaV2yZEXF6x4Cj9wU/XMEmzc/kCn4o1 SaeMvjPBJgPs2RnjU0iMZ4nDwUec679WFq0iL3xo= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id D0AA53858C00 for ; Thu, 23 Feb 2023 17:35:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0AA53858C00 Received: from smarchi-efficios.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 43D131E221; Thu, 23 Feb 2023 12:35:43 -0500 (EST) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 2/2] gdb: fix -Wsingle-bit-bitfield-constant-conversion warning in z80-tdep.c Date: Thu, 23 Feb 2023 12:35:41 -0500 Message-Id: <20230223173541.51256-2-simon.marchi@efficios.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230223173541.51256-1-simon.marchi@efficios.com> References: <20230223173541.51256-1-simon.marchi@efficios.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3497.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" When building with clang 16, I see: /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:338:32: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] info->prologue_type.load_args = 1; ^ ~ /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:345:36: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] info->prologue_type.critical = 1; ^ ~ /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:351:37: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] info->prologue_type.interrupt = 1; ^ ~ /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:367:36: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] info->prologue_type.fp_sdcc = 1; ^ ~ /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:375:35: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] info->prologue_type.fp_sdcc = 1; ^ ~ /home/smarchi/src/binutils-gdb/gdb/z80-tdep.c:380:35: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] info->prologue_type.fp_sdcc = 1; ^ ~ Fix that by using "unsigned int" as the bitfield's underlying type. Change-Id: I3550a0112f993865dc70b18f02ab11bb5012693d --- gdb/z80-tdep.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c index 9dc24df5ed1c..5c66331efcdf 100644 --- a/gdb/z80-tdep.c +++ b/gdb/z80-tdep.c @@ -98,11 +98,11 @@ struct z80_unwind_cache struct { - int called:1; /* there is return address on stack */ - int load_args:1; /* prologues loads args using POPs */ - int fp_sdcc:1; /* prologue saves and adjusts frame pointer IX */ - int interrupt:1; /* __interrupt handler */ - int critical:1; /* __critical function */ + unsigned int called : 1; /* there is return address on stack */ + unsigned int load_args : 1; /* prologues loads args using POPs */ + unsigned int fp_sdcc : 1; /* prologue saves and adjusts frame pointer IX */ + unsigned int interrupt : 1; /* __interrupt handler */ + unsigned int critical : 1; /* __critical function */ } prologue_type; /* Table indicating the location of each and every register. */