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.129.124]) by sourceware.org (Postfix) with ESMTPS id 9F2593858C56 for ; Thu, 13 Oct 2022 21:16:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9F2593858C56 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=1665695766; 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=g89WlCGGz3Lv53QwKGWea1gG5SDVXDCAJWoJIKM2FcD7qz0aKX/y/PDcfIQV3u7Jcfd21v hZXIz5JeCvUB0jycn+FgtT0gricM/yVaTVJ1Zp4PkmAJnutlV+jDBJFaH2m5/X3Eo0/Qp0 dF2BCq7Eat/86UGAl2CHdVF+yJuzcbE= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-213-s4UgQ5EYNxa3oVGsw3AXRQ-1; Thu, 13 Oct 2022 17:16:05 -0400 X-MC-Unique: s4UgQ5EYNxa3oVGsw3AXRQ-1 Received: by mail-qk1-f198.google.com with SMTP id u9-20020a05620a454900b006eeafac8ea4so1837415qkp.19 for ; Thu, 13 Oct 2022 14:16:05 -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=TQRyM+CzfblFE8uUsPoyuC+HAvmpfmgqcxWKue461i1oUwSGitqWiVw1wnUb0wY8qH beYIZ6UIWyu6tUZPEdcK5B7fswf8j1960y0YmQ1/L4uAAz7RxkOqr1kP6+QfQ93SeJhj +VOepvZKTV0u0sbxq2LmnrfXjFvy0CKBDxYsWd8q2gd/aW6P5vZ/gv8i9IuyUxIsj0Y9 3WrDIw+TA3ddMd+xCMeHT7+DVe1OjA7gWxfeyZ08b3q9PkaNK4pIe8D7eUvR2/B2L+UT eDQSsCCn60QwTh3w3uAhCo+h9gp78hAxcPhr2Xx9ZGOpC0ErtLrthU3IvhKCK8vXqvkZ m6VQ== X-Gm-Message-State: ACrzQf2P57NhXZGkIBPv34/NoDYG6NzlquzlviMT9dGgvpEn3DfbsTMg XeriFiK5JXCX3z3VawBO/xfV2Yn8qvqXBdW8QkexD74tuammSM45MNmcj7ANr/kF9Tsb5SU3rP5 k9bL5BKE= X-Received: by 2002:a05:620a:319c:b0:6ce:ec44:3c6b with SMTP id bi28-20020a05620a319c00b006ceec443c6bmr1568956qkb.179.1665695763920; 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