[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/decompress: resolve MISRA R5.5 identifier/macro name conflicts
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
- Date: Fri, 22 May 2026 19:41:28 +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=AzlmfAAgr3EPxUJhCev4Z1FWalLvf1q6g2YgVqmnga0=; b=jqy2FqHys/Y6pwNiEaaazb8KYjet7j+obH3FePAf5mXlFAoYKkHqMQDylKjMYFWNq66V5ADeaDz11rQCEoywhl6VeMoJ55GnKnW+0kJHBvRWciroO0cYY64Xrf1iHeQJSzt+irlXQ/Wbh7m+BqIk9CwyTyB5shmjKfDix0jpeIvrVkbqrBdal9SUBK34Vy/evnDDlxq+yVsUpHXUKqH0vkHsh1uvrXV6YGxMC27XTN+5A+DmNG868uRnVCHQAjcD/RfFukCFw1AQZ0ZXPtXvaMA+MGsT4EJKLzYNbDeD78PEq1FclqAtw5nabwik+6sSt4LPejp2QtHz9ZHPtyz7yQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oY9DpL0I9y0b0dxQf7Gv3I9s/u2HOhCwS7z9Dt+ulu8WawWuNUHPNyOFa/plsWbZHgssadSTkWwOA9CP+6m5/BNV5s67uJIOFABRTOo7jOX75QV2XXllGvon859fd39LDd+HpbPnnm3oAnp/S7+96oEkvs5zk46DBUqWJ7IsKHlJeXIeNxsyDSdT5f37L18elIQKfn01lugRFhKsvBHQ+mfEGT2ZexKBjeuTjY1QbVrzZqOEiIf6psbxzcRtQ56L7BrpW86aY587QhpcpyVI2SbeMCzBlMkPHAJAJr04ThuNb8iXY1LYnhSJCMNSNj8bCxI8x7LvEn2xvoKiyLIuYQ==
- 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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Fri, 22 May 2026 19:41:44 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHc6V8B/lHbglNK/EOVvgWJnFkvvbYZkMGAgADidwA=
- Thread-topic: [PATCH] xen/decompress: resolve MISRA R5.5 identifier/macro name conflicts
Hello Jan,
On 5/22/26 09:10, Jan Beulich wrote:
> On 21.05.2026 22:18, Dmytro Prokopchuk1 wrote:
>> Convert 'malloc' and 'free' macros in 'decompress.h' from object-like
>> to function-like form.
>>
>> The object-like macros '#define free xfree' perform unconditional text
>> replacement, causing conflicts with struct field 'free' in 'page_info'
>> unions. 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.
>
> At the same time function-like macros cannot be used to e.g. pass the
> (underlying) function pointer to a function. Likely there aren't any
> such uses here, but imo this aspect needs covering in patches like
> this one.
I will search through the Xen codebase these macros.
>
>> Applying function-like form to both 'malloc' and 'free' ensures consistent
>> macro style.
>
> Not quite, seeing ...
>
>> --- a/xen/common/decompress.h
>> +++ b/xen/common/decompress.h
>> @@ -9,8 +9,8 @@
>> #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
>
> ... these two in context? IOW if you mean to achieve consistency,
> convert these (and whatever else, if anything) as well?
>
Yes, this makes sense as well.
> Jan
BR, Dmytro.
|