From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-sender-0.a4lg.com (mail-sender.a4lg.com [153.120.152.154]) by sourceware.org (Postfix) with ESMTPS id AAC663885C35 for ; Thu, 27 Oct 2022 02:02:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AAC663885C35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=irq.a4lg.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=irq.a4lg.com Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 197B8300089; Thu, 27 Oct 2022 02:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1666836140; bh=KH2bpGQJMvUwT7oiOcHadnVgf4JbMHaITlVuawFn+0Q=; h=Message-ID:Date:Mime-Version:Subject:To:References:From: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=t1typYP57E9YeHPzUy0ORja3GBWIKL0fgSnHKbhebAUMrAeUwB5S/u0rKDPPxTjlh lRYTeZll77XzVWXpktaCEXRf/gu9Equb6gm+HxRVWGHln3ykGfNBfCikeUoK6qki2p 1U4jOEzuS+a4qpxgul0Ckb/CGI4aiGL8t/Ch5LAw= Message-ID: <7d854320-af79-cb95-1ec1-1de634e1f5b9@irq.a4lg.com> Date: Thu, 27 Oct 2022 11:02:18 +0900 Mime-Version: 1.0 Subject: Re: [PATCH v3 4/5] sim: Check known getopt definition existence Content-Language: en-US To: Mike Frysinger , gdb-patches@sourceware.org References: From: Tsukasa OI In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,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 List-Id: 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 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). >> >> 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 default. >> >> 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 environments. >> >> 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. >> >> 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 OK, I'll submit a patch to move this portion to sim/m4/sim_ac_platform.m4 with proper commit message. Thanks, Tsukasa