X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=build_assert%2Fbuild_assert.h;fp=build_assert%2Fbuild_assert.h;h=0000000000000000000000000000000000000000;hb=650c775ff00cccd03fc84e7789a03c51d9839004;hp=4b0d75e4bf29ade83fe741440d56532e3c8ffdfe;hpb=c8acddea39d222312102952e91c32cfe4dd2cea0;p=ccan diff --git a/build_assert/build_assert.h b/build_assert/build_assert.h deleted file mode 100644 index 4b0d75e4..00000000 --- a/build_assert/build_assert.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef CCAN_BUILD_ASSERT_H -#define CCAN_BUILD_ASSERT_H - -/** - * BUILD_ASSERT - assert a build-time dependency. - * @cond: the compile-time condition which must be true. - * - * Your compile will fail if the condition isn't true, or can't be evaluated - * by the compiler. This can only be used within a function. - * - * Example: - * char *foo_to_char(struct foo *foo) - * { - * // This code needs string to be at start of foo. - * BUILD_ASSERT(offsetof(struct foo, string) == 0); - * return (char *)foo; - * } - */ -#define BUILD_ASSERT(cond) \ - do { (void) sizeof(char [1 - 2*!(cond)]); } while(0) - -/** - * EXPR_BUILD_ASSERT - 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 - * by the compiler. This can be used in an expression: its value is "0". - * - * Example: - * #define foo_to_char(foo) \ - * ((char *)(foo) \ - * + EXPR_BUILD_ASSERT(offsetof(struct foo, string) == 0)) - */ -#define EXPR_BUILD_ASSERT(cond) \ - (sizeof(char [1 - 2*!(cond)]) - 1) - -#endif /* CCAN_BUILD_ASSERT_H */