public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] sim, sim/m32c, sim/rl78: Use getopt_long
Date: Mon, 24 Oct 2022 16:51:00 +0900	[thread overview]
Message-ID: <2024f524-35e3-cdc6-8098-a220daf30c23@irq.a4lg.com> (raw)
In-Reply-To: <87sfjhb0r5.fsf@tromey.com>

On 2022/10/22 1:27, Tom Tromey wrote:
>>>>>> Tsukasa OI via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
>> Because of Binutils/GCC hack, getopt on GNU libc (2.25 or before) is
>> currently unusable on sim, causing a regression on CentOS 7.  Getting rid of
>> include/getopt.h is the best solution to avoid hacking
> 
> I don't think we want to do remove this file.  getopt_long is required
> by a bunch of programs in the tree, and is part of libiberty -- but it's
> not in the traditional getopt.h.
> 
> Using getopt_long seems like an improvement though.

Glibc (2.25 or before; not too old to drop support) includes <getopt.h>
from <unistd.h> but this causes <unistd.h> to include Binutils/GCC's
include/getopt.h.  It means, using the filename "getopt.h" in an include
path (-I) itself is a risk.  The only reason it didn't cause a problem
is most of Binutils/GCC components used getopt_long and
getopt_long_only, not plain getopt.

After I started checking getopt in sim/configure (to reduce build
failure on Clang), it became a problem on sim because some sim files
actually use plain getopt.

c.f. Following thread under binutils
<https://sourceware.org/pipermail/binutils/2022-October/123543.html>

> 
>> but as a short-term
>> solution, this commit replaces calls to getopt to call getopt_long.
> 
> I notice you didn't update sim/ppc... why is that?

Because I simply missed that (I grepped "getopt (" and two occurrences
under sim/ppc uses "getopt(" without space between "getopt" and "(" ).

Thanks for spotting that and I'll fix it soon.

Thanks,
Tsukasa

> If those don't have the problem then perhaps we can just use that
> solution, whatever it is.
> 
> Tom
> 

  reply	other threads:[~2022-10-24  7:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3b7e769f-b5e9-4049-786f-d00d997f0280@irq.a4lg.com>
2022-10-18 17:13 ` Tsukasa OI
2022-10-21 16:27   ` Tom Tromey
2022-10-24  7:51     ` Tsukasa OI [this message]
2022-10-25  5:53       ` Tsukasa OI
2022-10-25 16:54       ` Tom Tromey
2022-10-25 17:17         ` Tsukasa OI
2022-10-25 19:42           ` Tom Tromey
2022-10-25  6:27   ` [PATCH v2] sim, sim/{m32c,ppc,rl78}: " Tsukasa OI
2022-10-26  8:59     ` Mike Frysinger
2022-10-26 10:57       ` Tsukasa OI
2022-10-26 16:01         ` Mike Frysinger
2022-10-27  1:29           ` Tsukasa OI
2022-10-26 10:59     ` [PATCH v3] " Tsukasa OI
2022-10-27  1:23       ` [PATCH v4] " Tsukasa OI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024f524-35e3-cdc6-8098-a220daf30c23@irq.a4lg.com \
    --to=research_trasio@irq.a4lg.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).