Skip to content
Permalink
Browse files

fix(memory): fix to compile memoryd with NDEBUG #defined (#32)

  • Loading branch information
mycoboco committed Dec 7, 2017
1 parent 2ac8e3b commit 34d84378ce0052bd3e8fb14af9abc9ad91406191
Showing with 4 additions and 13 deletions.
  1. +4 −8 src/cbl/assert.h
  2. +0 −5 src/cbl/memoryd.c
@@ -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 */
@@ -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"

0 comments on commit 34d8437

Please sign in to comment.
You can’t perform that action at this time.