Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5139765rwb; Sun, 22 Jan 2023 04:06:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXvNnUrnWhv3P2zY1dZJgbySyKAS46UUXRlfeNAYhtvrd2sM1FAX3vqxByagbgp1eUQpgh4p X-Received: by 2002:a62:154f:0:b0:581:3557:f75b with SMTP id 76-20020a62154f000000b005813557f75bmr46854637pfv.5.1674389186880; Sun, 22 Jan 2023 04:06:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674389186; cv=none; d=google.com; s=arc-20160816; b=kv2F5MBWuKU+030KreLyESXddqDNwjItjNM/z3+GjQXxdVRHa73KpFpWQkPGsALNgk v57V8Kt97PGGU6nVJziqwf7/Df7ysIIEJjyw4ujxwHF4d9RSvHsTj08nRAnRt2K0TNLk rSn9a6lmQqMzjSLtlJ8JT4My8xx59lH+Jr3ZuQEbKjppSn2b8Lx7JcOWMGP86mtqncHQ vRp+f2dVtQQYrYTYC+mOK4zKDWyjcb/3KoMTD0X8ctQyQ/DvsDIQXW10ViY6P8fSahMH 82z0yl9Y7+YiVf1QkR+kL6T2QROoLogytmvsAcstc2AZ2/SZSbT+ZQmUIFqw5l2WsGSi VdOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=RggQbserZ+WjHaKxVFRFJvtUWUb4qSd5sQHRk1t+lB4=; b=rZN2efTLj5+14OWWDptWOxADdhSwie62NahYyy6QW0B5HYUrMXayBtzyIKKxWRPsJx s9X2Vq160JjYgI3ca6ApAeN+R+ZsmaQqJygdJqDcszHXcOYmFwy4rrzy2WKNE6b+x2nO RxHBpsSKEndsh98OXiYpk/yCu83Wu2J+Yz1u8ZHaLcnpMLDihrUw9dH3yksTbMBNvk9d ZWlTUWyROblVP94JRKNcz4PIkYKEfPH7kRsTQY5uuIEHx4T1pG0lfGgPbsTU1LIx9jDE cb1s1m5zBsqZJxTw9O/tEdKvMAK2DT+Jc7hbqyfSHwBFgne3AX2Sv8hWOxpTk5uiBAbr V//g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x19-20020aa79573000000b0058da3f01de3si20640018pfq.347.2023.01.22.04.06.19; Sun, 22 Jan 2023 04:06:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229924AbjAVLdt (ORCPT + 50 others); Sun, 22 Jan 2023 06:33:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjAVLds (ORCPT ); Sun, 22 Jan 2023 06:33:48 -0500 Received: from outpost1.zedat.fu-berlin.de (outpost1.zedat.fu-berlin.de [130.133.4.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E844E1E1C5; Sun, 22 Jan 2023 03:33:46 -0800 (PST) Received: from inpost2.zedat.fu-berlin.de ([130.133.4.69]) by outpost.zedat.fu-berlin.de (Exim 4.95) with esmtps (TLS1.3) tls TLS_AES_256_GCM_SHA384 (envelope-from ) id 1pJYbW-003cIW-JV; Sun, 22 Jan 2023 12:33:42 +0100 Received: from pd9f631ca.dip0.t-ipconnect.de ([217.246.49.202] helo=[192.168.144.87]) by inpost2.zedat.fu-berlin.de (Exim 4.95) with esmtpsa (TLS1.3) tls TLS_AES_128_GCM_SHA256 (envelope-from ) id 1pJYbW-003jRK-DR; Sun, 22 Jan 2023 12:33:42 +0100 Message-ID: Date: Sun, 22 Jan 2023 12:33:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH: 1/1] sh4: avoid spurious gcc warning To: Randy Dunlap , linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, Segher Boessenkool , Rich Felker , Yoshinori Sato , John Paul Adrian Glaubitz Cc: jakub@gcc.gnu.org References: <52952170-f1a9-89a0-e307-f974ce2b7977@fu-berlin.de> <2085aec3-796b-71c3-7cb2-d4103d3b6175@infradead.org> From: Michael Karcher In-Reply-To: <2085aec3-796b-71c3-7cb2-d4103d3b6175@infradead.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Original-Sender: kernel@mkarcher.dialup.fu-berlin.de X-Originating-IP: 217.246.49.202 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 22.01.2023 um 08:00 schrieb Randy Dunlap: >> -#define _INTC_ARRAY(a) a, __same_type(a, NULL) ? 0 : sizeof(a)/sizeof(*a) >> +#define _INTC_ARRAY(a) a, sizeof(a)/(_Generic((a), typeof(NULL): 0xFFFFFFFFU, default: sizeof(*a))) > s/: / : / in 2 places. > > Tested-by: Randy Dunlap # build-tested Thanks for your confirmation! Are you sure about the space before the colon? The colon in this case terminates a case descriptor for the type-level switch construction using "_Generic". It says: "In case 'a' has the 'type of NULL', divide by 0xFFFFFFFFU, in all other cases, divide by the size of a single array element". It's not a colon of the ternary ?: operator, in which case I would agree with the space before it. If you confirm that you want a space before the colon in this case as well, I'm going to add it, though. > How far back in gcc versions does this work? I tested the support of _Generic on Compiler Explorer at godbolt.org. This construction is rejected by gcc 4.8, but accepted by gcc 4.9. Kind regards,   Michael Karcher