From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D73C73858C55 for ; Thu, 13 Oct 2022 21:16:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D73C73858C55 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665695765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k4UrxmMcm1OK3SqVhvjiYwBqzLvFnOW5PCbnyeT4s5c=; b=WtkitF4tog7eOWgz2KznKLkkvgEjtf7vCSQ01Oe+SLETFBgivtKbQzw2t3gMN4Y0OSmwIM RbeniKLuF4QjW4ICOqdmV6o3wg994G85sEElo/SKvQqCAid1/XnfcSYkDQRbVpsNmpyfJF jbzgheLxzNlDToHS0oqdQfvwjSkDu3Q= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-622-ii80BE2gMaa8iDPSsKFRhg-1; Thu, 13 Oct 2022 17:16:04 -0400 X-MC-Unique: ii80BE2gMaa8iDPSsKFRhg-1 Received: by mail-qt1-f199.google.com with SMTP id f19-20020ac84713000000b00397692bdaecso2466997qtp.22 for ; Thu, 13 Oct 2022 14:16:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=k4UrxmMcm1OK3SqVhvjiYwBqzLvFnOW5PCbnyeT4s5c=; b=XiHztLV4RJvUs0dpIs1+PvOlxIFB7VWp3rOr9Co6H7W/Mz67bp/VP2MhA+SPN0Pw6M s5eJUSl0yLOCvnCwVQQcK3zth8KdjxKCS/WfRrsKNptVnoyVqHQCyqgz78iIvkJQaNfO 2/qTAz56Fu+zsRP+SERiSqZl9CeShTeaqxoIwC5c35OwVguV1zgCjYqdjRZZ8B4VV+SF mPJssXNr5I2s/O2LJ6N9e6jthgck38Z3iKj4z8bNwLMkzs0/VFQymF3jFWUbfIMmbAJH LVY5Vx+bgIBg9X7+s1ib+4R9fYfmtnSYjnCglVYogm06MjrDe3jo5FcU/zmZHXVEUrBf yImA== X-Gm-Message-State: ACrzQf3OoKamujPrTYeVe0PtSsJQHs3x5Kp2Lyns8t7j7dHURsoZz90F gEnlOJiUYQomweVlJYuwh0jZrIw2av4obSxb/nvz9xObqNPclC6frxUsUye74lXrhyM4qj8pRKC IGYtZ7T+aJPLYClcmGQ== X-Received: by 2002:a05:620a:319c:b0:6ce:ec44:3c6b with SMTP id bi28-20020a05620a319c00b006ceec443c6bmr1568955qkb.179.1665695763919; Thu, 13 Oct 2022 14:16:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7TZsbfwOsh2VGgDOuMjPIBF65Gis9FB/hlZh7rEzic2z2KHHZ/GlRVvuidSlPo23tq9GmkYg== X-Received: by 2002:a05:620a:319c:b0:6ce:ec44:3c6b with SMTP id bi28-20020a05620a319c00b006ceec443c6bmr1568934qkb.179.1665695763657; Thu, 13 Oct 2022 14:16:03 -0700 (PDT) Received: from [192.168.1.101] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id ck7-20020a05622a230700b0035d5e5660cbsm697114qtb.59.2022.10.13.14.16.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Oct 2022 14:16:03 -0700 (PDT) Message-ID: <5b636835-20af-2372-75d2-92e31a3393ed@redhat.com> Date: Thu, 13 Oct 2022 17:16:02 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: Handling of main() function for freestanding To: =?UTF-8?Q?Arsen_Arsenovi=c4=87?= , Jonathan Wakely , gcc-patches@gcc.gnu.org Cc: "gcc@gcc.gnu.org" , Jakub Jelinek , "Joseph S. Myers" References: <16718001.dR7co8bJll@bstg> <2a959ba5-e9a3-768b-2d66-cba2bc389eca@redhat.com> <4964626.imyG0pze7u@bstg> From: Jason Merrill In-Reply-To: <4964626.imyG0pze7u@bstg> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP 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 10/13/22 16:14, Arsen Arsenović wrote: > On Thursday, 13 October 2022 19:24:41 CEST Jason Merrill wrote: >> I was arguing that we don't need the new flag; there shouldn't be any >> need to turn it off. > At the time, I opted to go with a more conservative route; I haven't > been around enough to have very strong opinions ;) I certainly can't > think of a way always adding a return can go wrong, but figured someone, > somehow, might rely on this behavior. Removed the flag and tested on > x86_64-pc-linux-gnu, v3 attached. Thanks! > FWIW, there's precedent for treating main specially regardless of > flag_hosted (e.g. it's always marked extern "C" in the C++ frontend, > AFAICT). > > -#define DECL_MAIN_P(NODE) \ > +#define DECL_MAIN_FREESTANDING_P(NODE) \ > (DECL_EXTERN_C_FUNCTION_P (NODE) \ > && DECL_NAME (NODE) != NULL_TREE \ > - && MAIN_NAME_P (DECL_NAME (NODE)) \ > - && flag_hosted) > + && MAIN_NAME_P (DECL_NAME (NODE))) > + > +/* Nonzero iff NODE is a declaration for `main', and we are hosted. */ > +#define DECL_MAIN_P(NODE) (DECL_MAIN_FREESTANDING_P(NODE) && flag_hosted) I liked in the previous version that you checked the return type of main when !flag_hosted, here and in c_missing_noreturn_ok_p. Let's bring that back. Jason