History

test: make build fail if NDEBUG is defined

Defining NDEBUG via CFLAGS is the canonical way to disable assertions in C. mpv respects this (and ta.c actually disables some debugging machinery if it's defined). But for tests, this is not useful at all. So if --enable-tests is passed to configure, the user must not define NDEBUG, even if the rest of the player does not care. (We could just #undef NDEBUG, but let's not. Tests calling into the rest of the player might depend on asserts there, or so.)

wm4 committed 7 years ago

Commit 3e401bf1 parent 3ed9c1c1 file · +4 −0Browse files

Unified · Split

test/index.c+4−0
@@ -51,3 +51,7 @@ bool run_tests(struct MPContext *mpctx) · 50 unmodified lines
51 51
52 return num_run > 0; // still error if none52 return num_run > 0; // still error if none
53}53}
54
55#ifdef NDEBUG
56static_assert(false, "don't define NDEBUG for tests");
57#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t