Skip to content

Commit 34d8437

Browse files
committed
fix(memory): fix to compile memoryd with NDEBUG #defined (#32)
1 parent 2ac8e3b commit 34d8437

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/cbl/assert.h

+4-8
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,21 @@
55
#ifndef ASSERT_H
66
#define ASSERT_H
77

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

10-
#include <assert.h>
1110

11+
#if defined(NDEBUG) || defined(ASSERT_STDC_VER) /* standard version requested */
12+
#include <assert.h>
1213
#else /* use "assert.h" supporting exception */
13-
14-
#include "cbl/except.h" /* EXCEPT_RAISE */
15-
16-
1714
/* replaces standard assert() */
1815
#define assert(e) ((void)((e) || (EXCEPT_RAISE(assert_exceptfail), 0)))
16+
#endif /* NDEBUG || ASSERT_STDC_VER */
1917

2018

2119
/* exception for assertion failure */
2220
extern const except_t assert_exceptfail;
2321

2422

25-
#endif /* NDEBUG || ASSERT_STDC_VER */
26-
2723
#endif /* ASSERT_H */
2824

2925
/* end of assert.h */

src/cbl/memoryd.c

-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
#include <stdint.h> /* uintptr_t */
1111
#endif /* __STDC_VERSION__ */
1212

13-
/* direct references to assert_exceptfail, thus: */
14-
#ifdef NDEBUG
15-
#error "This module cannot be compiled with NDEBUG defined!"
16-
#endif
17-
1813
#include "cbl/assert.h" /* assert with exception support */
1914
#include "cbl/except.h" /* except_raise, EXCEPT_RAISE */
2015
#include "memory.h"

0 commit comments

Comments
 (0)