mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
add nodiscard annotations to fix warnings in msvc
This commit is contained in:
parent
e1b27a0fc2
commit
5b172280b0
4 changed files with 74 additions and 39 deletions
|
@ -15,11 +15,29 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||
static int ok = 0;
|
||||
static int failed = 0;
|
||||
|
||||
static bool check_result(bool result, const char* testname, const char* fname, long lineno) {
|
||||
if (!(result)) {
|
||||
failed++;
|
||||
fprintf(stderr,"\n FAILED: %s: %s:%d:\n", testname, fname, lineno);
|
||||
/* exit(1); */
|
||||
}
|
||||
else {
|
||||
ok++;
|
||||
fprintf(stderr, "ok.\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#define CHECK_BODYX(name) \
|
||||
fprintf(stderr,"test: %s... ", name ); \
|
||||
for(bool done = false, result = true; !done; done = check_result(result,name,__FILE__,__LINE__))
|
||||
|
||||
|
||||
#define CHECK_BODY(name,body) \
|
||||
do { \
|
||||
fprintf(stderr,"test: %s... ", name ); \
|
||||
bool result = true; \
|
||||
do { body } while(false); \
|
||||
do { body } while(false); \
|
||||
if (!(result)) { \
|
||||
failed++; \
|
||||
fprintf(stderr, \
|
||||
|
@ -35,7 +53,7 @@ static int failed = 0;
|
|||
} \
|
||||
} while (false)
|
||||
|
||||
#define CHECK(name,expr) CHECK_BODY(name,{ result = (expr); })
|
||||
#define CHECK(name,expr) CHECK_BODYX(name){ result = (expr); }
|
||||
|
||||
// Print summary of test. Return value can be directly use as a return value for main().
|
||||
static inline int print_test_summary(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue