possible readability improvement for i386 pcpu macros:
Julian Elischer
julian at elischer.org
Sun Aug 2 10:23:21 UTC 2009
if you have to ever look at the output of the cpp then this removes a
number of things you have to puzzle over in the output of PCPU_SET()
and friends.
I don't know if it applies to the other architectures.
-------------- next part --------------
Index: include/pcpu.h
===================================================================
--- include/pcpu.h (revision 196030)
+++ include/pcpu.h (working copy)
@@ -152,7 +152,7 @@
#define __PCPU_GET(name) __extension__ ({ \
__pcpu_type(name) __res; \
struct __s { \
- u_char __b[MIN(sizeof(__pcpu_type(name)), 4)]; \
+ u_char __b[MIN(sizeof(__res), 4)]; \
} __s; \
\
if (sizeof(__res) == 1 || sizeof(__res) == 2 || \
@@ -174,7 +174,7 @@
#define __PCPU_ADD(name, val) do { \
__pcpu_type(name) __val; \
struct __s { \
- u_char __b[MIN(sizeof(__pcpu_type(name)), 4)]; \
+ u_char __b[MIN(sizeof(__val), 4)]; \
} __s; \
\
__val = (val); \
@@ -217,7 +217,7 @@
#define __PCPU_SET(name, val) { \
__pcpu_type(name) __val; \
struct __s { \
- u_char __b[MIN(sizeof(__pcpu_type(name)), 4)]; \
+ u_char __b[MIN(sizeof(__val), 4)]; \
} __s; \
\
__val = (val); \
More information about the freebsd-current
mailing list