From patchwork Tue Apr 11 09:27:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Brodsky X-Patchwork-Id: 81842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2448429vqo; Tue, 11 Apr 2023 02:50:22 -0700 (PDT) X-Google-Smtp-Source: AKy350avx3YuREliWuwMAYl5CHoptz5Yl0lSbe9GKZRrl9GNAZuoZDtxF3iO5hW0JB5t8khhXmrX X-Received: by 2002:a17:907:98fb:b0:92f:33ca:c9a3 with SMTP id ke27-20020a17090798fb00b0092f33cac9a3mr1944421ejc.71.1681206621832; Tue, 11 Apr 2023 02:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681206621; cv=none; d=google.com; s=arc-20160816; b=xLrkASsqyEp3CbXaaCr6YG7peeXE6V/wd2Qbn6ps4rADk1zxtbsY/NpfGsC/7uLo1n 1xcnMwwXy0QWBc8AuxWVoQoJ/SUS34ZIKvBzdP+2t7Ye4Djgyw7Fsm8xu6XTD8noJd9U MqP/cMJanj0yJvS9eNvOIV0CPNFsTyUaxCTZXxgSiYVHifTrt/voVsieeyx72eMPg7Fv ayxxBJgVpIJmjjS9zTX9DIi8aei0AmpKuLzzhQapVpEXdDVddMDHeMQgyloUH0SWQ+ZZ CEnsIY9eSACo3jmvnOM4ZwVyPwVQyjbfx9hk9f+9JD2/aIK2Jt/+ubQMH7pfoQmkrBtF hlPA== 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=gw/vhEb7Oh377frsMdqm1DwHMYh78sHjvS+2nJ1bnPmybM3SgzaCrlSyh48ba83Scz AdwpSw4o8L9EyO91MTsegrRWOJJlwnmp//bnBXdB1HXs1h91zNCPHsoQQAcCBang2grU FHphgRyYIcPyK2ILp+zIM3u5ICLsJeJKFgnLrB2AlNysEzCH3vi8La2nKqIBH4i1M+hR 8qxUWzmF12NjqExg4x2Wqhn9T//vnRLKAIyge5x2j6Sjx4+JOxHiLyDwGbDe+LKyNzua v8DL3EHg3WVt3/9YJUh7qyWmfz4PAEpnnmQEmif333KCT2KVa+BJsPr9wSj6KvQMzIaC YEuA== 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 ke22-20020a17090798f600b0094de067bcb6si109796ejc.725.2023.04.11.02.49.57; Tue, 11 Apr 2023 02:50:21 -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; 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 S229732AbjDKJ2R (ORCPT + 99 others); Tue, 11 Apr 2023 05:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjDKJ2A (ORCPT ); Tue, 11 Apr 2023 05:28:00 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A71C4C3; Tue, 11 Apr 2023 02:27:57 -0700 (PDT) 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 D0E0BD75; Tue, 11 Apr 2023 02:28:41 -0700 (PDT) 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 578DC3F73F; Tue, 11 Apr 2023 02:27:56 -0700 (PDT) From: Kevin Brodsky To: linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, Masahiro Yamada , Sam Ravnborg , Petr Vorel , Andrew Morton , Kevin Brodsky , Ruben Ayrapetyan Subject: [PATCH RESEND] uapi/linux/const.h: Prefer ISO-friendly __typeof__ Date: Tue, 11 Apr 2023 10:27:47 +0100 Message-Id: <20230411092747.3759032-1-kevin.brodsky@arm.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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?1762872915086522648?= X-GMAIL-MSGID: =?utf-8?q?1762872915086522648?= 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 Reviewed-by: Petr Vorel Tested-by: Petr Vorel --- 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))