From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 571FD3858D1E for ; Tue, 3 Jan 2023 03:12:05 +0000 (GMT) Received: by smtp.gentoo.org (Postfix, from userid 559) id E6245340C35; Tue, 3 Jan 2023 03:12:04 +0000 (UTC) Date: Mon, 2 Jan 2023 22:12:03 -0500 From: Mike Frysinger To: Tsukasa OI Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v3 4/5] sim: Check known getopt definition existence Message-ID: References: <7d854320-af79-cb95-1ec1-1de634e1f5b9@irq.a4lg.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="labLT+xhcmfbZaxX" Content-Disposition: inline In-Reply-To: <7d854320-af79-cb95-1ec1-1de634e1f5b9@irq.a4lg.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --labLT+xhcmfbZaxX Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 27 Oct 2022 11:02, Tsukasa OI wrote: > On 2022/10/23 21:16, Mike Frysinger wrote: > > On 06 Oct 2022 06:43, Tsukasa OI wrote: > >> Clang generates a warning if there is a function declaration/definition > >> with zero arguments. Such declarations/definitions without a prototyp= e (an > >> argument list) are deprecated forms of indefinite arguments > >> ("-Wdeprecated-non-prototype"). On the default configuration, it caus= es a > >> build failure (unless "--disable-werror" is specified). > >> > >> include/getopt.h defines some getopt function definitions but one of t= hem > >> has a form "extern int getopt ();". If this form is selected in > >> include/getopt.h, Clang generates a warning and the build fails by def= ault. > >> > >> In really old environments, this getopt definition with no arguments is > >> necessary (because the definition may change between environments). > >> However, this definition is now a cause of problems on modern environm= ents. > >> > >> A good news is, this definition is not always selected (e.g. if used by > >> binutils/*.c). This is because configuration scripts of binutils, gas, > >> gprof and ld tries to find known definition of getopt function is used= and > >> defines HAVE_DECL_GETOPT macro. If this macro is defined when getopt.= h is > >> included, a good form of getopt is used and Clang won't generate warni= ngs. > >> > >> This commit adds a modified portion of ld/configure.ac to find the kno= wn > >> getopt definition. If we could find one (and we *will* in most modern > >> environments), we don't need to rely on the deprecated definition. > >> --- > >> sim/config.h.in | 3 +++ > >> sim/configure | 32 ++++++++++++++++++++++++++++++++ > >> sim/configure.ac | 10 ++++++++++ > >=20 > > this logic belongs in m4/sim_ac_platform.m4, not configure.ac > >=20 > > should leave a comment above the code too indicating that this logic is > > purely for local getopt.h usage, and is copied from other dirs (e.g. the > > binutils files). >=20 > OK, I'll submit a patch to move this portion to > sim/m4/sim_ac_platform.m4 with proper commit message. have you had a chance to fix this up yet ? -mike --labLT+xhcmfbZaxX Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmOznQIACgkQQWM7n+g3 9YHOGQ//V2BZ36VxtThNB0kDDj3+xvS+cC3arlhGiLCkBrzZvqwa++H7WsCEt2oo PEq32DToeggvuICgmHtM8v/Ez0E6KbzHdHC+dPTGdjb+lGNqASEnS1Kl9e5HCVlV rHUsiTDLCnKcxOZhH12I7kS2Bm5n+6vvg6Jz1gCJIRZLAmitVOGpFs8MU9VFMbVA +P00hkyCGF5UvVVl/7nkhkU2YdYUlCeVvzMYaOKEy4uyBK7fwFX/5h7WLMBQo06c N8oO4eAcqYKyfbKCut0BuORVxgmpT5Q8KKQNOOK0IO6rjKG2n9Yn6/7y5236YzhP u2wVpQGmnyKVKBObHHWL8N6kQCy2/+OOuXvI6PF4xTvbYbZuk1UFUrYXr7EZB/AC 9Z9JQQGkm0EVYON71b8Pkm3oIpDoHo5rSIpzb2db8GUW1/qeqW7THhkRmxRWa6Kj cmDTZlhf965+pE8P+AQFQrzPsNfjP+BuzlH2drt68Io2JaDf9wjquZqaabF60alz Sg+a32mbLrM/ILUetQHZHNZccAXu6x7hKAJwNRaeqkH7PZRD7MzswG0pFwJMqCiM 0MIEMUEkOPBVXcdCuislM9yCZa+Wo+Tg60iwOPLEqfxUPiL2RPSUp3mV3ZO+onzT pI5q/Ld6H8WHodyNuaOu454mkOSS63YvkDt17ubMhFOH5yQumuw= =Vvz+ -----END PGP SIGNATURE----- --labLT+xhcmfbZaxX--