Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
bctoolbox
Commits
70653c2b
Commit
70653c2b
authored
1 year ago
by
Florent
Browse files
Options
Download
Patches
Plain Diff
fix clang define __gnuc__
parent
7fb73e62
feature/unitTestInCpp
1 merge request
!237
Add convenient assert macro
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/bctoolbox/tester.h
+6
-1
include/bctoolbox/tester.h
with
6 additions
and
1 deletion
include/bctoolbox/tester.h
+
6
−
1
View file @
70653c2b
...
...
@@ -178,10 +178,15 @@ BCTBX_PUBLIC int bc_assert_va(const char *file, int line, int predicate, const c
bc_assert(__FILE__, __LINE__, pred, format); \
} while (0)
// Test if __VA_OPT__ is defined
#define PP_THIRD_ARG(a, b, c, ...) c
#define VA_OPT_SUPPORTED_I(...) PP_THIRD_ARG(__VA_OPT__(, ), true, false, )
#define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?)
#define BC_PASS(msg) bc_assert(__FILE__, __LINE__, TRUE, "BC_PASS(" #msg ").")
#define BC_FAIL(msg) bc_assert(__FILE__, __LINE__, FALSE, "BC_FAIL(" #msg ").")
#define BC_ASSERT(value) bc_assert(__FILE__, __LINE__, (value), #value)
#if
def __GNUC__
// __VA_OPT__ only in gnu c or c++20
#if
VA_OPT_SUPPORTED
// __VA_OPT__ only in gnu c or c++20
#define BC_ASSERT_MSG(value, msg, ...) bc_assert_va(__FILE__, __LINE__, (value), msg __VA_OPT__(, ) __VA_ARGS__)
#else
#define BC_ASSERT_MSG(value, msg, ...) bc_assert(__FILE__, __LINE__, (value), msg)
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets