mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
6e72370fd7
This imports licensing clarifications and updates as discussed on samba-technical ("Subject: Re: ccan code breaks older build farm systems"). In particular, the recent version have per-file license markers, and some modules are relicenced more liberally: in particular Simo pointed out that htable was GPL, and indirectly included by libtdb2, which would have made that GPL as well. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Autobuild-User: Rusty Russell <rusty@rustcorp.com.au> Autobuild-Date: Mon Jul 25 12:03:40 CEST 2011 on sn-devel-104
41 lines
1.2 KiB
C
41 lines
1.2 KiB
C
/* Licensed under LGPLv2.1+ - see LICENSE file for details */
|
|
#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:
|
|
* #include <stddef.h>
|
|
* ...
|
|
* 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);
|
|
* return (char *)foo;
|
|
* }
|
|
*/
|
|
#define BUILD_ASSERT(cond) \
|
|
do { (void) sizeof(char [1 - 2*!(cond)]); } while(0)
|
|
|
|
/**
|
|
* 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
|
|
* by the compiler. This can be used in an expression: its value is "0".
|
|
*
|
|
* Example:
|
|
* #define foo_to_char(foo) \
|
|
* ((char *)(foo) \
|
|
* + BUILD_ASSERT_OR_ZERO(offsetof(struct foo, string) == 0))
|
|
*/
|
|
#define BUILD_ASSERT_OR_ZERO(cond) \
|
|
(sizeof(char [1 - 2*!(cond)]) - 1)
|
|
|
|
#endif /* CCAN_BUILD_ASSERT_H */
|