Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2011-09-30 01:43:44 +0400
committerGregory Maxwell <greg@xiph.org>2011-09-30 01:43:44 +0400
commitb180a3feacde90c3e43e5b5b55300eea3317e328 (patch)
treeb9be7c1a0007881f3517f088c9f6ca97c46f7383 /silk/typedef.h
parente3f6ad0b0cff1e17249d436c91b70479c5aba0c9 (diff)
Make silk_assert calls work with the autotools --enable-assertions.
Diffstat (limited to 'silk/typedef.h')
-rw-r--r--silk/typedef.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/silk/typedef.h b/silk/typedef.h
index 53bdc7c9..f546d378 100644
--- a/silk/typedef.h
+++ b/silk/typedef.h
@@ -81,7 +81,19 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# define silk_assert(COND) _ASSERTE(COND)
# endif
#else
-# define silk_assert(COND)
+# ifdef ENABLE_ASSERTIONS
+# include <stdio.h>
+# include <stdlib.h>
+#define silk_fatal(str) _silk_fatal(str, __FILE__, __LINE__);
+static inline void _silk_fatal(const char *str, const char *file, int line)
+{
+ fprintf (stderr, "Fatal (internal) error in %s, line %d: %s\n", file, line, str);
+ abort();
+}
+# define silk_assert(COND) {if (!(COND)) {silk_fatal("assertion failed: " #COND);}}
+# else
+# define silk_assert(COND)
+# endif
#endif
#endif