Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp74821rwl; Tue, 11 Apr 2023 14:41:39 -0700 (PDT) X-Google-Smtp-Source: AKy350aAsf4MGRmm6zzTY1T8NlYhVC1Xu3edhsw38TVe3clwZL0kNnurzDnvhRNEOYSvqBNL47Dg X-Received: by 2002:a17:90b:1d08:b0:246:57ba:ab25 with SMTP id on8-20020a17090b1d0800b0024657baab25mr17267577pjb.11.1681249299329; Tue, 11 Apr 2023 14:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681249299; cv=none; d=google.com; s=arc-20160816; b=g0+0Dq00YPchXtVa/lJhxxaTQpGgS6xZumhyK4cBIVRJanlx7VNJTpA+SSse/pbGNR E5d3Lmh9FuT1tcgyUNAXDQJlf7yPLA9nd9NDvLxomElC7EHAI/W+twdKTNhWK4wN+bhY b80pPooV4aKlzC+1oi5Nw3WdflyTuT3AbitS67TNr4u/jpEnIJF9LuUlfbi63Az6GbzT vyqK8fzgnvM7RmjAunpYJukYmx5GVfOmOIeKYH8GmOB4/yrP3GnJQQvGAH7RrP59zaUy 27tEN0PCJmBvNlxcjATWZ666buflgEYQyNkzeV/YTopqyPiTYfmldGSfkLpu6C5CFeBv LRQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:to:from:date:dkim-signature :dkim-signature; bh=S82+xdE9OcmjrTBCsFkGp/8e3ifilP41Xw0NqCH/dlo=; b=qGLabxwJxdOswAklE0MG5EGbjwCk/RZ+YI6dRbNG0VE+qMpK6CJhYmN4RUe829rxV1 Njw+ES/GPkP2uV5x++itIEsADjFXi2qV/HyIP+qBIkpphbiT2tDMMRsUp7ItaWQwD1lF 1sTKf7VKjAq14D1J+WXbrqgc7/tqrMI/NLtckMd/qgVoghQTtOH9wE4D9BLQbAFtGayg 1Z71cS91ZTMCvhcXw92akfO9MH7KZDvNFIBmhbi7dauKvIQS1rYYb97N7ZTXZ72rX/0I DG+Ld8cO6IuiKB0Tc4/3qAr/Yh+XaKX/0h3g2/t5Gdrx8k041/HurRMFRURzTnKz615P EUFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="B9g1vj/s"; dkim=neutral (no key) header.i=@suse.cz header.b=98SsGC7l; 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 i2-20020a17090aa90200b0023d53736026si99547pjq.125.2023.04.11.14.41.25; Tue, 11 Apr 2023 14:41:39 -0700 (PDT) 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; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="B9g1vj/s"; dkim=neutral (no key) header.i=@suse.cz header.b=98SsGC7l; 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 S229779AbjDKVjx (ORCPT + 99 others); Tue, 11 Apr 2023 17:39:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbjDKVjw (ORCPT ); Tue, 11 Apr 2023 17:39:52 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA0235260; Tue, 11 Apr 2023 14:39:49 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5A4781FDCF; Tue, 11 Apr 2023 21:39:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1681249188; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=S82+xdE9OcmjrTBCsFkGp/8e3ifilP41Xw0NqCH/dlo=; b=B9g1vj/sdRS1obYJIMmBH9jRI2ARZSjfpM2i/Em32p1zmjq9DRoB8rm60j6EZLbklyNoJK 1xffjtLPrYkzwh6JWwhfmIpzq8focrBVTMgddbEVhVaABdTr/NnwRe0kkOsZre4QpNary8 mmo2wq7vJliuQiQgzzv81ulCd83resg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1681249188; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=S82+xdE9OcmjrTBCsFkGp/8e3ifilP41Xw0NqCH/dlo=; b=98SsGC7lE/9SYfUzGB6VtVCDdFuhjg4KacawgM63zAFnIkl05Z98tEyp3MG+BO4tUh1PhR 8CUXnDT/5FrVB4Dg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2C6D513638; Tue, 11 Apr 2023 21:39:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yG0ICqTTNWSmLAAAMHmgww (envelope-from ); Tue, 11 Apr 2023 21:39:48 +0000 Date: Tue, 11 Apr 2023 23:39:46 +0200 From: Petr Vorel To: Kevin Brodsky , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Masahiro Yamada , Sam Ravnborg , Petr Vorel , Andrew Morton , Ruben Ayrapetyan Subject: Re: [PATCH RESEND] uapi/linux/const.h: Prefer ISO-friendly __typeof__ Message-ID: <20230411213946.GA1803920@pevik> Reply-To: Petr Vorel References: <20230411092747.3759032-1-kevin.brodsky@arm.com> <20230411210537.GA1800481@pevik> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230411210537.GA1800481@pevik> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 > Hi Kevin, > > typeof is (still) a GNU extension, which means that it cannot be > > used when building ISO C (e.g. -std=c99). It should therefore be > > avoided in uapi headers in favour of the ISO-friendly __typeof__. > IMHO UAPI are built with -std=c90 -Wall -Werror=implicit-function-declaration > (see usr/include/Makefile). > But one or the other, you're right both require __typeof__. > "If you are writing a header file that must work when included in ISO C > programs, write __typeof__ instead of typeof." > https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Typeof.html > Reviewed-by: Petr Vorel > Tested-by: Petr Vorel IMHO problem was introduced when -std=c90 was added (back then the code was in include/uapi/linux/kernel.h). Fixes: d6fc9fcbaa65 ("kbuild: compile-test exported headers to ensure they are self-contained") Kind regards, Petr > Kind regards, > Petr > > Unfortunately this issue could not be detected by > > CONFIG_UAPI_HEADER_TEST=y as the __ALIGN_KERNEL() macro is not > > expanded in any uapi header. > > Reported-by: Ruben Ayrapetyan > > Tested-by: Ruben Ayrapetyan > > Signed-off-by: Kevin Brodsky > > --- > > include/uapi/linux/const.h | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/uapi/linux/const.h b/include/uapi/linux/const.h > > index af2a44c08683..a429381e7ca5 100644 > > --- a/include/uapi/linux/const.h > > +++ b/include/uapi/linux/const.h > > @@ -28,7 +28,7 @@ > > #define _BITUL(x) (_UL(1) << (x)) > > #define _BITULL(x) (_ULL(1) << (x)) > > -#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) > > +#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1) > > #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) > > #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))