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

x86/bitops and MISRA C:2012 Rule 5.5



Hello everyone,

there are violations of Rule 5.5 ("Identifiers shall be distinct
from macro names") in xen/arch/x86/include/asm/bitops.h.
You can see them at [1].

Do you agree to distinguish between function-like macros and
inline functions by adding a suffix to the functions?
I thought about "_unsafe" or "_nocheck" suffixes.
As an example:

@@ -32,14 +32,14 @@ extern void __bitop_bad_size(void);
  * Note that @nr may be almost arbitrarily large; this function is not
  * restricted to acting on a single-word quantity.
  */
-static inline void set_bit(int nr, volatile void *addr)
+static inline void set_bit_unsafe(int nr, volatile void *addr)
 {
     asm volatile ( "lock; btsl %1,%0"
                    : "+m" (ADDR) : "Ir" (nr) : "memory");
 }
 #define set_bit(nr, addr) ({                            \
     if ( bitop_bad_size(addr) ) __bitop_bad_size();     \
-    set_bit(nr, addr);                                  \
+    set_bit_unsafe(nr, addr);                           \
 })


[1]
https://saas.eclairit.com:3787/fs/var/local/eclair/XEN.ecdf/ECLAIR_normal/staging/X86_64-BUGSENG/575/PROJECT.ecd;/by_service/MC3R1.R5.5.html#{"select":true,"selection":{"hiddenAreaKinds":[],"hiddenSubareaKinds":[],"show":true,"selector":{"enabled":true,"negated":false,"kind":2,"children":[{"enabled":true,"negated":false,"kind":0,"domain":"file","inputs":[{"enabled":true,"text":"xen/arch/x86/include/asm/bitops.h"}]}]}}}

--
Federico Serafini, M.Sc.

Software Engineer, BUGSENG (http://bugseng.com)



 


Rackspace

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