[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2] xen/decompress: resolve MISRA R5.5 identifier/macro name conflicts
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
- Date: Sun, 24 May 2026 20:25:17 +0000
- Accept-language: en-US, uk-UA, ru-RU
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fJSrfF7UcoH8NOB8+ckJAHDIq/zh+YzR3ayQy7s7zfc=; b=ejOcGiJAs5DAgJKDU9PIPUdhzFlycG/59ci5KMXrnEIdiRcEXDD7qekV8CInwmLNxtonNC3wRDiYrABDSWWzNg4w2VmBLMh15Svsy/B5Y+OT641dWaNCek8Wc7AokGyOet4UwY6Iw+7z4KkNqHvuC5f/Jxa+G0DiTcMQNoC4Z7ODs63ppwo+Lf4W9/s+Nveqi3A8oP61q8OHo9P9jvGQN4ilQKwyZ6KgRafanfPpa2A0/UQriRByzo4Ri7Hfw7Z7PZZzQGn4i8Y2EOaqLDqiZsuFGcFU/XjcZ4jMRGhI9BwwE6d/DlWEuvn++jmFUk3LsIzetFTs5ZMGvmzuFVvg2g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c7RHpd65NfnGHQgX/nPPADbQSBvE2S0CyNwFlOoPkL0WK0vPe+MZYV1ytwIX9b0uJNsJl4OV57TW61Wy2ug8Y4/JSjwZTTjwxnrtYDwg33tX5VLLOEdsDCVXC/KU7+TStH8m9kQR/0uIAQ2lbxVQVm0j9UFoQd7A7Lx0rbRcPfscC4vIHcmwre8Yw9gyG9Obwe1wzpS6oE85FtYlVZyIS3Nky4ffj7ag2BcUslBOrbSESKkJ/buZSGvarWDgWm0WmHN8t6TIO7IBs7X9rmaxicFzT7U9Tv08uhe/AE/SITPkSZ+KaO0MkLauRqwW5RKKT7smVM50F6bRW5PtEMrx0w==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Sun, 24 May 2026 20:25:46 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHc67tvI/8A7islCkmHlTX7cuCR9A==
- Thread-topic: [PATCH v2] xen/decompress: resolve MISRA R5.5 identifier/macro name conflicts
Convert 'free' macro in 'decompress.h' from object-like to function-like
form.
The object-like macro '#define free xfree' performs unconditional text
replacement, causing conflicts with identifiers named 'free', such as
struct fields in 'page_info' unions defined in 'xen/arch/arm/include/asm/mm.h'.
Function-like macros only match when followed by parentheses, allowing
'free' to be used both as a macro and as a struct field without conflicts.
Applying function-like form to 'malloc', 'large_malloc' and 'large_free'
ensures consistent macro style.
Function-like macros also intentionally prevent uses where the underlying
function identifier is needed directly, such as taking a function pointer.
No such uses exist in the current Xen codebase.
Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
---
Changes in v2:
- converted other macros for consistency
- updated commit message wording
Link to v1:
https://patchew.org/Xen/69ef81a2f85b35e6231ae389bf271cad2bbd7dfc.1779394622.git.dmytro._5Fprokopchuk1@xxxxxxxx/
---
xen/common/decompress.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/xen/common/decompress.h b/xen/common/decompress.h
index 034c833665..487856e1bc 100644
--- a/xen/common/decompress.h
+++ b/xen/common/decompress.h
@@ -9,11 +9,11 @@
#include <xen/types.h>
#include <xen/xmalloc.h>
-#define malloc xmalloc_bytes
-#define free xfree
+#define malloc(a) xmalloc_bytes(a)
+#define free(a) xfree(a)
-#define large_malloc xmalloc_bytes
-#define large_free xfree
+#define large_malloc(a) xmalloc_bytes(a)
+#define large_free(a) xfree(a)
#else
--
2.43.0
|