summaryrefslogtreecommitdiffstats
path: root/Include/pymacro.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@wyplay.com>2011-09-29 10:43:18 (GMT)
committerVictor Stinner <vstinner@wyplay.com>2011-09-29 10:43:18 (GMT)
commitf0ddadcf2e93a663d09cbc73a7499e2ffb9c1091 (patch)
tree31e51199a00cae6113454d296eddb093f8465b27 /Include/pymacro.h
parent573696a9cab740783cf762899fca72c2f03293b1 (diff)
downloadcpython-f0ddadcf2e93a663d09cbc73a7499e2ffb9c1091.zip
cpython-f0ddadcf2e93a663d09cbc73a7499e2ffb9c1091.tar.gz
cpython-f0ddadcf2e93a663d09cbc73a7499e2ffb9c1091.tar.bz2
Rename Py_BUILD_ASSERT to Py_BUILD_ASSERT_EXPR
To make it clearer that Py_BUILD_ASSERT_EXPR(cond) cannot be used as assert(cond).
Diffstat (limited to 'Include/pymacro.h')
-rw-r--r--Include/pymacro.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/Include/pymacro.h b/Include/pymacro.h
index 07f4785..1dc0c61 100644
--- a/Include/pymacro.h
+++ b/Include/pymacro.h
@@ -17,18 +17,17 @@
#define foo_to_char(foo) \
((char *)(foo) \
- + Py_BUILD_ASSERT(offsetof(struct foo, string) == 0))
+ + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))
Written by Rusty Russell, public domain, http://ccodearchive.net/ */
-#define Py_BUILD_ASSERT(cond) \
+#define Py_BUILD_ASSERT_EXPR(cond) \
(sizeof(char [1 - 2*!(cond)]) - 1)
-
/* Get the number of elements in a visible array
This does not work on pointers, or arrays declared as [], or function
parameters. With correct compiler support, such usage will cause a build
- error (see Py_BUILD_ASSERT).
+ error (see Py_BUILD_ASSERT_EXPR).
Written by Rusty Russell, public domain, http://ccodearchive.net/ */
#if defined(__GNUC__)
@@ -36,8 +35,8 @@
&a[0] degrades to a pointer: a different type from an array */
#define Py_ARRAY_LENGTH(array) \
(sizeof(array) / sizeof((array)[0]) \
- + Py_BUILD_ASSERT(!__builtin_types_compatible_p(typeof(array), \
- typeof(&(array)[0]))))
+ + Py_BUILD_ASSERT_EXPR(!__builtin_types_compatible_p(typeof(array), \
+ typeof(&(array)[0]))))
#else
#define Py_ARRAY_LENGTH(array) \
(sizeof(array) / sizeof((array)[0]))