From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by sourceware.org (Postfix) with ESMTPS id E88BB38485AF for ; Fri, 13 May 2022 10:21:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E88BB38485AF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f45.google.com with SMTP id q23so10814972wra.1 for ; Fri, 13 May 2022 03:21:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=z2w7CPcTB7N7/kda2IrkyAQ6GPyg8uYNQswvb+3L/Lk=; b=nAsPOoFJsECGsMNBr/eBtI78xjXHa8xzcW9GLi5hHtGDxdaFaqp6i0sAoZ3Bv0qD3f 0rDlk/XwFsc+uAqGq+He4WIPrT3fS7bL29dXllKIj+iVrHyIfwuim7bXFxxHIJaMczMD 2GA2o04xSGiWKUMtDdD/3OuNOcAH7WXHMHpdmrMzLNqh4YOBBkXKZ7RpgWktA4+OoQBt xI9y1w+qI4yfE4yYK/tIGKEgsSY3wED+Nw+0hO+tdNB2RKkxvUXvZkpnUN1/o2Zs1moH a3hyOjYqLBut9bCpI6RU2uh9n7W7AuD+R2z3bUCb3bKFU7JSTn4iJUq2Y0wQFtRF2fOf Y93w== X-Gm-Message-State: AOAM531K0Ta09UhgW1D8kV2MwXPeEGRZtt3MIaIVk4gqZ2yzZh7YBWOR 7Cuu/qO2OfcEZPxfiVfNRp0NqkMbl8g= X-Google-Smtp-Source: ABdhPJzQplTsIkTVeT+TzoZ5RtkeXitsBNXFPj62X/xR++ZrwyiR0NVoXl/ZIygNDZeqAni9Td0inw== X-Received: by 2002:a5d:64e3:0:b0:20c:55b4:571b with SMTP id g3-20020a5d64e3000000b0020c55b4571bmr3313527wri.6.1652437317846; Fri, 13 May 2022 03:21:57 -0700 (PDT) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id y15-20020a05600c364f00b003945237fea1sm2103283wmq.0.2022.05.13.03.21.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 May 2022 03:21:57 -0700 (PDT) Message-ID: <497ca477-d498-9c26-f00c-ca8105ee19ed@palves.net> Date: Fri, 13 May 2022 11:21:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] gdbsupport: Remove some unnecessary ifdef HAVE_POLL judgments Content-Language: en-US To: Youling Tang , gdb-patches@sourceware.org References: <20220513074905.21554-1-tangyouling@loongson.cn> <634dfd3e-dca9-3c5a-cf63-2a86ca23e40e@palves.net> <182b2afa-d1ac-510b-b454-f81a98a51598@loongson.cn> From: Pedro Alves In-Reply-To: <182b2afa-d1ac-510b-b454-f81a98a51598@loongson.cn> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2022 10:22:01 -0000 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 >> 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?