From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id f5vMHpcIWWP00BAAWB0awg (envelope-from ) for ; Wed, 26 Oct 2022 06:14:47 -0400 Received: by simark.ca (Postfix, from userid 112) id 738A71E11A; Wed, 26 Oct 2022 06:14:47 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=sMxuklqM; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 ESMTPS id 2BD5C1E0D5 for ; Wed, 26 Oct 2022 06:14:47 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C017A385736B for ; Wed, 26 Oct 2022 10:14:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C017A385736B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666779286; bh=rMKDA60RBeJCw60jAu/ltRXMpBM9VSTsYFKkm7WAZx4=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=sMxuklqMUWzv4yzdopuRiPDwV78+9RgI94rEcxS0MiFKX4gj8ILiuGItoV0tqD8Vx zKvGP8dg626FzTxv7sz3XKA+ne+w0Ky4CVTxQo4Amy3rkdsPRgNLQRY/FOgZdd/FcK 9Bo3lJH85Pl2wwOU9wbgvubUbJrfa9lF6kPLR/ak= Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 6CB593858037 for ; Wed, 26 Oct 2022 10:14:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6CB593858037 Received: by smtp.gentoo.org (Postfix, from userid 559) id DE6AD341164; Wed, 26 Oct 2022 10:14:23 +0000 (UTC) Date: Wed, 26 Oct 2022 14:44:59 +0545 To: Tsukasa OI Subject: Re: [PATCH v2] sim, sim/{m32c,ppc,rl78}: Use getopt_long Message-ID: Mail-Followup-To: Tsukasa OI , Tom de Vries , Andrew Burgess , Pedro Alves , gdb-patches@sourceware.org References: <24e83e920d728237c4efe6f4720643d6fbbf1084.1666113214.git.research_trasio@irq.a4lg.com> <7ad71357e72129e5dc642a5233868b3aa81c484c.1666679042.git.research_trasio@irq.a4lg.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MfRL+PxdvudNGv/L" Content-Disposition: inline In-Reply-To: <7ad71357e72129e5dc642a5233868b3aa81c484c.1666679042.git.research_trasio@irq.a4lg.com> 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: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Cc: gdb-patches@sourceware.org, Tom de Vries , Pedro Alves Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --MfRL+PxdvudNGv/L Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 25 Oct 2022 06:27, Tsukasa OI wrote: > Because of Binutils/GCC hack, getopt on GNU libc (2.25 or earlier) is > currently unusable on sim, causing a regression on CentOS 7. >=20 > This is caused as follows: >=20 > 1. If HAVE_DECL_GETOPT is defined (getopt with known prototype is > declared), a declaration of getopt in "include/getopt.h" is suppresse= d. > The author started to define HAVE_DECL_GETOPT in sim with the commit > 340aa4f6872c ("sim: Check known getopt definition existence"). > 2. GNU libc (2.25 or earlier)'s includes to declare > getopt function (only, not getopt_long or getopt_long_only) but it > causes to include Binutils/GCC's "include/getopt.h". > 3. If both 1. and 2. are satisfied, despite that tries to > declare getopt by including , "include/getopt.h" does not > define one, causing getopt function unusable. >=20 > Getting rid of "include/getopt.h" (e.g. renaming this header file) is the > best solution to avoid hacking but as a short-term solution, this commit > replaces getopt with getopt_long under sim/. > --- > sim/igen/igen.c | 6 ++++-- > sim/m32c/main.c | 5 ++++- > sim/ppc/dgen.c | 6 ++++-- > sim/ppc/igen.c | 9 ++++++--- > sim/rl78/main.c | 4 +++- > 5 files changed, 21 insertions(+), 9 deletions(-) >=20 > diff --git a/sim/igen/igen.c b/sim/igen/igen.c > index ba856401fa9..22cfd30ec43 100644 > --- a/sim/igen/igen.c > +++ b/sim/igen/igen.c > @@ -989,6 +989,7 @@ main (int argc, char **argv, char **envp) > char *real_file_name =3D NULL; > int is_header =3D 0; > int ch; > + struct option dummy_longopts =3D { 0 }; just call it "longopts" so we don't have to rename it in the future if we decide to actually add long options. comes up in the other files too. otherwise lgtm. -mike --MfRL+PxdvudNGv/L Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNY9w8ACgkQQWM7n+g3 9YEqKA/+LXiuJ6OQvCVt2qzb9xfe1YMOwbwWoM166ZFMOnqEbaaljjeK1+v6Gchr yuMlJ/GF8WTsxEZZmfl9ANtNma6aYbEcMmGz3sFgJexPxmJzjs0zXgbSC+9w88pB CZCp3MgNABoJqhv0+i4nskoS6+VlPAWxrcPwDWnMdhX2rn9ONnBl6lfmr5ot8tcI ac1vB3FT5+THBtTQq3ACiwxytpTsdnDT3BGUFKu7pfUBAgOrtON+99JE8J60UPva WnWGFDTPDKmkHyXIpmmLpDf+Mpx52WQGOfwcTiG2BJhd0HTCHTyM7BqyM7HbBi0B 82qk1fc+aPSYHxPeD+psU881HaOsjicm/QjyQwqPeiUDJBTvXWq2qWfOE2E0XN1m lxeYzn63VIRgNACSgFMDukDXUzjw+IsvjDUlhTdLL2fk/dpCQV4lsEUmgghxPjnR mphrcjXlKkGSng2sAZDxXtPSAlrEXfRnHo7UhfypmSkXLJ068wTEgHUeWTqGmC9H j27HQ/AudJPD6BhcWsJRvIK/rZa76g6YbZINR5VuQ+jLTJr12S+qAV7bnAYxTeVe bPSiwTbg4mfGbUvQUXC0d0VwN6u0mjN/UAX/6GBaahzySYnzPNMXfzqJhPRVkkdU nPu28cEShnjRIf9wWMJY7GApAo6fYC7TMb1r5RZUVGsrIBgMCcA= =Z3ZX -----END PGP SIGNATURE----- --MfRL+PxdvudNGv/L--