[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH 5/5] xen/bitops: address violation of MISRA C Rule 5.5


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • Date: Fri, 4 Jul 2025 20:39:43 +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=9AYqjgn4wMRBeycg61AUz8EvZb80nLOwwK9+zoOne+Y=; b=CvZKZTMQ0Din2e2XJPmok0ruORP9bGcCZ7ilTJargZDSdBPAbdv27A3JGQq9h24iHOfvJ1vWF9CQ5CWliJ2lQwzzMCsDtuQNfQOiVXfJ9pbbuZCybZrBRrFM1S9j6lS2lPjR3/wv4v+j3XT4mgH///KqITW+qrfUPnRtFUUiuIp50l5aUvVyCjUCFnw/YSMnzDuRzqtipdoDNtIpPn0DPGZOF9exiq7dWSBeEwy1vUgI7rXcFlqP6uBRNJYTO73LCHCyN87f4JCcC4mfBuf6OXxqXmDLBZMG8bz2hDH94soTQwEpyxF1nqfASau7ISNx2EHk8tO+oDyoRjx+/ko1cw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nrhH1FWqtGoE0YXhgcEzctHIlD4BxSNmK6ncvGQuWODuzIeNjUJv0Z01zu57RDZ+XY5ZhuJWd/X6Hy6gZXkF/qewVza0EQuBFNLhljO1cMYKqvt92l8xO7fDSlSjq7IJNOknsr6tFEsXuSvKAI3s1F1myaTnPRM2RvM9VTFfw6Tp8vm2uznisqSyWbQxNWODXJq+hyxtzUGw6yPzKwFfvIaTYG1MNePESZSDGTMxClvC8p2RzFEZiRDShY3r2ARb8YhlaTH5mTNmt5Nh5eX5mCKlY5Gf0/stk7WIWVGnyFS3n7P36UjV4xzEohg1hRDpCaiOF7lomQW819Dbyqc+Pg==
  • 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: Fri, 04 Jul 2025 20:39:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHb7SPFdtGhMfiyuEObKwCZWDm70g==
  • Thread-topic: [XEN PATCH 5/5] xen/bitops: address violation of MISRA C Rule 5.5

Address a violation of MISRA C:2012 Rule 5.5:
"Identifiers shall be distinct from macro names".

Reports for service MC3A2.R5.5:
xen/include/xen/bitops.h: non-compliant function '__test_and_set_bit(int, 
volatile void*)'
xen/include/xen/bitops.h: non-compliant macro '__test_and_set_bit'
xen/include/xen/bitops.h: non-compliant function '__test_and_clear_bit(int, 
volatile void*)'
xen/include/xen/bitops.h: non-compliant macro '__test_and_clear_bit'
xen/include/xen/bitops.h: non-compliant function '__test_and_change_bit(int, 
volatile void*)'
xen/include/xen/bitops.h: non-compliant macro '__test_and_change_bit'
xen/include/xen/bitops.h: non-compliant function 'test_bit(int, const volatile 
void*)'
xen/include/xen/bitops.h: non-compliant macro 'test_bit'

The primary issue stems from the macro and function
having identical names, which is confusing and
non-compliant with common coding standards.
Change the functions names by adding two underscores at the end.
No functional changes.

Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
---
 xen/include/xen/bitops.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index a4d31ec02a..b292470ad7 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -120,7 +120,7 @@ static always_inline bool generic_test_bit(int nr, const 
volatile void *addr)
 }
 
 /**
- * __test_and_set_bit - Set a bit and return its old value
+ * __test_and_set_bit__ - Set a bit and return its old value
  * @nr: Bit to set
  * @addr: Address to count from
  *
@@ -129,7 +129,7 @@ static always_inline bool generic_test_bit(int nr, const 
volatile void *addr)
  * but actually fail.  You must protect multiple accesses with a lock.
  */
 static always_inline bool
-__test_and_set_bit(int nr, volatile void *addr)
+__test_and_set_bit__(int nr, volatile void *addr)
 {
 #ifndef arch__test_and_set_bit
 #define arch__test_and_set_bit generic__test_and_set_bit
@@ -139,11 +139,11 @@ __test_and_set_bit(int nr, volatile void *addr)
 }
 #define __test_and_set_bit(nr, addr) ({             \
     if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
-    __test_and_set_bit(nr, addr);                   \
+    __test_and_set_bit__(nr, addr);                 \
 })
 
 /**
- * __test_and_clear_bit - Clear a bit and return its old value
+ * __test_and_clear_bit__ - Clear a bit and return its old value
  * @nr: Bit to clear
  * @addr: Address to count from
  *
@@ -152,7 +152,7 @@ __test_and_set_bit(int nr, volatile void *addr)
  * but actually fail.  You must protect multiple accesses with a lock.
  */
 static always_inline bool
-__test_and_clear_bit(int nr, volatile void *addr)
+__test_and_clear_bit__(int nr, volatile void *addr)
 {
 #ifndef arch__test_and_clear_bit
 #define arch__test_and_clear_bit generic__test_and_clear_bit
@@ -162,11 +162,11 @@ __test_and_clear_bit(int nr, volatile void *addr)
 }
 #define __test_and_clear_bit(nr, addr) ({           \
     if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
-    __test_and_clear_bit(nr, addr);                 \
+    __test_and_clear_bit__(nr, addr);               \
 })
 
 /**
- * __test_and_change_bit - Change a bit and return its old value
+ * __test_and_change_bit__ - Change a bit and return its old value
  * @nr: Bit to change
  * @addr: Address to count from
  *
@@ -175,7 +175,7 @@ __test_and_clear_bit(int nr, volatile void *addr)
  * but actually fail.  You must protect multiple accesses with a lock.
  */
 static always_inline bool
-__test_and_change_bit(int nr, volatile void *addr)
+__test_and_change_bit__(int nr, volatile void *addr)
 {
 #ifndef arch__test_and_change_bit
 #define arch__test_and_change_bit generic__test_and_change_bit
@@ -185,11 +185,11 @@ __test_and_change_bit(int nr, volatile void *addr)
 }
 #define __test_and_change_bit(nr, addr) ({              \
     if ( bitop_bad_size(addr) ) __bitop_bad_size();     \
-    __test_and_change_bit(nr, addr);                    \
+    __test_and_change_bit__(nr, addr);                  \
 })
 
 /**
- * test_bit - Determine whether a bit is set
+ * test_bit__ - Determine whether a bit is set
  * @nr: bit number to test
  * @addr: Address to start counting from
  *
@@ -197,7 +197,7 @@ __test_and_change_bit(int nr, volatile void *addr)
  * If two examples of this operation race, one can appear to succeed
  * but actually fail.  You must protect multiple accesses with a lock.
  */
-static always_inline bool test_bit(int nr, const volatile void *addr)
+static always_inline bool test_bit__(int nr, const volatile void *addr)
 {
 #ifndef arch_test_bit
 #define arch_test_bit generic_test_bit
@@ -207,7 +207,7 @@ static always_inline bool test_bit(int nr, const volatile 
void *addr)
 }
 #define test_bit(nr, addr) ({                           \
     if ( bitop_bad_size(addr) ) __bitop_bad_size();     \
-    test_bit(nr, addr);                                 \
+    test_bit__(nr, addr);                               \
 })
 
 /* --------------------- Please tidy above here --------------------- */
-- 
2.43.0



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.