public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Youling Tang <tangyouling@loongson.cn>
To: Pedro Alves <pedro@palves.net>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdbsupport: Remove some unnecessary ifdef HAVE_POLL judgments
Date: Sat, 14 May 2022 09:14:34 +0800	[thread overview]
Message-ID: <98da4669-0d8c-21ec-35c3-76fc6e5bb5cc@loongson.cn> (raw)
In-Reply-To: <497ca477-d498-9c26-f00c-ca8105ee19ed@palves.net>

Hi, Pedro
On 05/13/2022 06:21 PM, Pedro Alves wrote:
> 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?
Thank you for letting me know the design background, this change is not 
needed.

Thanks,
Youling


  reply	other threads:[~2022-05-14  1:14 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
2022-05-14  1:14       ` Youling Tang [this message]
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=98da4669-0d8c-21ec-35c3-76fc6e5bb5cc@loongson.cn \
    --to=tangyouling@loongson.cn \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@palves.net \
    /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).