From patchwork Thu Sep 29 03:38:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 12993481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5285C32771 for ; Thu, 29 Sep 2022 03:23:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1B0168D0002; Wed, 28 Sep 2022 23:23:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 160778D0001; Wed, 28 Sep 2022 23:23:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 028558D0002; Wed, 28 Sep 2022 23:23:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E535A8D0001 for ; Wed, 28 Sep 2022 23:23:01 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 630E5C0DF7 for ; Thu, 29 Sep 2022 03:23:01 +0000 (UTC) X-FDA: 79963676562.18.FDAD505 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf29.hostedemail.com (Postfix) with ESMTP id 5EAAC120003 for ; Thu, 29 Sep 2022 03:22:59 +0000 (UTC) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MdJTV64vQzHtmG; Thu, 29 Sep 2022 11:18:06 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 11:22:44 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 29 Sep 2022 11:22:44 +0800 From: Yang Yingliang To: , , , CC: , Subject: [PATCH -next] compiler.h: fix compile error with gcc-8 or lower version Date: Thu, 29 Sep 2022 11:38:45 +0800 Message-ID: <20220929033845.485728-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664421781; h=from:from:sender: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: references; bh=CEu+ZVtjBGgK8hk3iwaSXBSqZRnpbVOjFHvU5b1rpdQ=; b=6LlXN2WZeDcCvCTzRIv599/w7eV/rSue1Q0BKMcm7IDEr/LRwpWV0CdA93zdycjiYswTAP uvR1w1tfERp6UUzqTSQRYKUqTtZZkbeMpZZ86AOO06wGhwUEDuQQ1j6hPSIX9yn/KbOq9r oKCoOu/HAiuEBOkKsFojwrHomMIVXic= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of yangyingliang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yangyingliang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664421781; a=rsa-sha256; cv=none; b=uKA78Itykm8tchjIVKW2iRqFdYcNEnbBIejgNeMLvYBksa6U5yowtLA2vP8ocq+zFvlKfe RWQ15XQ6UK1/6oU8heALMR67KjZpFsHwJQLTPdbDJjXx8y1FDe68BBvbC1d5+xh63Dodbf L4iEdjUqFN/GevTx2ZmTgWHbFMDaL9U= X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 5EAAC120003 Authentication-Results: imf29.hostedemail.com; dkim=none; spf=pass (imf29.hostedemail.com: domain of yangyingliang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=yangyingliang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: iptnsbif16ek495cafz8cz1dyie5be1x X-HE-Tag: 1664421779-682764 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: I got the follow compile error in latest linux-next kernel with gcc-8.4: In file included from : ./include/linux/percpu.h: In function ‘__alloc_reserved_percpu’: ././include/linux/compiler_types.h:279:30: error: expected declaration specifiers before ‘__alloc_size__’ #define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc ^~~~~~~~~~~~~~ ./include/linux/percpu.h:120:74: note: in expansion of macro ‘__alloc_size’ extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align) __alloc_size(1); __alloc_size is not defined in gcc-8 or lower version, so add back the conditional test for __alloc_size__ to fix it. Fixes: 63caa04ec605 ("slab: Remove __malloc attribute from realloc functions") Signed-off-by: Yang Yingliang --- include/linux/compiler_types.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index aa81da7a28eb..aae8852ccbdc 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -276,8 +276,13 @@ struct ftrace_likely_data { * be performing a _reallocation_, as that may alias the existing pointer. * For these, use __realloc_size(). */ +#ifdef __alloc_size__ #define __alloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) __malloc -#define __realloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) +#define __realloc_size(x, ...) __alloc_size__(x, ## __VA_ARGS__) +#else +#define __alloc_size(x, ...) __malloc +#define __realloc_size(x, ...) __malloc +#endif #ifndef asm_volatile_goto #define asm_volatile_goto(x...) asm goto(x)