Skip to content

Commit

Permalink
fix(memory): fix to compile memoryd with NDEBUG #defined (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
mycoboco committed Dec 7, 2017
1 parent 2ac8e3b commit 34d8437
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
12 changes: 4 additions & 8 deletions src/cbl/assert.h
Expand Up @@ -5,25 +5,21 @@
#ifndef ASSERT_H
#define ASSERT_H

#if defined(NDEBUG) || defined(ASSERT_STDC_VER) /* standard version requested */
#include "cbl/except.h" /* except_t, EXCEPT_RAISE */

#include <assert.h>

#if defined(NDEBUG) || defined(ASSERT_STDC_VER) /* standard version requested */
#include <assert.h>
#else /* use "assert.h" supporting exception */

#include "cbl/except.h" /* EXCEPT_RAISE */


/* replaces standard assert() */
#define assert(e) ((void)((e) || (EXCEPT_RAISE(assert_exceptfail), 0)))
#endif /* NDEBUG || ASSERT_STDC_VER */


/* exception for assertion failure */
extern const except_t assert_exceptfail;


#endif /* NDEBUG || ASSERT_STDC_VER */

#endif /* ASSERT_H */

/* end of assert.h */
5 changes: 0 additions & 5 deletions src/cbl/memoryd.c
Expand Up @@ -10,11 +10,6 @@
#include <stdint.h> /* uintptr_t */
#endif /* __STDC_VERSION__ */

/* direct references to assert_exceptfail, thus: */
#ifdef NDEBUG
#error "This module cannot be compiled with NDEBUG defined!"
#endif

#include "cbl/assert.h" /* assert with exception support */
#include "cbl/except.h" /* except_raise, EXCEPT_RAISE */
#include "memory.h"
Expand Down

0 comments on commit 34d8437

Please sign in to comment.