From: Pedro Alves <pedro@palves.net>
To: Youling Tang <tangyouling@loongson.cn>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdbsupport: Remove some unnecessary ifdef HAVE_POLL judgments
Date: Fri, 13 May 2022 11:21:55 +0100 [thread overview]
Message-ID: <497ca477-d498-9c26-f00c-ca8105ee19ed@palves.net> (raw)
In-Reply-To: <182b2afa-d1ac-510b-b454-f81a98a51598@loongson.cn>
On 2022-05-13 11:09, Youling Tang wrote:
> Hi, Pedro
>
> On 05/13/2022 05:28 PM, Pedro Alves wrote:
>> On 2022-05-13 08:49, Youling Tang wrote:
>>> By searching event-loop.cc we found that there are only the following 2
>>> places to assign values to use_poll,
>>> $ grep -nr use_poll gdbsupport/event-loop.cc
>>> 88:static unsigned char use_poll = USE_POLL;
>>> 263: use_poll = 0;
>>>
>>> This USE_POLL is defined as follows,
>>> #ifdef HAVE_POLL
>>> #define USE_POLL 1
>>> #else
>>> #define USE_POLL 0
>>> #endif
>>>
>>> So use_poll may be 1 only if HAVE_POLL is defined. Removed "ifdef
>>> HAVE_POLL" judgment in use_poll control block.
>>>
>>> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
>> Maybe I'm missing something, but ISTM this can't possible work on hosts that don'
>> have poll at all. Like e.g., mingw:
>>
>> $ grep POLL *
>> config.h:/* #undef HAVE_POLL */
>> config.h:/* #undef HAVE_POLL_H */
>> config.h:/* #undef HAVE_SYS_POLL_H */
>>
>> Surely they'll fail to compile after the patch?
> You are right my oversight.
>
> But we can remove these internal_error handling, similar to the following modification:
We can remove _every_ internal_error call in GDB, since by design, they are not supposed
to ever execute, unless we have something wrong. This is the scenario here, guarding against
someone mistakenly doing that change that would result in use_poll as 1 on a host that doesn't
support poll. Why change it?
next prev parent reply other threads:[~2022-05-13 10:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-13 7:49 Youling Tang
2022-05-13 9:28 ` Pedro Alves
2022-05-13 10:09 ` Youling Tang
2022-05-13 10:21 ` Pedro Alves [this message]
2022-05-14 1:14 ` Youling Tang
2022-05-16 9:31 ` [PATCH] gdbsupport/even-loop.cc: simplify !HAVE_POLL paths Pedro Alves
2022-05-16 12:13 ` Youling Tang
2022-05-16 15:24 ` Tom Tromey
2022-05-16 19:01 ` [ob/pushed] Reindent gdbsupport/event-loop.cc:handle_file_event (Re: [PATCH] gdbsupport/even-loop.cc: simplify !HAVE_POLL paths) Pedro Alves
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=497ca477-d498-9c26-f00c-ca8105ee19ed@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
--cc=tangyouling@loongson.cn \
/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).