From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 89EEF385C33F for ; Thu, 30 Nov 2023 21:08:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 89EEF385C33F 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 89EEF385C33F 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=1701378509; cv=none; b=EFS4A4W7oLlp1LOpfE9LaIP4wNVfweS1M22aXGsWqeUuTUrYaLU1AqP/nEp/UnwzOHoRK2jG/W+DUJas2yA7uMTHMbalgQIqPCV4izqj5OojaXntdlzFpJOKsk832k/r9AQ+kpFqYysscdXziuOWeqeZw4vg6tdWMxJzpsk3DKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701378509; c=relaxed/simple; bh=cAzj+66+BQ6E+QzeYPvVzY8YYfjZqc2Srcxx6Wu9BKs=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=A3sOqWiPYpxaiXmL3VMdPRha3HKk9RmO62ua9Pfv12a0MEhStue43AtcLszWS58MCJJMKO38E9wEDvHdnC1VLPEEuoIDmzAjM1WhdjL/mu0ONL2SouSxidnsP/TAY8IbGHhjBmLr8Nn+hYBYYkcCnfmz8An5VRk7QAWlGnuyFDs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1701378507; bh=cAzj+66+BQ6E+QzeYPvVzY8YYfjZqc2Srcxx6Wu9BKs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=sId42cZtE3Hu+Gp9gzJXGVwvCdecohC3mFb4/nuDju8pdBnBrGbGuqGzNBdUacYiR ChbPncUBXJFT4BFumpcxuH0rjoYwAD/Fsb0++/7iXzr6tBIyqg5O66u1t2OHl/MLhk vqt6ohZMgn1TXDmskBy78MwgPEOToOz2rWTW6xV4= Received: from [172.16.0.146] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id D1B9F1E091; Thu, 30 Nov 2023 16:08:26 -0500 (EST) Message-ID: Date: Thu, 30 Nov 2023 16:08:26 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/8] Use C++17 [[fallthrough]] attribute Content-Language: fr To: Tom Tromey Cc: PATCH@sourceware.org, More@sourceware.org, gdb-patches@sourceware.org, John Baldwin , Luis Machado , Pedro Alves References: <20231121152817.31859-1-tom@tromey.com> <20231121152817.31859-2-tom@tromey.com> <23d042a3-7f2a-4af3-ab8b-0f43dc0f275e@simark.ca> <87h6l3cawp.fsf@tromey.com> From: Simon Marchi In-Reply-To: <87h6l3cawp.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP,T_FILL_THIS_FORM_SHORT,T_SCC_BODY_TEXT_LINE 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: On 11/30/23 14:13, Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi writes: > > Simon> Are you able to test building on macos? > > No. > > Simon> /Users/jenkins/build/workspace/binutils-gdb_master_macosbuild/platform/macos-amd64/target_board/unix/src/binutils-gdb/gdb/dbxread.c:2809:7: error: fallthrough annotation does not directly precede switch label > Simon> [[fallthrough]]; > Simon> ^ > > Can you try the appended? > > thanks, > Tom > > diff --git a/gdb/dbxread.c b/gdb/dbxread.c > index 99d9fba96ea..4947a8e8193 100644 > --- a/gdb/dbxread.c > +++ b/gdb/dbxread.c > @@ -2808,7 +2808,6 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, > unknown_symtype_complaint (hex_string (type)); > [[fallthrough]]; > > - define_a_symbol: > /* These symbol types don't need the address field relocated, > since it is either unused, or is absolute. */ > case N_GSYM: /* Global variable. */ > @@ -2820,6 +2819,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, > case N_LSYM: /* Local symbol in stack. */ > case N_PSYM: /* Parameter variable. */ > case N_LENG: /* Length of preceding symbol type. */ > + define_a_symbol: > if (name) > { > int deftype; Yeah this works. But you can also move the fallthrough so it's below the regular label, so that that label stays closer to the code using it (even though this dbxread code looks like a big spaghetti mess anyway). Here's a patch that fixes that, plus another instance. LGTY? >From 6556f153e81d1870f11c7de1fbc82c166d80ddbe Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 30 Nov 2023 15:59:16 -0500 Subject: [PATCH] gdb: fix warnings about invalid [[fallthrough]] usage Fix these two warnings, when building on macos: CXX cp-name-parser.o /Users/smarchi/src/binutils-gdb/gdb/cp-name-parser.y:1644:7: error: fallthrough annotation does not directly precede switch label [[fallthrough]]; ^ CXX dbxread.o /Users/smarchi/src/binutils-gdb/gdb/dbxread.c:2809:7: error: fallthrough annotation does not directly precede switch label [[fallthrough]]; ^ In these two cases, we [[fallthrough]], followed by a regular label, followed by a case label. Move the [[fallthrough]] below the regular label. Change-Id: If4a3145139e050bdb6950c7f239badd5778e6f64 --- gdb/cp-name-parser.y | 2 +- gdb/dbxread.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y index 9a359d47b65c..6f9305e15df7 100644 --- a/gdb/cp-name-parser.y +++ b/gdb/cp-name-parser.y @@ -1641,9 +1641,9 @@ yylex (YYSTYPE *lvalp, cpname_state *state) state->lexptr++; return '-'; } - [[fallthrough]]; try_number: + [[fallthrough]]; case '0': case '1': case '2': diff --git a/gdb/dbxread.c b/gdb/dbxread.c index 99d9fba96ea9..ebfd48e29cd9 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -2806,9 +2806,9 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name, case N_NBSTS: case N_NBLCS: unknown_symtype_complaint (hex_string (type)); - [[fallthrough]]; define_a_symbol: + [[fallthrough]]; /* These symbol types don't need the address field relocated, since it is either unused, or is absolute. */ case N_GSYM: /* Global variable. */ base-commit: d5835df2eebf8e9cd3ae35b683c831c2a16a5269 -- 2.43.0