possible readability improvement for i386 pcpu macros:

From: Julian Elischer <julian_at_elischer.org>
Date: Sun, 02 Aug 2009 03:23:26 -0700
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.


Index: include/pcpu.h
===================================================================
--- include/pcpu.h	(revision 196030)
+++ include/pcpu.h	(working copy)
_at__at_ -152,7 +152,7 _at__at_
 #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 ||			\
_at__at_ -174,7 +174,7 _at__at_
 #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);							\
_at__at_ -217,7 +217,7 _at__at_
 #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);							\
Received on Sun Aug 02 2009 - 08:23:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:53 UTC