This patch replaces all CLASSERT() with user defined
BUILD_BUG_ON() for file lustre/utils/wirehdr.c and
lustre/utils/wirecheck.c
Test-Parameters: trivial
Signed-off-by: Arshad Hussain <arshad.super@gmail.com>
Change-Id: If46603158a9ad311762fe51839000c39a0b15307
Reviewed-on: https://review.whamcloud.com/36711
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
#define STRINGIFY(a) #a
#define CHECK_CDEFINE(a) \
#define STRINGIFY(a) #a
#define CHECK_CDEFINE(a) \
- printf(" CLASSERT("#a" == "STRINGIFY(a) ");\n")
+ printf(" BUILD_BUG_ON("#a" != "STRINGIFY(a) ");\n")
#define CHECK_CVALUE(a) \
#define CHECK_CVALUE(a) \
- printf(" CLASSERT("#a" == %lld);\n", (long long)a)
+ printf(" BUILD_BUG_ON("#a" != %lld);\n", (long long)a)
#define CHECK_CVALUE_X(a) \
#define CHECK_CVALUE_X(a) \
- printf(" CLASSERT("#a" == 0x%.8x);\n", a)
+ printf(" BUILD_BUG_ON("#a" != 0x%.8x);\n", a)
#define CHECK_DEFINE(a) \
do { \
#define CHECK_DEFINE(a) \
do { \
#define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__);ret = 1;}
/*
#define LASSERT(cond) if (!(cond)) { printf("failed " #cond "\n"); ret = 1; }
#define LASSERTF(cond, fmt, ...) if (!(cond)) { printf("failed '" #cond "'" fmt, ## __VA_ARGS__);ret = 1;}
/*
- * Compile-time LASSERT, which verifies correctness at compile-time rather
- * than runtime. If "cond" is true, then there are two different cases
- * ("(non-zero)" and "0"). If "cond" is false, then there are two identical
- * cases ("0" and "0"), which is an error that causes the compiler to complain.
+ * BUILD_BUG_ON() is Compile-time check which verifies correctness at
+ * compile-time rather than runtime.
-#define CLASSERT(cond) do {switch (1) {case (cond): case 0: break; } } while (0)
+#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
- lustre_assert_wire_constants();
+ lustre_assert_wire_constants();
- if (ret == 0)
- printf("wire constants OK\n");
+ if (ret == 0)
+ printf("wire constants OK\n");