Browse Source

fix ASSERT macros: return -1 instead of bare return in int main() (FreeBSD -Wreturn-mismatch)

congestion
Evgeny 5 months ago
parent
commit
fcb6a59ca9
  1. 2
      tests/test_bgp_route_exchange.c
  2. 2
      tests/test_ll_queue.c
  3. 2
      tests/test_nat_engine.c
  4. 2
      tests/test_nat_stress.c
  5. 2
      tests/test_route_lib.c

2
tests/test_bgp_route_exchange.c

@ -250,7 +250,7 @@ static void fail(const char* msg) {
DEBUG_INFO(DEBUG_CATEGORY_BGP, "=== PHASE: %s ===", name); \
} while(0)
#define ASSERT(cond, msg) do { if (!(cond)) { fail(msg); return; } } while(0)
#define ASSERT(cond, msg) do { if (!(cond)) { fail(msg); return -1; } } while(0)
// Poll until condition is met or timeout (clock-based)
static int wait_for(const char* desc, int (*cond)(void), int timeout_tb) {

2
tests/test_ll_queue.c

@ -35,7 +35,7 @@ static struct {
#define PASS() do { puts("PASS"); stats.passed++; } while(0)
#define FAIL(msg) do { printf("FAIL: %s\n", msg); stats.failed++; } while(0)
#define ASSERT(c, m) do { if (!(c)) { FAIL(m); return; } } while(0)
#define ASSERT(c, m) do { if (!(c)) { FAIL(m); return -1; } } while(0)
#define ASSERT_EQ(a,b,m) ASSERT((a)==(b),m)
/* ------------------------------------------------------------------ */

2
tests/test_nat_engine.c

@ -32,7 +32,7 @@ static struct {
#define PASS() do { puts("PASS"); stats.passed++; } while(0)
#define FAIL(msg) do { printf("FAIL: %s\n", msg); stats.failed++; } while(0)
#define ASSERT(c, m) do { if (!(c)) { FAIL(m); return; } } while(0)
#define ASSERT(c, m) do { if (!(c)) { FAIL(m); return -1; } } while(0)
#define ASSERT_EQ(a,b,m) ASSERT((a)==(b),m)
/* ================================================================

2
tests/test_nat_stress.c

@ -27,7 +27,7 @@ static struct {
#define PASS() do { puts("PASS"); stats.passed++; } while(0)
#define FAIL(msg) do { printf("FAIL: %s\n", msg); stats.failed++; } while(0)
#define ASSERT(c, m) do { if (!(c)) { FAIL(m); return; } } while(0)
#define ASSERT(c, m) do { if (!(c)) { FAIL(m); return -1; } } while(0)
#define ASSERT_EQ(a,b,m) ASSERT((a)==(b),m)
static double now_ms(void) {

2
tests/test_route_lib.c

@ -85,7 +85,7 @@ static struct {
#define PASS() do { puts("PASS"); stats.passed++; } while(0)
#define FAIL(msg) do { printf("FAIL: %s\n", msg); stats.failed++; } while(0)
#define ASSERT(c, m) do { if (!(c)) { FAIL(m); return; } } while(0)
#define ASSERT(c, m) do { if (!(c)) { FAIL(m); return -1; } } while(0)
#define ASSERT_EQ(a,b,m) ASSERT((a)==(b),m)
#define ASSERT_PTR(p,m) ASSERT((p)!=NULL,m)

Loading…
Cancel
Save