From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 0F2973858D3C for ; Sun, 16 Oct 2022 13:12:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0F2973858D3C 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 66A3E300089; Sun, 16 Oct 2022 13:12:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=irq.a4lg.com; s=2017s01; t=1665925921; bh=xnUvOLMET4peB7sz8opC3ljS/j2htEh8ud+qDK+De04=; h=Message-ID:Date:Mime-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=Rs1mQGXFS/xr2cqWzpuM32myeKC/gO2XhoTVRLONI0Si76GW9aCq8uhRVYkDBj7z2 S7fH/waV9hn1YKZG3ynUd6XEa7T2VY+NT/vrUu7I8F+G02biDeZ6iOuKHTwgw9AiXk s0xIhSjvkod0/jP+GTV8Ug7jMd/RSbJH3gN85AVo= Message-ID: Date: Sun, 16 Oct 2022 22:12:00 +0900 Mime-Version: 1.0 Subject: Re: [PATCH] include: Declare getopt function on old GNU libc Content-Language: en-US To: Pedro Alves , Tom de Vries Cc: binutils@sourceware.org References: <6e4defd8-b02b-9084-afe6-ba22fe75e3d7@irq.a4lg.com> <8ab93d7a617ad480dd786210f46db0e5aa07d1ac.1665655719.git.research_trasio@irq.a4lg.com> 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,KAM_SHORT,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/13 20:59, Pedro Alves wrote: > On 2022-10-13 11:11 a.m., Tsukasa OI via Binutils wrote: >> On GNU libc <= 2.25, includes with __need_getopt macro >> defined. That is intended to be a part of GNU libc but >> actually includes include/getopt.h in this project. > > Messy. Well, I have to agree. > > Do we really still need this getopt.h header? > > gnulib, at: > > https://www.gnu.org/software/gnulib/manual/html_node/getopt_002eh.html > > says: > > "This header file is missing on some platforms: AIX 5.1, HP-UX 11, MSVC 14." > > AIX 5.1 is from 2001. > HP-UX 11 is from 1997. > We don't support building with MSVC AFAIK. > > Can't we just get rid of it? > I feel this is too unsafe to do that (unless you assume getopt_long and getopt_long_only are always available on the system). Even if this patch is unacceptable, I don't want to revert previous changes to sim/configure{,.ac} either (it's necessary to prevent a build failure with Clang). It's also a hack but to stop using getopt (entirely) may be an option, changing following files: - sim/igen/igen.c - sim/m32c/main.c - sim/rl78/main.c I mean, we could replace getopt with getopt_long plus dummy longopts. This way, CentOS (7) regression will (also) be gone. What do you think? Thanks, Tsukasa