Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Sep 2009 05:40:06 +0000 (UTC)
From:      Julian Elischer <julian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r196811 - head/sys/i386/include
Message-ID:  <200909040540.n845e6nQ055325@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: julian
Date: Fri Sep  4 05:40:06 2009
New Revision: 196811
URL: http://svn.freebsd.org/changeset/base/196811

Log:
  Bring i386 up to date with amd64 and others.
  The macros for PCPU can be slightly simplified, which makes the
  resulting tangle qa lot easier to understand when trying to read them.
  
  MFC after:	4 weeks

Modified:
  head/sys/i386/include/pcpu.h

Modified: head/sys/i386/include/pcpu.h
==============================================================================
--- head/sys/i386/include/pcpu.h	Fri Sep  4 05:37:49 2009	(r196810)
+++ head/sys/i386/include/pcpu.h	Fri Sep  4 05:40:06 2009	(r196811)
@@ -152,7 +152,7 @@ extern struct pcpu *pcpup;
 #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 @@ extern struct pcpu *pcpup;
 #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);							\
@@ -214,10 +214,10 @@ extern struct pcpu *pcpup;
 /*
  * Sets the value of the per-cpu variable name to value val.
  */
-#define	__PCPU_SET(name, val) {						\
+#define	__PCPU_SET(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);							\
@@ -230,7 +230,7 @@ extern struct pcpu *pcpup;
 	} else {							\
 		*__PCPU_PTR(name) = __val;				\
 	}								\
-}
+} while (0)
 
 #define	PCPU_GET(member)	__PCPU_GET(pc_ ## member)
 #define	PCPU_ADD(member, val)	__PCPU_ADD(pc_ ## member, val)



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