Skip to content

Commit

Permalink
assert: rename __ASSERT to __ASSERT__ to avoid confilt
Browse files Browse the repository at this point in the history
The definition of __ASSERT has special define in some OS and librarys,
rename to __ASSERT__ to avoid confilt

Signed-off-by: chao an <[email protected]>
  • Loading branch information
anchao committed Oct 25, 2023
1 parent cdec5c8 commit 9ceb22b
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,28 @@
#define PANIC_WITH_REGS(msg, regs) _assert(__ASSERT_FILE__, \
__ASSERT_LINE__, msg, regs)

#define __ASSERT(f, file, line, _f) \
do \
{ \
if (predict_false(!(f))) \
__assert(file, line, _f); \
} \
#define __ASSERT__(f, file, line, _f) \
do \
{ \
if (predict_false(!(f))) \
__assert(file, line, _f); \
} \
while (0)

#define __VERIFY(f, file, line, _f) \
do \
{ \
if (predict_false((f) < 0)) \
__assert(file, line, _f); \
} \
#define __VERIFY__(f, file, line, _f) \
do \
{ \
if (predict_false((f) < 0)) \
__assert(file, line, _f); \
} \
while (0)

#ifdef CONFIG_DEBUG_ASSERTIONS_EXPRESSION
# define _ASSERT(f,file,line) __ASSERT(f, file, line, #f)
# define _VERIFY(f,file,line) __VERIFY(f, file, line, #f)
# define _ASSERT(f,file,line) __ASSERT__(f, file, line, #f)
# define _VERIFY(f,file,line) __VERIFY__(f, file, line, #f)
#else
# define _ASSERT(f,file,line) __ASSERT(f, file, line, NULL)
# define _VERIFY(f,file,line) __VERIFY(f, file, line, NULL)
# define _ASSERT(f,file,line) __ASSERT__(f, file, line, NULL)
# define _VERIFY(f,file,line) __VERIFY__(f, file, line, NULL)
#endif

#ifdef CONFIG_DEBUG_ASSERTIONS
Expand Down

0 comments on commit 9ceb22b

Please sign in to comment.