Skip to content

Commit c3c7bf6

Browse files
Only #include <assert.h> if assert isn't yet defined
The C standard requires every the macro to be redefined every time that <assert.h> is included. It does so you can change NDEBUG from one But that also means a wrapper couldn't #define assert to their own macro. So stop overriding. Signed-off-by: Thiago Macieira <[email protected]>
1 parent e566235 commit c3c7bf6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/cbor.h

+2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
#ifndef CBOR_H
2626
#define CBOR_H
2727

28+
#ifndef assert
2829
#include <assert.h>
30+
#endif
2931
#include <limits.h>
3032
#include <stddef.h>
3133
#include <stdint.h>

src/compilersupport_p.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
#ifndef _DEFAULT_SOURCE
3434
# define _DEFAULT_SOURCE
3535
#endif
36-
#include <assert.h>
36+
#ifndef assert
37+
# include <assert.h>
38+
#endif
3739
#include <float.h>
3840
#include <math.h>
3941
#include <stddef.h>

0 commit comments

Comments
 (0)