From 9593fc545950782ed75f12f53238b07885559b2b Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 9 Jul 2018 22:28:25 -0700 Subject: remove ccan for now --- ccan/build_assert/LICENSE | 1 - ccan/build_assert/_info | 49 ----------------------- ccan/build_assert/build_assert.h | 40 ------------------ ccan/build_assert/test/compile_fail-expr.c | 10 ----- ccan/build_assert/test/compile_fail.c | 9 ----- ccan/build_assert/test/compile_ok.c | 7 ---- ccan/build_assert/test/run-BUILD_ASSERT_OR_ZERO.c | 9 ----- 7 files changed, 125 deletions(-) delete mode 120000 ccan/build_assert/LICENSE delete mode 100644 ccan/build_assert/_info delete mode 100644 ccan/build_assert/build_assert.h delete mode 100644 ccan/build_assert/test/compile_fail-expr.c delete mode 100644 ccan/build_assert/test/compile_fail.c delete mode 100644 ccan/build_assert/test/compile_ok.c delete mode 100644 ccan/build_assert/test/run-BUILD_ASSERT_OR_ZERO.c (limited to 'ccan/build_assert') diff --git a/ccan/build_assert/LICENSE b/ccan/build_assert/LICENSE deleted file mode 120000 index b7951da..0000000 --- a/ccan/build_assert/LICENSE +++ /dev/null @@ -1 +0,0 @@ -../../licenses/CC0 \ No newline at end of file diff --git a/ccan/build_assert/_info b/ccan/build_assert/_info deleted file mode 100644 index 97ebe6c..0000000 --- a/ccan/build_assert/_info +++ /dev/null @@ -1,49 +0,0 @@ -#include "config.h" -#include -#include - -/** - * build_assert - routines for build-time assertions - * - * This code provides routines which will cause compilation to fail should some - * assertion be untrue: such failures are preferable to run-time assertions, - * but much more limited since they can only depends on compile-time constants. - * - * These assertions are most useful when two parts of the code must be kept in - * sync: it is better to avoid such cases if possible, but seconds best is to - * detect invalid changes at build time. - * - * For example, a tricky piece of code might rely on a certain element being at - * the start of the structure. To ensure that future changes don't break it, - * you would catch such changes in your code like so: - * - * Example: - * #include - * #include - * - * struct foo { - * char string[5]; - * int x; - * }; - * - * static char *foo_string(struct foo *foo) - * { - * // This trick requires that the string be first in the structure - * BUILD_ASSERT(offsetof(struct foo, string) == 0); - * return (char *)foo; - * } - * - * License: CC0 (Public domain) - * Author: Rusty Russell - */ -int main(int argc, char *argv[]) -{ - if (argc != 2) - return 1; - - if (strcmp(argv[1], "depends") == 0) - /* Nothing. */ - return 0; - - return 1; -} diff --git a/ccan/build_assert/build_assert.h b/ccan/build_assert/build_assert.h deleted file mode 100644 index b9ecd84..0000000 --- a/ccan/build_assert/build_assert.h +++ /dev/null @@ -1,40 +0,0 @@ -/* CC0 (Public domain) - 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 - * ... - * 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 */ diff --git a/ccan/build_assert/test/compile_fail-expr.c b/ccan/build_assert/test/compile_fail-expr.c deleted file mode 100644 index 6322eb3..0000000 --- a/ccan/build_assert/test/compile_fail-expr.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main(void) -{ -#ifdef FAIL - return BUILD_ASSERT_OR_ZERO(1 == 0); -#else - return 0; -#endif -} diff --git a/ccan/build_assert/test/compile_fail.c b/ccan/build_assert/test/compile_fail.c deleted file mode 100644 index 9fd827d..0000000 --- a/ccan/build_assert/test/compile_fail.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -int main(void) -{ -#ifdef FAIL - BUILD_ASSERT(1 == 0); -#endif - return 0; -} diff --git a/ccan/build_assert/test/compile_ok.c b/ccan/build_assert/test/compile_ok.c deleted file mode 100644 index b4de8b4..0000000 --- a/ccan/build_assert/test/compile_ok.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(void) -{ - BUILD_ASSERT(1 == 1); - return 0; -} diff --git a/ccan/build_assert/test/run-BUILD_ASSERT_OR_ZERO.c b/ccan/build_assert/test/run-BUILD_ASSERT_OR_ZERO.c deleted file mode 100644 index 72f9ad1..0000000 --- a/ccan/build_assert/test/run-BUILD_ASSERT_OR_ZERO.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -int main(void) -{ - plan_tests(1); - ok1(BUILD_ASSERT_OR_ZERO(1 == 1) == 0); - return exit_status(); -} -- cgit v1.2.3