From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id iy8DFS1CVWNUvA8AWB0awg (envelope-from ) for ; Sun, 23 Oct 2022 09:31:25 -0400 Received: by simark.ca (Postfix, from userid 112) id 432631E112; Sun, 23 Oct 2022 09:31:25 -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=XYMujnvp; 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=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED 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 E511F1E0D3 for ; Sun, 23 Oct 2022 09:31:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 90EEC38561A5 for ; Sun, 23 Oct 2022 13:31:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 90EEC38561A5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666531880; bh=YQGqw8J8EO/xTFDLNsxqKrGCw4uvz7DTbJCBm7vnu9U=; 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=XYMujnvpdM5wPsCcu71lgpSoc2fLzCp3aVWRCq7kiwCBCRN92RI6+QAW2+x9vg4kZ Ex2wKc1WdEoGhIWkIzYOPrMUrjbq8W0fCAsCgRQK/hRb01jv8y/MH0ed/cAt6A3uyN Isr0F++OzguTEyowZR/QaK3eUhVMEjT5/a4TzfD8= Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id CFBB03858290 for ; Sun, 23 Oct 2022 13:30:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CFBB03858290 Received: by smtp.gentoo.org (Postfix, from userid 559) id 56ACF3410B9; Sun, 23 Oct 2022 13:30:54 +0000 (UTC) Date: Sun, 23 Oct 2022 18:01:28 +0545 To: Tsukasa OI Subject: Re: [PATCH v3 4/5] sim: Check known getopt definition existence Message-ID: Mail-Followup-To: Tsukasa OI , Andrew Burgess , gdb-patches@sourceware.org References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pToolB9PXcrVMKO1" Content-Disposition: inline In-Reply-To: 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 Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --pToolB9PXcrVMKO1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 prototype (= an > argument list) are deprecated forms of indefinite arguments > ("-Wdeprecated-non-prototype"). On the default configuration, it causes a > build failure (unless "--disable-werror" is specified). >=20 > include/getopt.h defines some getopt function definitions but one of them > has a form "extern int getopt ();". If this form is selected in > include/getopt.h, Clang generates a warning and the build fails by defaul= t. >=20 > 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 environment= s. >=20 > 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 warnings. >=20 > This commit adds a modified portion of ld/configure.ac to find the known > 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 ++++++++++ this logic belongs in m4/sim_ac_platform.m4, not configure.ac 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). -mike --pToolB9PXcrVMKO1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNVMJwACgkQQWM7n+g3 9YFz8g//Yzu5yTFPeN+wHHyvz9fE1+hkWFyi1lx3UjT0FIWeP147q4EaUzNqaTz+ 8Xoh834Lp6yHvsLXi7sYsktqdUGvabcHJtpYX4HvmgKI3Xadwf5dyYjanLRaDBHS DXYr9qtNpwymhXyExFrbow1F6yJhuc3obtv1r3mtbSCSR4YPCGyBscYfxvqvAqzC R1uAHoHGD4Evgg9TnXRMBwJR/9WITDuNk3d0lbXR0gZDJVur/LimR+7sjXpkGCg0 9c9y8qlmnprIllvNclQ73KfmJZ6Dd9dC8btGFV4oWyffw96pTACLi76V2Is+VkRo Ggmby1AMPm8Xte3ztruBch38cGQT4GjQuoM6sl+3IABGgIUqAVoxz85XDmykeJXN eKOiOoygzXDjZa3TsygyVW8R+2NH0ZCnzm+jNktv33N5uQgXWSW93a9O2BI96STM JOnZ/tVlNufZDrwQdp9SmvM9tYEld17mH2UBMtepiJr11ao86+wsbzWkrdQ5B2oP oezETeVbhuKTMrb/L4GxQ0xosewhg6lhe1hgbn6FnCRPpbM0xBTagKcYOEK+ziEw a+g271isHa6OCclcy1w1DoJ+xaVfS/w3MpCCbSJHPQrnr1dflI31HYrxdSlzBkNd Y7dnQMZC7Ot6Idf0ZbCiTDFmfbY2JuMjbTrHvADMxxphENy01FQ= =MNEK -----END PGP SIGNATURE----- --pToolB9PXcrVMKO1--