public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Tsukasa OI <research_trasio@irq.a4lg.com>
Cc: Tom de Vries <tdevries@suse.de>,
	Andrew Burgess <aburgess@redhat.com>,
	Pedro Alves <pedro@palves.net>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH v2] sim, sim/{m32c,ppc,rl78}: Use getopt_long
Date: Wed, 26 Oct 2022 14:44:59 +0545	[thread overview]
Message-ID: <Y1j3Dwt+aJ1CvFzI@vapier> (raw)
In-Reply-To: <7ad71357e72129e5dc642a5233868b3aa81c484c.1666679042.git.research_trasio@irq.a4lg.com>

[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]

On 25 Oct 2022 06:27, Tsukasa OI wrote:
> Because of Binutils/GCC hack, getopt on GNU libc (2.25 or earlier) is
> currently unusable on sim, causing a regression on CentOS 7.
> 
> This is caused as follows:
> 
> 1.  If HAVE_DECL_GETOPT is defined (getopt with known prototype is
>     declared), a declaration of getopt in "include/getopt.h" is suppressed.
>     The author started to define HAVE_DECL_GETOPT in sim with the commit
>     340aa4f6872c ("sim: Check known getopt definition existence").
> 2.  GNU libc (2.25 or earlier)'s <unistd.h> includes <getopt.h> to declare
>     getopt function (only, not getopt_long or getopt_long_only) but it
>     causes <unistd.h> to include Binutils/GCC's "include/getopt.h".
> 3.  If both 1. and 2. are satisfied, despite that <unistd.h> tries to
>     declare getopt by including <getopt.h>, "include/getopt.h" does not
>     define one, causing getopt function unusable.
> 
> Getting rid of "include/getopt.h" (e.g. renaming this header file) is the
> best solution to avoid hacking but as a short-term solution, this commit
> replaces getopt with getopt_long under sim/.
> ---
>  sim/igen/igen.c | 6 ++++--
>  sim/m32c/main.c | 5 ++++-
>  sim/ppc/dgen.c  | 6 ++++--
>  sim/ppc/igen.c  | 9 ++++++---
>  sim/rl78/main.c | 4 +++-
>  5 files changed, 21 insertions(+), 9 deletions(-)
> 
> diff --git a/sim/igen/igen.c b/sim/igen/igen.c
> index ba856401fa9..22cfd30ec43 100644
> --- a/sim/igen/igen.c
> +++ b/sim/igen/igen.c
> @@ -989,6 +989,7 @@ main (int argc, char **argv, char **envp)
>    char *real_file_name = NULL;
>    int is_header = 0;
>    int ch;
> +  struct option dummy_longopts = { 0 };

just call it "longopts" so we don't have to rename it in the future if we
decide to actually add long options.  comes up in the other files too.

otherwise lgtm.
-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-10-26 10:14 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 ` [PATCH] sim, sim/m32c, sim/rl78: " Tsukasa OI
2022-10-21 16:27   ` Tom Tromey
2022-10-24  7:51     ` Tsukasa OI
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 [this message]
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=Y1j3Dwt+aJ1CvFzI@vapier \
    --to=vapier@gentoo.org \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    --cc=research_trasio@irq.a4lg.com \
    --cc=tdevries@suse.de \
    /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).