Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 02 Aug 2009 03:23:26 -0700
From:      Julian Elischer <julian@elischer.org>
To:        FreeBSD Current <current@freebsd.org>
Subject:   possible readability improvement for i386 pcpu macros:
Message-ID:  <4A75691E.9070401@elischer.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------040209070305050406080508
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit


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.


--------------040209070305050406080508
Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="pcpu2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="pcpu2.diff"

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);							\

--------------040209070305050406080508--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A75691E.9070401>