From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id zMKcNLrrs2NEcA4AWB0awg (envelope-from ) for ; Tue, 03 Jan 2023 03:47:54 -0500 Received: by simark.ca (Postfix, from userid 112) id CCBB01E222; Tue, 3 Jan 2023 03:47:54 -0500 (EST) 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=Ct0CC6rn; 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=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, 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 7CF8D1E0D3 for ; Tue, 3 Jan 2023 03:47:54 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A35D93858D39 for ; Tue, 3 Jan 2023 08:47:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A35D93858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672735673; bh=wsN0HB//PgeRPvQk0PVEvknx35tYhpWKf2XvYxCLBC0=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Ct0CC6rnx2pQ0T6QFds1ZG1t6j2uGqIkMFoev1KnVd3nym6jWL5p9s1VijD9CtShW kT5IQtP7b10VTyrn6NNKBIkCRd/Xv2/k/4OmEtUi0yPW6UGFTCvmJjBg1oyk23qBAe 7iPr/LRWKrBZNKlOU5tyX7p5RtmfsRJA5u3mE8mo= Received: from mail-sender-0.a4lg.com (mail-sender-0.a4lg.com [IPv6:2401:2500:203:30b:4000:6bfe:4757:0]) by sourceware.org (Postfix) with ESMTPS id 8353E3858D1E for ; Tue, 3 Jan 2023 08:47:33 +0000 (GMT) Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail-sender-0.a4lg.com (Postfix) with ESMTPSA id 0A9A6300089; Tue, 3 Jan 2023 08:47:30 +0000 (UTC) Message-ID: <96f61a59-4277-e4d5-0d6f-08d80a082add@irq.a4lg.com> Date: Tue, 3 Jan 2023 17:47:24 +0900 Mime-Version: 1.0 Subject: Re: [PATCH v3 4/5] sim: Check known getopt definition existence To: Mike Frysinger Cc: gdb-patches@sourceware.org References: <7d854320-af79-cb95-1ec1-1de634e1f5b9@irq.a4lg.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: Tsukasa OI via Gdb-patches Reply-To: Tsukasa OI Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2023/01/03 12:12, Mike Frysinger wrote: > 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 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). >> >> 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 I'm really sorry. Due to my poor health condition and upcoming relocation, it's difficult to keep up with Binutils/GDB until... April or May. But this is definitely the one I should have done before I get so busy (and messy). I'll submit a patch by Jan 6. Tsukasa