1 /*
2  * Copyright © 2017 Mozilla Foundation
3  *
4  * This program is made available under an ISC-style license.  See the
5  * accompanying file LICENSE for details.
6  */
7 
8 #ifndef CUBEB_ASSERT
9 #define CUBEB_ASSERT
10 
11 #include <stdio.h>
12 #include <stdlib.h>
13 
14 /**
15  * This allow using an external release assert method. This file should only
16  * export a function or macro called XASSERT that aborts the program.
17  */
18 
19 #define XASSERT(expr) do {                                                     \
20     if (!(expr)) {                                                             \
21       fprintf(stderr, "%s:%d - fatal error: %s\n", __FILE__, __LINE__, #expr); \
22       abort();                                                                 \
23     }                                                                          \
24   } while (0)
25 
26 #endif
27