X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fbuild_assert%2Fbuild_assert.h;h=b9ecd84028e3fbebd1bf009c3c57e8a193e45646;hp=4b0d75e4bf29ade83fe741440d56532e3c8ffdfe;hb=6abc867fce8c3eba40eb26092d31e34b47dd9165;hpb=650c775ff00cccd03fc84e7789a03c51d9839004 diff --git a/ccan/build_assert/build_assert.h b/ccan/build_assert/build_assert.h index 4b0d75e4..b9ecd840 100644 --- a/ccan/build_assert/build_assert.h +++ b/ccan/build_assert/build_assert.h @@ -1,3 +1,4 @@ +/* CC0 (Public domain) - see LICENSE file for details */ #ifndef CCAN_BUILD_ASSERT_H #define CCAN_BUILD_ASSERT_H @@ -9,7 +10,9 @@ * by the compiler. This can only be used within a function. * * Example: - * char *foo_to_char(struct foo *foo) + * #include + * ... + * static char *foo_to_char(struct foo *foo) * { * // This code needs string to be at start of foo. * BUILD_ASSERT(offsetof(struct foo, string) == 0); @@ -20,7 +23,7 @@ do { (void) sizeof(char [1 - 2*!(cond)]); } while(0) /** - * EXPR_BUILD_ASSERT - assert a build-time dependency, as an expression. + * BUILD_ASSERT_OR_ZERO - assert a build-time dependency, as an expression. * @cond: the compile-time condition which must be true. * * Your compile will fail if the condition isn't true, or can't be evaluated @@ -29,9 +32,9 @@ * Example: * #define foo_to_char(foo) \ * ((char *)(foo) \ - * + EXPR_BUILD_ASSERT(offsetof(struct foo, string) == 0)) + * + BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0)) */ -#define EXPR_BUILD_ASSERT(cond) \ +#define BUILD_ASSERT_OR_ZERO(cond) \ (sizeof(char [1 - 2*!(cond)]) - 1) #endif /* CCAN_BUILD_ASSERT_H */