From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id F3F113858D32 for ; Wed, 5 Jul 2023 01:40:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F3F113858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6687446eaccso4658080b3a.3 for ; Tue, 04 Jul 2023 18:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688521230; x=1691113230; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=m5srNhU2R4Ljp7d52Ap+tTslOdKxoJmLpoj/XphKNlU=; b=XdA5ghLYXECBabo5fglYzE3ZuNYmXEVHItG7YAey/TI5BbmSFWKcL1D4/pQa0oWLP8 XRYKZYQINpwj23fvqNqXyV1rR2EOYvpuAjsBxW9YD1M1EzFuZ8NnMBVnaziCSaJD5UWB jbhrZXzZ+C6PYjq7uURKAa8xU932ZT1o+Wmo6ki/LB/T1U/5O1GnPE8xEPXckNR8mfdi UnjAj47l3UBfPQ6EzyjsaD73/NqOuCq4aRkdgB3oZdyTZ4xAlWiLqCweR8FysTPWvyig Tpc6EW2wm671KSD1RFMtfrXegYKtuQyDHLDW2AneK6txe/XAa/h1I69yEWVbhOE3Mv+u 1QxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688521230; x=1691113230; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m5srNhU2R4Ljp7d52Ap+tTslOdKxoJmLpoj/XphKNlU=; b=d4izGb0Bdyy0ksXjLBjWE1VGn23vC8WCINZQh2Wk9yvRT0g8FzCHNY6EfJ4ZDHCU7G Rs3zHy7u18FFnbNSiJgu4CFotoWI9tWrw3wWSPZmxgHCbkWYfQ2OR/28dXf3moPGU4D7 DicKYtweLAs1n5K7u4K6Z8+XyzmOuALEyaYl/o6QDVJdnycsVYwehRSDUlDw5RY1++N4 F1WrqZADHQL5Kaw7VgxtQLrCrcfGZ9X63nCwwJeKOZWHDiWivX0xYmBIzWExrpWGI+2V NUT/09nb0XirKOShacAMd8tFWwCn05Ff2K4k/XCQ/zK2exNM2kADTlWQPcYf+xvBJCfl Ccog== X-Gm-Message-State: AC+VfDx0dlM8jBjjS+sTq/O6sPYrRKIUXAvMemTimFlH7CfRlabFTJOo wO10YfPD11XXKExCorWaVGZ8A1Pxxf76UcbHJQs= X-Google-Smtp-Source: ACHHUZ438xbywnMXotq5Rszpn8cGoQBHankr7kKShtr7HRErX7dA055VDikdpha7MrCR96pte0u5bcjajHhB/Z46uTg= X-Received: by 2002:a05:6a20:8f0f:b0:122:b613:8b2 with SMTP id b15-20020a056a208f0f00b00122b61308b2mr19679537pzk.0.1688521229782; Tue, 04 Jul 2023 18:40:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrew Pinski Date: Tue, 4 Jul 2023 18:40:18 -0700 Message-ID: Subject: Re: Warning specifically for a returning noreturn To: Julian Waters Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,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 List-Id: On Tue, Jul 4, 2023 at 6:32=E2=80=AFPM Julian Waters wrote: > > Hi Andrew, thanks for the quick response, > > What if the method has a return value? I know it sounds counterintuitive,= but in some places HotSpot relies on the noreturn attribute being applied = to methods that do return a value in an unreachable code path. Does the unr= eachable builtin cover that case too? It is wrong to use noreturn on a function other than one which has a return type of void as documented. https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no= return-function-attribute : ``` It does not make sense for a noreturn function to have a return type other than void. ``` Thanks, Andrew Pinski > > best regards. > Julian > > On Wed, Jul 5, 2023 at 9:07=E2=80=AFAM Andrew Pinski = wrote: >> >> On Tue, Jul 4, 2023 at 5:54=E2=80=AFPM Julian Waters via Gcc wrote: >> > >> > Hi all, >> > >> > Currently to disable the warning that a noreturn method does return, i= t's >> > required to disable warnings entirely. This can be very inconvenient w= hen >> > -Werror is enabled with a noreturn method that isn't specifically call= ing >> > something like std::abort() at the end, when one wants all other -Wall= and >> > -Wextra warnings to be reported, for instance in the Java HotSpot VM (= which >> > I'm currently adapting to compile with gcc on all supported platforms)= . Is >> > there a possibility we can add a disable warning option specifically f= or >> > this case? Something like -Wno-returning-noreturn. I'm interested in a= dding >> > this myself if it's not convenient for gcc's maintainers to do so at t= he >> > moment, but I'd need some guidance on where to look and what the relev= ant >> > code is >> >> You could just add >> __builtin_unreachable(); (or std::unreachable(); if you are C++23 or >> unreachable() if you are using C23). >> Or even add while(true) ; >> >> I am pretty sure not having an option is on purpose and not really >> interested in adding an option here because of the above workarounds. >> >> Thanks, >> Andrew Pinski >> >> > >> > best regards, >> > Julian