From patchwork Thu Jan 19 09:42:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 45665 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp235921wrn; Thu, 19 Jan 2023 01:52:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXvGP51zYiybJUUZmww3Jj5hlRwXEcV2u3gJ3ODwyO1gSKC8W4J3snWjucXZS3ExmJy7SLGC X-Received: by 2002:a17:90a:bb86:b0:229:4141:dde4 with SMTP id v6-20020a17090abb8600b002294141dde4mr10856760pjr.8.1674121924599; Thu, 19 Jan 2023 01:52:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674121924; cv=none; d=google.com; s=arc-20160816; b=t3ZDRf1/VtG+xaaBEbFsNMo57TzzmfzXjXaCg578ysC1f1nAwZAqiptzbH0EF89loy y1H9Y0d0IMs20gB8bH+8hStNQ2L4P2QEV0VaubFALjxtE+5+660jGMMhaqxtkyb9maw/ Y4auqT2NFcdtHDP8ZwzULMjgk16ApgResTOQVzlOPZymjWAv8009gsgNQKeyYYhoPOGH 2nrzTaI5pA3rDQZaP/iyYkWIvRyWK/Yt94DzlFLpGewLyOdzTTwrOIzwzcablXSQL20L tlBPorPkhqxy+rtXbbttEbM74nMY1+6viIqXcffZFW85lFNt0nRZqIx8eAgXTtcyiLh7 MCgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=FUgAXLr1iYAC7dgjc2/dCB4XWMuKY/pZEeWUFAG1yko=; b=u4d6TcVv9yL4sUCvHxl/chYpJfRTNu99adzCOtb/YHJ2c5HQ0y9+G90qdK/4jPYqIq MjhsfRLGQ9AHl/UESIMJbFy8qLPXOh9M3kjC4HQvPbQXIuy2YZHk6bwOOcBS5AEXknlr VEcMKDhoS2Lo+veId0sfOP2pKKtB/OqoJ3uuccifr2/UsgbOUsNhjsPBTrJYTZ/ERKBy EtWd76z6H7R/B9tThYxaZ6RPD2uvNdiMGdjpIqaw6bcbZ7N4WZlDA/YogFdK/JFvoh7Z a9SCaxJzxR5uUtbsdJose1i2mYbGyU+zno0VpRxBTBzvS+tLa1PrJTsZojD7oTiOPbeI an2A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020a17090a5d8200b00226e4692ceesi4405693pji.182.2023.01.19.01.51.52; Thu, 19 Jan 2023 01:52:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230072AbjASJmp (ORCPT + 99 others); Thu, 19 Jan 2023 04:42:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbjASJmm (ORCPT ); Thu, 19 Jan 2023 04:42:42 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 43A1C676D8; Thu, 19 Jan 2023 01:42:40 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6AD1F1758; Thu, 19 Jan 2023 01:43:21 -0800 (PST) Received: from e123572-lin.arm.com (e123572-lin.cambridge.arm.com [10.1.194.65]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 01F393F71A; Thu, 19 Jan 2023 01:42:38 -0800 (PST) From: Kevin Brodsky To: linux-kernel@vger.kernel.org Cc: Masahiro Yamada , Sam Ravnborg , linux-kbuild@vger.kernel.org, Kevin Brodsky , Ruben Ayrapetyan Subject: [PATCH] uapi/linux/const.h: Prefer ISO-friendly __typeof__ Date: Thu, 19 Jan 2023 09:42:25 +0000 Message-Id: <20230119094225.2422787-1-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755444071038904544?= X-GMAIL-MSGID: =?utf-8?q?1755444071038904544?= 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__. 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))