Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp581351rdf; Fri, 3 Nov 2023 08:59:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9FzNyWp+Qd5VgvcuSZw1ffdXyvnsGKkHxQ3Mb51Lri9KNHI1hfML3+5/YDuXe+Slg7S6Z X-Received: by 2002:a17:90a:bd95:b0:280:2652:d43 with SMTP id z21-20020a17090abd9500b0028026520d43mr15988840pjr.17.1699027175275; Fri, 03 Nov 2023 08:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699027175; cv=none; d=google.com; s=arc-20160816; b=TeNoO3LhCqTlMEgKZDwRs7SjJupqJ7WZbKXU+w/9RIe8ez1VE0v52/pSw4Cu1vKO1c EWH6G30nEgWJV373Vu9ZPthge5PUDQpigBX85sLol0eRhHr5nQvti1oHQWyrt01M9u9x dFkhYLNWm5WM6seYmF+TAQzVPntcLaN3/MHIjpXoiea6ypZ6o0lTtk/GQAae/C97AvN5 I21UbPPOdubjBU+dP6Bu9fEXrQGqBOKY5hZi/scA5vY5U9wBFiqjmohOLpuuAQuARhhL IAw13nvHVtIDn+QKlGyYKvPTzJ8HH/itnYeZlOkVjvZ+h3W477N/nJLbLWFjbIW9DWJH yVBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=WTaUHo75fFE+jMIAh5g2yEyp9VcKdSEEwPVeitydaPI=; fh=NvW3CO3GtIHRKW4YFObS4dEX0yL9bbz2APezTtyZGhQ=; b=v1bOQadtLo1q69pJu44O9SwGwXTOwacMzhqwxWTSHSHzcem6NiwrWaZJbwgS9hi/9p xAYfIf4wsiDGro+e+fAhdsvcI+PcldsLLtQBku4k1TzP0Nkpa6ZEgfl2u7Ll2tcS/GIB AzIm/tPFi8pQI7ARCZI+loIPOFyWy0CFB4TOaZtab+aTN4+Zfe2AJOYLudrtI6dgJxPL jkIPetHX8hubzakosqrFGx/EkLJ5Du/62vEfAjaV6XzZfOeVIEnQ7V+L9PIT4IwHWJF3 43xmUDuKaRS4C10UaK9hH91Q2NOCEbIkYZqrDLSiqCTWOULhPncQJDoQBw+TtUJy+dmn W5dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id ms11-20020a17090b234b00b00280cc57b23fsi1761237pjb.94.2023.11.03.08.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 08:59:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3B0F68316EB5; Fri, 3 Nov 2023 08:59:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344250AbjKCP7O (ORCPT + 99 others); Fri, 3 Nov 2023 11:59:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344362AbjKCP7N (ORCPT ); Fri, 3 Nov 2023 11:59:13 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 273A5D4E; Fri, 3 Nov 2023 08:59:08 -0700 (PDT) X-QQ-mid: bizesmtp86t1699027134tyw2b1v4 Received: from main2-ubuntu.tail147f4.ts.net ( [202.201.15.117]) by bizesmtp.qq.com (ESMTP) with id ; Fri, 03 Nov 2023 23:58:50 +0800 (CST) X-QQ-SSF: 01200000000000B06000000A0000000 X-QQ-FEAT: eSZ1CZgv+JCVHfF1wGxh8nF1q0geFQVjdp7+4eC2s5jBRXYvF4MCh5LGR7B+E 8+fmWyYidCbzrgu0MyIjfriJ59BganbsFbgX/5YcVpNzFbubzZ6dLiMjHahc457QS0HWkpM Fs+rI0pdcMyYCTK4SUwz0pMd3PBl01wPTUvQesEcQq+EJG/XuR2vXuTHrlODVWPty+yV/29 2Vnc8zaKv9YE6DbotW/r8+csDUkR1pa5ZtDVaUUN5+YVN0eCeGjKznkQB0jsEaGSMDKdrln 4vKFNLZIoLjH5UocAwhtcmVuhVONXyw1aSP1/0oQeB7WlrjtTw1rgFghaFSj/mHgl+ZkWO2 yA9Fx5mYFZAXRB61jZpB7Sq3gDPes8pPxQZSZMLehfXO4a96th3jTtVgpf52ywStnBsM5Uq X-QQ-GoodBg: 0 X-BIZMAIL-ID: 9783515542256517097 From: Yuan Tan To: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, luc.vanoostenryck@gmail.com, linux-sparse@vger.kernel.org Cc: linux@weissschuh.net, palmer@rivosinc.com, paul.walmsley@sifive.com, paulburton@kernel.org, paulmck@kernel.org, tim.bird@sony.com, tsbogend@alpha.franken.de, w@1wt.eu, tanyuan@tinylab.org, i@maskray.me Subject: [PATCH v1 02/14] compiler: add a global __QUITE_UNIQUE_ID() Date: Fri, 3 Nov 2023 23:58:49 +0800 Message-Id: <152d812cb6fa2c6018794ea7f05f487631542d6e.1699025537.git.tanyuan@tinylab.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 03 Nov 2023 08:59:32 -0700 (PDT) From: Zhangjin Wu Differs from __UNIQUE_ID(), __QUITE_UNIQUE_ID() also appends the __COUNTER__ info to make it more unique. Besides, seems assembly code also require such a unique id, let's make it global, the same to the required __PASTE macro. Signed-off-by: Zhangjin Wu --- I am not sure whether it is proper to put the __QUITE_UNIQUE_ID and other stuff later in compiler.h. Welcome discussion as this is just a preliminary approach. include/linux/compiler.h | 5 +++++ include/linux/compiler_types.h | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index d7779a18b24f..405b19cf6cf3 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -227,6 +227,11 @@ static inline void *offset_to_ptr(const int *off) #endif /* __ASSEMBLY__ */ +/* Quite-unique ID. */ +#ifndef __QUITE_UNIQUE_ID +# define __QUITE_UNIQUE_ID(prefix) __PASTE(__PASTE(prefix, __LINE__), __COUNTER__) +#endif + /* &a[0] degrades to a pointer: a different type from an array */ #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index c523c6683789..0b79e19d1017 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -70,10 +70,6 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { } # define __builtin_warning(x, y...) (1) #endif /* __CHECKER__ */ -/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ -#define ___PASTE(a,b) a##b -#define __PASTE(a,b) ___PASTE(a,b) - #ifdef __KERNEL__ /* Attributes */ @@ -308,6 +304,10 @@ struct ftrace_likely_data { #endif /* __ASSEMBLY__ */ +/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ +#define ___PASTE(a, b) a##b +#define __PASTE(a, b) ___PASTE(a, b) + /* * The below symbols may be defined for one or more, but not ALL, of the above * compilers. We don't consider that to be an error, so set them to nothing. -- 2.34.1