Module Name: src
Committed By: pooka
Date: Thu Mar 13 20:36:01 UTC 2014
Modified Files:
src/sys/sys: cdefs.h
Log Message:
For compilers without __COUNTER__, make the ctassert name contain
__INCLUDE_LEVEL__ ## _ ## __LINE__. It's not perfect, but at least it's
better than just __LINE__ since it avoids collisions between .c's and .h's.
Incidentally, why does half of the kernel call CTASSERT() and the
other half __CTASSERT()?
To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/sys/cdefs.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.118 src/sys/sys/cdefs.h:1.119
--- src/sys/sys/cdefs.h:1.118 Wed Feb 5 01:59:58 2014
+++ src/sys/sys/cdefs.h Thu Mar 13 20:36:01 2014
@@ -1,7 +1,6 @@
-/* $NetBSD: cdefs.h,v 1.118 2014/02/05 01:59:58 matt Exp $ */
+/* $NetBSD: cdefs.h,v 1.119 2014/03/13 20:36:01 pooka Exp $ */
-/*
- * Copyright (c) 1991, 1993
+/* * Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
@@ -146,7 +145,9 @@
#ifdef __COUNTER__
#define __CTASSERT(x) __CTASSERT0(x, __ctassert, __COUNTER__)
#else
-#define __CTASSERT(x) __CTASSERT0(x, __ctassert, __LINE__)
+#define __CTASSERT(x) __CTASSERT99(x, __INCLUDE_LEVEL__, __LINE__)
+#define __CTASSERT99(x, a, b) __CTASSERT0(x, __CONCAT(__ctassert,a), \
+ __CONCAT(_,b))
#endif
#define __CTASSERT0(x, y, z) __CTASSERT1(x, y, z)
#define __CTASSERT1(x, y, z) typedef char y ## z[/*CONSTCOND*/(x) ? 1 : -1] __unused