diff --git a/include/macros.h b/include/macros.h index a1860f1..6c04166 100644 --- a/include/macros.h +++ b/include/macros.h @@ -75,6 +75,7 @@ #define IGNORE(x) ((void)(x)) _mixin void _drain_val(void* x, ...) { IGNORE(x); } #define _drain(...) _drain_val(NULL, __VA_ARGS__) +#define IGNORE_ALL(...) _drain(__VA_ARGS__) // Allocation macros @@ -152,6 +153,8 @@ static_assert_eq(bswap(bswap(128lu)), 128, "bswap128 (lu) failed (3)"); #define FATAL(msg, ...) (TRACEx("FATAL", msg, ## __VA_ARGS__), abort()) +#define TODO(x) FATAL("function %s() is unimplemented: " x, __func__) + // Debug testing #define TEST_OK 1 diff --git a/src/tests/version.c b/src/tests/version.c index de1528c..01e9e79 100644 --- a/src/tests/version.c +++ b/src/tests/version.c @@ -20,6 +20,9 @@ DEFTEST(version_str) TEST_ASSERT_EQ(v_ctosn(vers, sz+1, verstr), sz); + //XXX: It appears we need to bswap the raw versions to compare them ordinally (to b-endian). + const u32 vraw2 = bswap(VERSION(1,0,1,0)); + TEST_ASSERT( vraw2 >= bswap(VERSION(1,0,0,0)) && vraw2 > bswap(VERSION(2,0,0,0)) ); char* verstr_h; INFO("Version: 0x%x, raw: 0x%x", vers.raw, vraw); diff --git a/src/version.c b/src/version.c index 28dea88..64e3d43 100644 --- a/src/version.c +++ b/src/version.c @@ -43,3 +43,8 @@ char* v_ctos(version_t ver) return buf; } +int v_range(version_t version, version_t r1, version_t r2) +{ + IGNORE_ALL(version, r1, r2); + TODO("if we need this, we'll try to implement it in a way that doesn't rely on bswap'd raws (see tests to see bswap'd raws do infact work (big endian comparisons))"); +}