From c3fdc08b02aa9cb3d1924047912f91c17798c871 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Fri, 2 Oct 2015 14:58:56 +0200 Subject: [PATCH] [Issue #64] Prefixed all unprefixed macros with CR_ --- .../valgrind/include/valgrind/valgrind.h | 4 +- include/criterion/abort.h | 2 +- include/criterion/asprintf-compat.h | 2 +- include/criterion/common.h | 82 +++++++++---------- include/criterion/criterion.h | 42 +++++----- include/criterion/hooks.h | 82 +++++++++---------- include/criterion/logging.h | 20 ++--- include/criterion/parameterized.h | 22 ++--- include/criterion/theories.h | 6 +- src/compat/pipe.c | 2 +- src/compat/process.c | 4 +- src/compat/section.h | 6 +- src/core/ordered-set.c | 4 +- src/core/report.c | 72 ++++++++-------- src/core/report.h | 2 +- src/core/runner.c | 20 ++--- src/core/runner.h | 4 +- src/core/stats.c | 22 ++--- src/core/worker.c | 2 +- src/entry/main.c | 4 +- src/io/event.c | 4 +- src/log/logging.c | 10 +-- src/log/normal.c | 38 ++++----- src/log/tap.c | 8 +- src/string/extmatch.c | 6 +- 25 files changed, 238 insertions(+), 232 deletions(-) diff --git a/dependencies/valgrind/include/valgrind/valgrind.h b/dependencies/valgrind/include/valgrind/valgrind.h index bf5620a..9cfb700 100644 --- a/dependencies/valgrind/include/valgrind/valgrind.h +++ b/dependencies/valgrind/include/valgrind/valgrind.h @@ -6221,7 +6221,7 @@ static int #if defined(_MSC_VER) __inline #endif -VALGRIND_PRINTF(UNUSED const char *format, ...) +VALGRIND_PRINTF(CR_UNUSED const char *format, ...) { #if defined(NVALGRIND) return 0; @@ -6259,7 +6259,7 @@ static int #if defined(_MSC_VER) __inline #endif -VALGRIND_PRINTF_BACKTRACE(UNUSED const char *format, ...) +VALGRIND_PRINTF_BACKTRACE(CR_UNUSED const char *format, ...) { #if defined(NVALGRIND) return 0; diff --git a/include/criterion/abort.h b/include/criterion/abort.h index 026289f..449c0de 100644 --- a/include/criterion/abort.h +++ b/include/criterion/abort.h @@ -28,7 +28,7 @@ CR_BEGIN_C_API -CR_API NORETURN void criterion_abort_test(void); +CR_API CR_NORETURN void criterion_abort_test(void); CR_INLINE static void criterion_continue_test(void) {} CR_END_C_API diff --git a/include/criterion/asprintf-compat.h b/include/criterion/asprintf-compat.h index 6f78efd..e0316fe 100644 --- a/include/criterion/asprintf-compat.h +++ b/include/criterion/asprintf-compat.h @@ -34,7 +34,7 @@ CR_BEGIN_C_API -FORMAT(printf, 2, 3) +CR_FORMAT(printf, 2, 3) CR_API int cr_asprintf(char **strp, const char *fmt, ...); CR_API int cr_vasprintf(char **strp, const char *fmt, va_list ap); diff --git a/include/criterion/common.h b/include/criterion/common.h index ae962eb..41cc2ff 100644 --- a/include/criterion/common.h +++ b/include/criterion/common.h @@ -52,74 +52,74 @@ # endif # ifdef __APPLE__ -# define SECTION_START_PREFIX __first -# define SECTION_END_PREFIX __last -# define SECTION_START_SUFFIX(Name) __asm("section$start$__DATA$" Name) -# define SECTION_END_SUFFIX(Name) __asm("section$end$__DATA$" Name) -# define SECTION_(Name) CR_ATTRIBUTE(section("__DATA," Name)) -# define SECTION_SUFFIX_ +# define CR_SECTION_START_PREFIX __first +# define CR_SECTION_END_PREFIX __last +# define CR_SECTION_START_SUFFIX(Name) __asm("section$start$__DATA$" Name) +# define CR_SECTION_END_SUFFIX(Name) __asm("section$end$__DATA$" Name) +# define CR_SECTION_(Name) CR_ATTRIBUTE(section("__DATA," Name)) +# define CR_SECTION_SUFFIX_ # elif CR_IS_MSVC -# define SECTION_START_PREFIX __start -# define SECTION_END_PREFIX __stop -# define SECTION_START_SUFFIX(Name) -# define SECTION_END_SUFFIX(Name) -# define SECTION_(Name) \ +# define CR_SECTION_START_PREFIX __start +# define CR_SECTION_END_PREFIX __stop +# define CR_SECTION_START_SUFFIX(Name) +# define CR_SECTION_END_SUFFIX(Name) +# define CR_SECTION_(Name) \ __pragma(data_seg(push)) \ __pragma(section(Name, read)) \ __declspec(allocate(Name)) -# define SECTION_SUFFIX_ \ +# define CR_SECTION_SUFFIX_ \ __pragma(data_seg(pop)) # else -# define SECTION_START_PREFIX __start -# define SECTION_END_PREFIX __stop -# define SECTION_START_SUFFIX(Name) -# define SECTION_END_SUFFIX(Name) -# define SECTION_(Name) CR_ATTRIBUTE(section(Name)) -# define SECTION_SUFFIX_ +# define CR_SECTION_START_PREFIX __start +# define CR_SECTION_END_PREFIX __stop +# define CR_SECTION_START_SUFFIX(Name) +# define CR_SECTION_END_SUFFIX(Name) +# define CR_SECTION_(Name) CR_ATTRIBUTE(section(Name)) +# define CR_SECTION_SUFFIX_ # endif -# define MAKE_IDENTIFIER_(Prefix, Id) MAKE_IDENTIFIER__(Prefix, Id) -# define MAKE_IDENTIFIER__(Prefix, Id) Prefix ## _ ## Id +# define CR_MAKE_IDENTIFIER_(Prefix, Id) CR_MAKE_IDENTIFIER__(Prefix, Id) +# define CR_MAKE_IDENTIFIER__(Prefix, Id) Prefix ## _ ## Id -# define SECTION_START_(Name) MAKE_IDENTIFIER_(SECTION_START_PREFIX, Name) -# define SECTION_END_(Name) MAKE_IDENTIFIER_(SECTION_END_PREFIX, Name) +# define CR_SECTION_START_(Name) CR_MAKE_IDENTIFIER_(CR_SECTION_START_PREFIX, Name) +# define CR_SECTION_END_(Name) CR_MAKE_IDENTIFIER_(CR_SECTION_END_PREFIX, Name) -# define SECTION_START(Name) g_ ## Name ## _section_start -# define SECTION_END(Name) g_ ## Name ## _section_end +# define CR_SECTION_START(Name) g_ ## Name ## _section_start +# define CR_SECTION_END(Name) g_ ## Name ## _section_end -# define DECL_SECTION_LIMITS(Type, Name) DECL_SECTION_LIMITS_(Type, Name) -# define DECL_SECTION_LIMITS_(Type, Name) \ - extern Type SECTION_START_(Name) SECTION_START_SUFFIX(#Name); \ - extern Type SECTION_END_(Name) SECTION_END_SUFFIX(#Name) +# define CR_DECL_SECTION_LIMITS(Type, Name) CR_DECL_SECTION_LIMITS_(Type, Name) +# define CR_DECL_SECTION_LIMITS_(Type, Name) \ + extern Type CR_SECTION_START_(Name) CR_SECTION_START_SUFFIX(#Name); \ + extern Type CR_SECTION_END_(Name) CR_SECTION_END_SUFFIX(#Name) -# define IMPL_SECTION_LIMITS(Type, Name) \ - Type *const SECTION_START(Name) = &SECTION_START_(Name); \ - Type *const SECTION_END(Name) = &SECTION_END_(Name) +# define CR_IMPL_SECTION_LIMITS(Type, Name) \ + Type *const CR_SECTION_START(Name) = &CR_SECTION_START_(Name); \ + Type *const CR_SECTION_END(Name) = &CR_SECTION_END_(Name) # ifdef __GNUC__ -# define UNUSED CR_ATTRIBUTE(unused) -# define NORETURN CR_ATTRIBUTE(noreturn) +# define CR_UNUSED CR_ATTRIBUTE(unused) +# define CR_NORETURN CR_ATTRIBUTE(noreturn) # define CR_INLINE CR_ATTRIBUTE(always_inline) inline # elif CR_IS_MSVC -# define UNUSED -# define NORETURN __declspec(noreturn) +# define CR_UNUSED +# define CR_NORETURN __declspec(noreturn) # define CR_INLINE __forceinline # else -# define UNUSED -# define NORETURN +# define CR_UNUSED +# define CR_NORETURN # define CR_INLINE inline # endif # ifdef _WIN32 -# define SIZE_T_FORMAT "%Iu" +# define CR_SIZE_T_FORMAT "%Iu" # else -# define SIZE_T_FORMAT "%zu" +# define CR_SIZE_T_FORMAT "%zu" # endif # ifdef __GNUC__ -# define FORMAT(Archetype, Index, Ftc) CR_ATTRIBUTE(format(Archetype, Index, Ftc)) +# define CR_FORMAT(Archetype, Index, Ftc) CR_ATTRIBUTE(format(Archetype, Index, Ftc)) # else -# define FORMAT(Archetype, Index, Ftc) +# define CR_FORMAT(Archetype, Index, Ftc) # endif # if defined _WIN32 || defined __CYGWIN__ diff --git a/include/criterion/criterion.h b/include/criterion/criterion.h index 6182434..549cdcd 100644 --- a/include/criterion/criterion.h +++ b/include/criterion/criterion.h @@ -30,26 +30,26 @@ # include "assert.h" # include "alloc.h" -# define IDENTIFIER_(Category, Name, Suffix) \ +# define CR_IDENTIFIER_(Category, Name, Suffix) \ Category ## _ ## Name ## _ ## Suffix # ifdef __cplusplus -# define TEST_PROTOTYPE_(Category, Name) \ - extern "C" void IDENTIFIER_(Category, Name, impl)(void) +# define CR_TEST_PROTOTYPE_(Category, Name) \ + extern "C" void CR_IDENTIFIER_(Category, Name, impl)(void) # define CR_LANG CR_LANG_CPP # else -# define TEST_PROTOTYPE_(Category, Name) \ - void IDENTIFIER_(Category, Name, impl)(void) +# define CR_TEST_PROTOTYPE_(Category, Name) \ + void CR_IDENTIFIER_(Category, Name, impl)(void) # define CR_LANG CR_LANG_C # endif -# define SUITE_IDENTIFIER_(Name, Suffix) \ +# define CR_SUITE_IDENTIFIER_(Name, Suffix) \ suite_ ## Name ## _ ## Suffix # define Test(...) CR_EXPAND(Test_(__VA_ARGS__, .sentinel_ = 0)) # define Test_(Category, Name, ...) \ - TEST_PROTOTYPE_(Category, Name); \ - struct criterion_test_extra_data IDENTIFIER_(Category, Name, extra) = \ + CR_TEST_PROTOTYPE_(Category, Name); \ + struct criterion_test_extra_data CR_IDENTIFIER_(Category, Name, extra) = \ CR_EXPAND(CRITERION_MAKE_STRUCT(struct criterion_test_extra_data, \ .lang_ = CR_LANG, \ .kind_ = CR_TEST_NORMAL, \ @@ -59,32 +59,32 @@ .line_ = __LINE__, \ __VA_ARGS__ \ )); \ - struct criterion_test IDENTIFIER_(Category, Name, meta) = { \ + struct criterion_test CR_IDENTIFIER_(Category, Name, meta) = { \ #Name, \ #Category, \ - IDENTIFIER_(Category, Name, impl), \ - &IDENTIFIER_(Category, Name, extra) \ + CR_IDENTIFIER_(Category, Name, impl), \ + &CR_IDENTIFIER_(Category, Name, extra) \ }; \ - SECTION_("cr_tst") \ - struct criterion_test *IDENTIFIER_(Category, Name, ptr) \ - = &IDENTIFIER_(Category, Name, meta) SECTION_SUFFIX_; \ - TEST_PROTOTYPE_(Category, Name) + CR_SECTION_("cr_tst") \ + struct criterion_test *CR_IDENTIFIER_(Category, Name, ptr) \ + = &CR_IDENTIFIER_(Category, Name, meta) CR_SECTION_SUFFIX_; \ + CR_TEST_PROTOTYPE_(Category, Name) # define TestSuite(...) CR_EXPAND(TestSuite_(__VA_ARGS__, .sentinel_ = 0)) # define TestSuite_(Name, ...) \ - struct criterion_test_extra_data SUITE_IDENTIFIER_(Name, extra) = \ + struct criterion_test_extra_data CR_SUITE_IDENTIFIER_(Name, extra) = \ CR_EXPAND(CRITERION_MAKE_STRUCT(struct criterion_test_extra_data, \ .file_ = __FILE__, \ .line_ = 0, \ __VA_ARGS__ \ )); \ - struct criterion_suite SUITE_IDENTIFIER_(Name, meta) = { \ + struct criterion_suite CR_SUITE_IDENTIFIER_(Name, meta) = { \ #Name, \ - &SUITE_IDENTIFIER_(Name, extra), \ + &CR_SUITE_IDENTIFIER_(Name, extra), \ }; \ - SECTION_("cr_sts") \ - struct criterion_suite *SUITE_IDENTIFIER_(Name, ptr) \ - = &SUITE_IDENTIFIER_(Name, meta) SECTION_SUFFIX_ + CR_SECTION_("cr_sts") \ + struct criterion_suite *CR_SUITE_IDENTIFIER_(Name, ptr) \ + = &CR_SUITE_IDENTIFIER_(Name, meta) CR_SECTION_SUFFIX_ CR_BEGIN_C_API diff --git a/include/criterion/hooks.h b/include/criterion/hooks.h index 62ab483..497b047 100644 --- a/include/criterion/hooks.h +++ b/include/criterion/hooks.h @@ -43,57 +43,57 @@ typedef enum { typedef void (*f_report_hook)(); -# define HOOK_IDENTIFIER_(Suffix) HOOK_IDENTIFIER__(__LINE__, Suffix) -# define HOOK_IDENTIFIER__(Line, Suffix) HOOK_IDENTIFIER___(Line, Suffix) -# define HOOK_IDENTIFIER___(Line, Suffix) hook_l ## Line ## _ ## Suffix +# define CR_HOOK_IDENTIFIER_(Suffix) CR_HOOK_IDENTIFIER__(__LINE__, Suffix) +# define CR_HOOK_IDENTIFIER__(Line, Suffix) CR_HOOK_IDENTIFIER___(Line, Suffix) +# define CR_HOOK_IDENTIFIER___(Line, Suffix) hook_l ## Line ## _ ## Suffix # ifdef __cplusplus -# define HOOK_PROTOTYPE_ \ - extern "C" void HOOK_IDENTIFIER_(impl) +# define CR_HOOK_PROTOTYPE_ \ + extern "C" void CR_HOOK_IDENTIFIER_(impl) # else -# define HOOK_PROTOTYPE_ \ - void HOOK_IDENTIFIER_(impl) +# define CR_HOOK_PROTOTYPE_ \ + void CR_HOOK_IDENTIFIER_(impl) # endif // Section abbreviations -# define HOOK_SECTION_PRE_ALL cr_pra -# define HOOK_SECTION_PRE_SUITE cr_prs -# define HOOK_SECTION_PRE_INIT cr_pri -# define HOOK_SECTION_PRE_TEST cr_prt -# define HOOK_SECTION_ASSERT cr_ast -# define HOOK_SECTION_THEORY_FAIL cr_thf -# define HOOK_SECTION_TEST_CRASH cr_tsc -# define HOOK_SECTION_POST_TEST cr_pot -# define HOOK_SECTION_POST_FINI cr_pof -# define HOOK_SECTION_POST_SUITE cr_pos -# define HOOK_SECTION_POST_ALL cr_poa +# define CR_HOOK_SECTION_PRE_ALL cr_pra +# define CR_HOOK_SECTION_PRE_SUITE cr_prs +# define CR_HOOK_SECTION_PRE_INIT cr_pri +# define CR_HOOK_SECTION_PRE_TEST cr_prt +# define CR_HOOK_SECTION_ASSERT cr_ast +# define CR_HOOK_SECTION_THEORY_FAIL cr_thf +# define CR_HOOK_SECTION_TEST_CRASH cr_tsc +# define CR_HOOK_SECTION_POST_TEST cr_pot +# define CR_HOOK_SECTION_POST_FINI cr_pof +# define CR_HOOK_SECTION_POST_SUITE cr_pos +# define CR_HOOK_SECTION_POST_ALL cr_poa -# define HOOK_SECTION(Kind) HOOK_SECTION_ ## Kind +# define CR_HOOK_SECTION(Kind) CR_HOOK_SECTION_ ## Kind -# define HOOK_SECTION_STRINGIFY__(Sec) #Sec -# define HOOK_SECTION_STRINGIFY_(Sec) HOOK_SECTION_STRINGIFY__(Sec) -# define HOOK_SECTION_STRINGIFY(Kind) HOOK_SECTION_STRINGIFY_(HOOK_SECTION(Kind)) +# define CR_HOOK_SECTION_STRINGIFY__(Sec) #Sec +# define CR_HOOK_SECTION_STRINGIFY_(Sec) CR_HOOK_SECTION_STRINGIFY__(Sec) +# define CR_HOOK_SECTION_STRINGIFY(Kind) CR_HOOK_SECTION_STRINGIFY_(CR_HOOK_SECTION(Kind)) -# define HOOK_PARAM_TYPE_PRE_ALL struct criterion_test_set * -# define HOOK_PARAM_TYPE_PRE_SUITE struct criterion_suite_set * -# define HOOK_PARAM_TYPE_PRE_INIT struct criterion_test * -# define HOOK_PARAM_TYPE_PRE_TEST struct criterion_test * -# define HOOK_PARAM_TYPE_ASSERT struct criterion_assert_stats * -# define HOOK_PARAM_TYPE_THEORY_FAIL struct criterion_theory_stats * -# define HOOK_PARAM_TYPE_TEST_CRASH struct criterion_test_stats * -# define HOOK_PARAM_TYPE_POST_TEST struct criterion_test_stats * -# define HOOK_PARAM_TYPE_POST_FINI struct criterion_test_stats * -# define HOOK_PARAM_TYPE_POST_SUITE struct criterion_suite_stats * -# define HOOK_PARAM_TYPE_POST_ALL struct criterion_global_stats * +# define CR_HOOK_PARAM_TYPE_PRE_ALL struct criterion_test_set * +# define CR_HOOK_PARAM_TYPE_PRE_SUITE struct criterion_suite_set * +# define CR_HOOK_PARAM_TYPE_PRE_INIT struct criterion_test * +# define CR_HOOK_PARAM_TYPE_PRE_TEST struct criterion_test * +# define CR_HOOK_PARAM_TYPE_ASSERT struct criterion_assert_stats * +# define CR_HOOK_PARAM_TYPE_THEORY_FAIL struct criterion_theory_stats * +# define CR_HOOK_PARAM_TYPE_TEST_CRASH struct criterion_test_stats * +# define CR_HOOK_PARAM_TYPE_POST_TEST struct criterion_test_stats * +# define CR_HOOK_PARAM_TYPE_POST_FINI struct criterion_test_stats * +# define CR_HOOK_PARAM_TYPE_POST_SUITE struct criterion_suite_stats * +# define CR_HOOK_PARAM_TYPE_POST_ALL struct criterion_global_stats * -# define HOOK_PARAM_TYPE(Kind) HOOK_PARAM_TYPE_ ## Kind +# define CR_HOOK_PARAM_TYPE(Kind) CR_HOOK_PARAM_TYPE_ ## Kind -# define ReportHook(Kind) \ - HOOK_PROTOTYPE_(HOOK_PARAM_TYPE(Kind)); \ - SECTION_(HOOK_SECTION_STRINGIFY(Kind)) \ - f_report_hook HOOK_IDENTIFIER_(func) = \ - (f_report_hook) HOOK_IDENTIFIER_(impl) \ - SECTION_SUFFIX_; \ - HOOK_PROTOTYPE_ +# define ReportHook(Kind) \ + CR_HOOK_PROTOTYPE_(CR_HOOK_PARAM_TYPE(Kind)); \ + CR_SECTION_(CR_HOOK_SECTION_STRINGIFY(Kind)) \ + f_report_hook CR_HOOK_IDENTIFIER_(func) = \ + (f_report_hook) CR_HOOK_IDENTIFIER_(impl) \ + CR_SECTION_SUFFIX_; \ + CR_HOOK_PROTOTYPE_ #endif /* !CRITERION_HOOKS_H_ */ diff --git a/include/criterion/logging.h b/include/criterion/logging.h index 2f8e1d9..aca55ce 100644 --- a/include/criterion/logging.h +++ b/include/criterion/logging.h @@ -65,12 +65,12 @@ struct criterion_prefix_data { # define CRIT_FG_BLUE "\33[0;34m" # define CRIT_RESET "\33[0m" -# define FG_BOLD CRIT_COLOR_NORMALIZE(CRIT_FG_BOLD) -# define FG_RED CRIT_COLOR_NORMALIZE(CRIT_FG_RED) -# define FG_GREEN CRIT_COLOR_NORMALIZE(CRIT_FG_GREEN) -# define FG_GOLD CRIT_COLOR_NORMALIZE(CRIT_FG_GOLD) -# define FG_BLUE CRIT_COLOR_NORMALIZE(CRIT_FG_BLUE) -# define RESET CRIT_COLOR_NORMALIZE(CRIT_RESET) +# define CR_FG_BOLD CRIT_COLOR_NORMALIZE(CRIT_FG_BOLD) +# define CR_FG_RED CRIT_COLOR_NORMALIZE(CRIT_FG_RED) +# define CR_FG_GREEN CRIT_COLOR_NORMALIZE(CRIT_FG_GREEN) +# define CR_FG_GOLD CRIT_COLOR_NORMALIZE(CRIT_FG_GOLD) +# define CR_FG_BLUE CRIT_COLOR_NORMALIZE(CRIT_FG_BLUE) +# define CR_RESET CRIT_COLOR_NORMALIZE(CRIT_RESET) # endif CR_BEGIN_C_API @@ -87,10 +87,10 @@ extern const struct criterion_prefix_data g_criterion_logging_prefixes[]; CR_API void criterion_vlog(enum criterion_logging_level level, const char *msg, va_list args); -FORMAT(printf, 3, 4) +CR_FORMAT(printf, 3, 4) CR_API void criterion_plog(enum criterion_logging_level level, const struct criterion_prefix_data *prefix, const char *msg, ...); -FORMAT(printf, 2, 3) +CR_FORMAT(printf, 2, 3) CR_API void criterion_log(enum criterion_logging_level level, const char *msg, ...); # define criterion_info(...) criterion_log(CRITERION_INFO, __VA_ARGS__) @@ -124,7 +124,7 @@ extern struct criterion_output_provider tap_logging; CR_END_C_API -#define NORMAL_LOGGING (&normal_logging) -#define TAP_LOGGING (&tap_logging) +#define CR_NORMAL_LOGGING (&normal_logging) +#define CR_TAP_LOGGING (&tap_logging) #endif /* !CRITERION_LOGGING_H_ */ diff --git a/include/criterion/parameterized.h b/include/criterion/parameterized.h index d5cde42..cbf0aa3 100644 --- a/include/criterion/parameterized.h +++ b/include/criterion/parameterized.h @@ -9,10 +9,10 @@ # ifdef __cplusplus # define CR_PARAM_TEST_PROTOTYPE_(Param, Category, Name) \ - extern "C" void IDENTIFIER_(Category, Name, impl)(Param) + extern "C" void CR_IDENTIFIER_(Category, Name, impl)(Param) # else # define CR_PARAM_TEST_PROTOTYPE_(Param, Category, Name) \ - void IDENTIFIER_(Category, Name, impl)(Param) + void CR_IDENTIFIER_(Category, Name, impl)(Param) # endif # define ParameterizedTest(...) \ @@ -20,28 +20,28 @@ # define ParameterizedTest_(Param, Category, Name, ...) \ CR_PARAM_TEST_PROTOTYPE_(Param, Category, Name); \ - struct criterion_test_extra_data IDENTIFIER_(Category, Name, extra) = \ + struct criterion_test_extra_data CR_IDENTIFIER_(Category, Name, extra) = \ CR_EXPAND(CRITERION_MAKE_STRUCT(struct criterion_test_extra_data, \ .kind_ = CR_TEST_PARAMETERIZED, \ - .param_ = IDENTIFIER_(Category, Name, param), \ + .param_ = CR_IDENTIFIER_(Category, Name, param), \ .identifier_ = #Category "/" #Name, \ .file_ = __FILE__, \ .line_ = __LINE__, \ __VA_ARGS__ \ )); \ - struct criterion_test IDENTIFIER_(Category, Name, meta) = { \ + struct criterion_test CR_IDENTIFIER_(Category, Name, meta) = { \ #Name, \ #Category, \ - (void(*)(void)) IDENTIFIER_(Category, Name, impl), \ - &IDENTIFIER_(Category, Name, extra) \ + (void(*)(void)) CR_IDENTIFIER_(Category, Name, impl), \ + &CR_IDENTIFIER_(Category, Name, extra) \ }; \ - SECTION_("cr_tst") \ - struct criterion_test *IDENTIFIER_(Category, Name, ptr) \ - = &IDENTIFIER_(Category, Name, meta) SECTION_SUFFIX_; \ + CR_SECTION_("cr_tst") \ + struct criterion_test *CR_IDENTIFIER_(Category, Name, ptr) \ + = &CR_IDENTIFIER_(Category, Name, meta) CR_SECTION_SUFFIX_; \ CR_PARAM_TEST_PROTOTYPE_(Param, Category, Name) # define ParameterizedTestParameters(Category, Name) \ - static struct criterion_test_params IDENTIFIER_(Category, Name, param)(void) + static struct criterion_test_params CR_IDENTIFIER_(Category, Name, param)(void) # ifdef __cplusplus # define cr_make_param_array(Type, Array, ...) \ diff --git a/include/criterion/theories.h b/include/criterion/theories.h index 5cdf76a..5a1227e 100644 --- a/include/criterion/theories.h +++ b/include/criterion/theories.h @@ -54,10 +54,10 @@ CR_API void cr_theory_reset(struct criterion_theory_context *ctx); CR_API void cr_theory_call(struct criterion_theory_context *ctx, void (*fnptr)(void)); # define TheoryDataPoints(Category, Name) \ - static struct criterion_datapoints IDENTIFIER_(Category, Name, dps)[] + static struct criterion_datapoints CR_IDENTIFIER_(Category, Name, dps)[] # define TheoryDataPoint(Category, Name) \ - (IDENTIFIER_(Category, Name, dps)) + (CR_IDENTIFIER_(Category, Name, dps)) # ifdef __cplusplus # define CR_TH_VA_NUM(Type, ...) criterion_va_num__(__VA_ARGS__) @@ -127,7 +127,7 @@ struct criterion_datapoints { CR_API void cr_theory_main(struct criterion_datapoints *dps, size_t datapoints, void (*fnptr)(void)); # define CR_VAARG_ID(Suffix, Category, Name, ...) \ - IDENTIFIER_(Category, Name, Suffix) + CR_IDENTIFIER_(Category, Name, Suffix) # define Theory(Args, ...) \ void CR_EXPAND(CR_VAARG_ID(theory, __VA_ARGS__,))Args; \ diff --git a/src/compat/pipe.c b/src/compat/pipe.c index 23c4b4a..30a3ef1 100644 --- a/src/compat/pipe.c +++ b/src/compat/pipe.c @@ -182,7 +182,7 @@ void pipe_std_redirect(s_pipe_handle *pipe, enum criterion_std_fd fd) { #endif } -void close_pipe_file_handle(void *ptr, UNUSED void *meta) { +void close_pipe_file_handle(void *ptr, CR_UNUSED void *meta) { s_pipe_file_handle *h = ptr; #ifdef VANILLA_WIN32 CloseHandle(h->fh); diff --git a/src/compat/process.c b/src/compat/process.c index 4e6c286..5b246ac 100644 --- a/src/compat/process.c +++ b/src/compat/process.c @@ -115,7 +115,7 @@ static struct full_context local_ctx; # error Unsupported compiler. Use GCC or Clang under *nixes. # endif -static void handle_sigchld(UNUSED int sig) { +static void handle_sigchld(CR_UNUSED int sig) { assert(sig == SIGCHLD); int fd = g_worker_pipe->fds[1]; @@ -151,7 +151,7 @@ struct wait_context { }; static void CALLBACK handle_child_terminated(PVOID lpParameter, - UNUSED BOOLEAN TimerOrWaitFired) { + CR_UNUSED BOOLEAN TimerOrWaitFired) { assert(!TimerOrWaitFired); diff --git a/src/compat/section.h b/src/compat/section.h index 9f6359e..7ff0755 100644 --- a/src/compat/section.h +++ b/src/compat/section.h @@ -24,6 +24,8 @@ #ifndef SECTION_H_ # define SECTION_H_ +# include "criterion/common.h" + # ifdef _WIN32 void *get_win_section_start(const char *section); void *get_win_section_end(const char *section); @@ -39,8 +41,8 @@ void *get_osx_section_end(const char *section); # define GET_SECTION_START(Name) get_osx_section_start(CR_STRINGIFY(Name)) # define GET_SECTION_END(Name) get_osx_section_end(CR_STRINGIFY(Name)) # else -# define GET_SECTION_START(Name) SECTION_START(Name) -# define GET_SECTION_END(Name) SECTION_END(Name) +# define GET_SECTION_START(Name) CR_SECTION_START(Name) +# define GET_SECTION_END(Name) CR_SECTION_END(Name) # endif #endif /* !SECTION_H_ */ diff --git a/src/core/ordered-set.c b/src/core/ordered-set.c index 0063023..fa9c5c5 100644 --- a/src/core/ordered-set.c +++ b/src/core/ordered-set.c @@ -27,11 +27,11 @@ #include #include "common.h" -static void destroy_ordered_set(void *ptr, UNUSED void *meta) { +static void destroy_ordered_set(void *ptr, CR_UNUSED void *meta) { sfree(((struct criterion_ordered_set *) ptr)->first); } -static INLINE void nothing(UNUSED void *ptr, UNUSED void *meta) {} +static INLINE void nothing(CR_UNUSED void *ptr, CR_UNUSED void *meta) {} static void destroy_ordered_set_node(void *ptr, void *meta) { struct criterion_ordered_set *set = *(void **) meta; diff --git a/src/core/report.c b/src/core/report.c index 025d484..7112319 100644 --- a/src/core/report.c +++ b/src/core/report.c @@ -36,39 +36,39 @@ static inline void nothing() {} #define IMPL_CALL_REPORT_HOOKS(Kind) \ - IMPL_SECTION_LIMITS(f_report_hook, HOOK_SECTION(Kind)); \ + CR_IMPL_SECTION_LIMITS(f_report_hook, CR_HOOK_SECTION(Kind)); \ void call_report_hooks_##Kind(void *data) { \ - for (f_report_hook *hook = GET_SECTION_START(HOOK_SECTION(Kind)); \ - hook < (f_report_hook*) GET_SECTION_END(HOOK_SECTION(Kind)); \ + for (f_report_hook *hook = GET_SECTION_START(CR_HOOK_SECTION(Kind)); \ + hook < (f_report_hook*) GET_SECTION_END(CR_HOOK_SECTION(Kind)); \ ++hook) { \ (*hook ? *hook : nothing)(data); \ } \ } #ifdef _MSC_VER -f_report_hook SECTION_START_(HOOK_SECTION(PRE_ALL)); -f_report_hook SECTION_START_(HOOK_SECTION(PRE_SUITE)); -f_report_hook SECTION_START_(HOOK_SECTION(PRE_INIT)); -f_report_hook SECTION_START_(HOOK_SECTION(PRE_TEST)); -f_report_hook SECTION_START_(HOOK_SECTION(ASSERT)); -f_report_hook SECTION_START_(HOOK_SECTION(THEORY_FAIL)); -f_report_hook SECTION_START_(HOOK_SECTION(TEST_CRASH)); -f_report_hook SECTION_START_(HOOK_SECTION(POST_TEST)); -f_report_hook SECTION_START_(HOOK_SECTION(POST_FINI)); -f_report_hook SECTION_START_(HOOK_SECTION(POST_SUITE)); -f_report_hook SECTION_START_(HOOK_SECTION(POST_ALL)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(PRE_ALL)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(PRE_SUITE)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(PRE_INIT)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(PRE_TEST)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(ASSERT)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(THEORY_FAIL)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(TEST_CRASH)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(POST_TEST)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(POST_FINI)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(POST_SUITE)); +f_report_hook CR_SECTION_START_(CR_HOOK_SECTION(POST_ALL)); -f_report_hook SECTION_END_(HOOK_SECTION(PRE_ALL)); -f_report_hook SECTION_END_(HOOK_SECTION(PRE_SUITE)); -f_report_hook SECTION_END_(HOOK_SECTION(PRE_INIT)); -f_report_hook SECTION_END_(HOOK_SECTION(PRE_TEST)); -f_report_hook SECTION_END_(HOOK_SECTION(ASSERT)); -f_report_hook SECTION_END_(HOOK_SECTION(THEORY_FAIL)); -f_report_hook SECTION_END_(HOOK_SECTION(TEST_CRASH)); -f_report_hook SECTION_END_(HOOK_SECTION(POST_TEST)); -f_report_hook SECTION_END_(HOOK_SECTION(POST_FINI)); -f_report_hook SECTION_END_(HOOK_SECTION(POST_SUITE)); -f_report_hook SECTION_END_(HOOK_SECTION(POST_ALL)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(PRE_ALL)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(PRE_SUITE)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(PRE_INIT)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(PRE_TEST)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(ASSERT)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(THEORY_FAIL)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(TEST_CRASH)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(POST_TEST)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(POST_FINI)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(POST_SUITE)); +f_report_hook CR_SECTION_END_(CR_HOOK_SECTION(POST_ALL)); #endif IMPL_CALL_REPORT_HOOKS(PRE_ALL); @@ -83,15 +83,15 @@ IMPL_CALL_REPORT_HOOKS(POST_FINI); IMPL_CALL_REPORT_HOOKS(POST_SUITE); IMPL_CALL_REPORT_HOOKS(POST_ALL); -ReportHook(PRE_ALL)(UNUSED struct criterion_test_set *arg) {} -ReportHook(PRE_SUITE)(UNUSED struct criterion_suite_set *arg) {} -ReportHook(PRE_INIT)(UNUSED struct criterion_test *arg) {} -ReportHook(PRE_TEST)(UNUSED struct criterion_test *arg) {} -ReportHook(ASSERT)(UNUSED struct criterion_assert_stats *arg) {} -ReportHook(THEORY_FAIL)(UNUSED struct criterion_theory_stats *arg) {} -ReportHook(TEST_CRASH)(UNUSED struct criterion_test_stats *arg) {} -ReportHook(POST_TEST)(UNUSED struct criterion_test_stats *arg) {} -ReportHook(POST_FINI)(UNUSED struct criterion_test_stats *arg) {} -ReportHook(POST_SUITE)(UNUSED struct criterion_suite_stats *arg) {} -ReportHook(POST_ALL)(UNUSED struct criterion_global_stats *arg) {} +ReportHook(PRE_ALL)(CR_UNUSED struct criterion_test_set *arg) {} +ReportHook(PRE_SUITE)(CR_UNUSED struct criterion_suite_set *arg) {} +ReportHook(PRE_INIT)(CR_UNUSED struct criterion_test *arg) {} +ReportHook(PRE_TEST)(CR_UNUSED struct criterion_test *arg) {} +ReportHook(ASSERT)(CR_UNUSED struct criterion_assert_stats *arg) {} +ReportHook(THEORY_FAIL)(CR_UNUSED struct criterion_theory_stats *arg) {} +ReportHook(TEST_CRASH)(CR_UNUSED struct criterion_test_stats *arg) {} +ReportHook(POST_TEST)(CR_UNUSED struct criterion_test_stats *arg) {} +ReportHook(POST_FINI)(CR_UNUSED struct criterion_test_stats *arg) {} +ReportHook(POST_SUITE)(CR_UNUSED struct criterion_suite_stats *arg) {} +ReportHook(POST_ALL)(CR_UNUSED struct criterion_global_stats *arg) {} diff --git a/src/core/report.h b/src/core/report.h index 69f1126..dfee5ba 100644 --- a/src/core/report.h +++ b/src/core/report.h @@ -30,7 +30,7 @@ # define report(Kind, Data) call_report_hooks_##Kind(Data) # define DECL_CALL_REPORT_HOOKS(Kind) \ - DECL_SECTION_LIMITS(f_report_hook, HOOK_SECTION(Kind)); \ + CR_DECL_SECTION_LIMITS(f_report_hook, CR_HOOK_SECTION(Kind)); \ void call_report_hooks_##Kind(void *data) DECL_CALL_REPORT_HOOKS(PRE_ALL); diff --git a/src/core/runner.c b/src/core/runner.c index 3ca3281..1f657bf 100644 --- a/src/core/runner.c +++ b/src/core/runner.c @@ -72,14 +72,14 @@ static msg_t msg_valgrind_jobs = "%sWarning! Criterion has detected " #ifdef _MSC_VER -struct criterion_test *SECTION_START_(cr_tst); -struct criterion_suite *SECTION_START_(cr_sts); -struct criterion_test *SECTION_END_(cr_tst); -struct criterion_suite *SECTION_END_(cr_sts); +struct criterion_test *CR_SECTION_START_(cr_tst); +struct criterion_suite *CR_SECTION_START_(cr_sts); +struct criterion_test *CR_SECTION_END_(cr_tst); +struct criterion_suite *CR_SECTION_END_(cr_sts); #endif -IMPL_SECTION_LIMITS(struct criterion_test*, cr_tst); -IMPL_SECTION_LIMITS(struct criterion_suite*, cr_sts); +CR_IMPL_SECTION_LIMITS(struct criterion_test*, cr_tst); +CR_IMPL_SECTION_LIMITS(struct criterion_suite*, cr_sts); // This is here to make the test suite & test sections non-empty TestSuite(); @@ -97,12 +97,12 @@ int cmp_test(void *a, void *b) { return strcmp(s1->name, s2->name); } -static void dtor_suite_set(void *ptr, UNUSED void *meta) { +static void dtor_suite_set(void *ptr, CR_UNUSED void *meta) { struct criterion_suite_set *s = ptr; sfree(s->tests); } -static void dtor_test_set(void *ptr, UNUSED void *meta) { +static void dtor_test_set(void *ptr, CR_UNUSED void *meta) { struct criterion_test_set *t = ptr; sfree(t->suites); } @@ -425,10 +425,10 @@ static int criterion_run_all_tests_impl(struct criterion_test_set *set) { if (RUNNING_ON_VALGRIND) { if (!criterion_options.no_early_exit) criterion_pimportant(CRITERION_PREFIX_DASHES, - _(msg_valgrind_early_exit), FG_BOLD, RESET); + _(msg_valgrind_early_exit), CR_FG_BOLD, CR_RESET); if (criterion_options.jobs != 1) criterion_pimportant(CRITERION_PREFIX_DASHES, - _(msg_valgrind_jobs), FG_BOLD, RESET); + _(msg_valgrind_jobs), CR_FG_BOLD, CR_RESET); } fflush(NULL); // flush everything before forking diff --git a/src/core/runner.h b/src/core/runner.h index 9b49839..0eafbb7 100644 --- a/src/core/runner.h +++ b/src/core/runner.h @@ -27,8 +27,8 @@ # include "criterion/types.h" # include "compat/pipe.h" -DECL_SECTION_LIMITS(struct criterion_test*, cr_tst); -DECL_SECTION_LIMITS(struct criterion_suite*, cr_sts); +CR_DECL_SECTION_LIMITS(struct criterion_test*, cr_tst); +CR_DECL_SECTION_LIMITS(struct criterion_suite*, cr_sts); struct criterion_test_set *criterion_init(void); void run_test_child(struct criterion_test *test, struct criterion_suite *suite); diff --git a/src/core/stats.c b/src/core/stats.c index bba2f8b..dd8969b 100644 --- a/src/core/stats.c +++ b/src/core/stats.c @@ -55,13 +55,13 @@ static void push_test_crash(s_glob_stats *stats, s_test_stats *tstats, void *data); -static void nothing(UNUSED s_glob_stats *stats, - UNUSED s_suite_stats *sstats, - UNUSED s_test_stats *tstats, - UNUSED void *data) { +static void nothing(CR_UNUSED s_glob_stats *stats, + CR_UNUSED s_suite_stats *sstats, + CR_UNUSED s_test_stats *tstats, + CR_UNUSED void *data) { }; -static void destroy_stats(void *ptr, UNUSED void *meta) { +static void destroy_stats(void *ptr, CR_UNUSED void *meta) { s_glob_stats *stats = ptr; for (s_suite_stats *s = stats->suites, *next; s; s = next) { next = s->next; @@ -79,7 +79,7 @@ s_glob_stats *stats_init(void) { return stats; } -static void destroy_suite_stats(void *ptr, UNUSED void *meta) { +static void destroy_suite_stats(void *ptr, CR_UNUSED void *meta) { s_suite_stats *stats = ptr; for (s_test_stats *t = stats->tests, *next; t; t = next) { next = t->next; @@ -97,7 +97,7 @@ s_suite_stats *suite_stats_init(struct criterion_suite *s) { return stats; } -static void destroy_test_stats(void *ptr, UNUSED void *meta) { +static void destroy_test_stats(void *ptr, CR_UNUSED void *meta) { s_test_stats *stats = ptr; for (s_assert_stats *a = stats->asserts, *next; a; a = next) { next = a->next; @@ -147,8 +147,8 @@ void stat_push_event(s_glob_stats *stats, static void push_pre_suite(s_glob_stats *stats, s_suite_stats *suite, - UNUSED s_test_stats *test, - UNUSED void *ptr) { + CR_UNUSED s_test_stats *test, + CR_UNUSED void *ptr) { suite->next = stats->suites; stats->suites = sref(suite); ++stats->nb_suites; @@ -163,7 +163,7 @@ static INLINE bool is_disabled(struct criterion_test *t, static void push_pre_init(s_glob_stats *stats, s_suite_stats *suite, s_test_stats *test, - UNUSED void *ptr) { + CR_UNUSED void *ptr) { test->next = suite->tests; suite->tests = sref(test); ++stats->nb_tests; @@ -230,7 +230,7 @@ static void push_post_test(s_glob_stats *stats, static void push_test_crash(s_glob_stats *stats, s_suite_stats *suite, s_test_stats *test, - UNUSED void *ptr) { + CR_UNUSED void *ptr) { test->failed = 1; test->crashed = 1; ++suite->tests_failed; diff --git a/src/core/worker.c b/src/core/worker.c index 3a6240d..8049fac 100644 --- a/src/core/worker.c +++ b/src/core/worker.c @@ -47,7 +47,7 @@ bool is_runner(void) { return is_current_process(g_current_proc); } -static void close_process(void *ptr, UNUSED void *meta) { +static void close_process(void *ptr, CR_UNUSED void *meta) { struct worker *proc = ptr; sfree(proc->in); sfree(proc->ctx.suite_stats); diff --git a/src/entry/main.c b/src/entry/main.c index ee1d2e5..d67989f 100644 --- a/src/entry/main.c +++ b/src/entry/main.c @@ -102,7 +102,7 @@ int list_tests(bool unicode) { if (!tests) continue; - printf("%s: " SIZE_T_FORMAT " test%s\n", + printf("%s: " CR_SIZE_T_FORMAT " test%s\n", s->suite.name, tests, tests == 1 ? "" : "s"); @@ -206,7 +206,7 @@ int criterion_handle_args(int argc, char *argv[], bool handle_unknown_arg) { } } if (use_tap) - criterion_options.output_provider = TAP_LOGGING; + criterion_options.output_provider = CR_TAP_LOGGING; if (do_print_usage) return print_usage(argv[0]); if (do_print_version) diff --git a/src/io/event.c b/src/io/event.c index 99bdd00..d7b4dc6 100644 --- a/src/io/event.c +++ b/src/io/event.c @@ -34,12 +34,12 @@ s_pipe_file_handle *g_event_pipe = NULL; -void destroy_event(void *ptr, UNUSED void *meta) { +void destroy_event(void *ptr, CR_UNUSED void *meta) { struct event *ev = ptr; free(ev->data); } -void destroy_assert_event(void *ptr, UNUSED void *meta) { +void destroy_assert_event(void *ptr, CR_UNUSED void *meta) { struct event *ev = ptr; free((void*) ((struct criterion_assert_stats *) ev->data)->message); free(ev->data); diff --git a/src/log/logging.c b/src/log/logging.c index a09b2d7..932337f 100644 --- a/src/log/logging.c +++ b/src/log/logging.c @@ -63,16 +63,16 @@ void criterion_plog(enum criterion_logging_level level, const struct criterion_p fprintf(stderr, _(ERROR_FORMAT), CRIT_COLOR_NORMALIZE(prefix->color), prefix->prefix, - RESET, - FG_RED, - FG_BOLD, + CR_RESET, + CR_FG_RED, + CR_FG_BOLD, formatted_msg, - RESET); + CR_RESET); } else { fprintf(stderr, _(LOG_FORMAT), CRIT_COLOR_NORMALIZE(prefix->color), prefix->prefix, - RESET, + CR_RESET, formatted_msg); } diff --git a/src/log/normal.c b/src/log/normal.c index b48486a..e549f1f 100644 --- a/src/log/normal.c +++ b/src/log/normal.c @@ -94,7 +94,7 @@ static msg_t msg_post_all = "%sSynthesis: Tested: %s%lu%s " "%s\n"; #endif -void normal_log_pre_all(UNUSED struct criterion_test_set *set) { +void normal_log_pre_all(CR_UNUSED struct criterion_test_set *set) { criterion_pinfo(CRITERION_PREFIX_DASHES, _(msg_pre_all), VERSION); } @@ -150,12 +150,12 @@ void normal_log_post_all(struct criterion_global_stats *stats) { criterion_pimportant(CRITERION_PREFIX_EQUALS, _(msg_post_all), - FG_BOLD, - FG_BLUE, (unsigned long) tested, FG_BOLD, - FG_GREEN, (unsigned long) stats->tests_passed, FG_BOLD, - FG_RED, (unsigned long) stats->tests_failed, FG_BOLD, - FG_RED, (unsigned long) stats->tests_crashed, FG_BOLD, - RESET); + CR_FG_BOLD, + CR_FG_BLUE, (unsigned long) tested, CR_FG_BOLD, + CR_FG_GREEN, (unsigned long) stats->tests_passed, CR_FG_BOLD, + CR_FG_RED, (unsigned long) stats->tests_failed, CR_FG_BOLD, + CR_FG_RED, (unsigned long) stats->tests_crashed, CR_FG_BOLD, + CR_RESET); } void normal_log_assert(struct criterion_assert_stats *stats) { @@ -172,8 +172,8 @@ void normal_log_assert(struct criterion_assert_stats *stats) { bool sf = criterion_options.short_filename; criterion_pimportant(CRITERION_PREFIX_DASHES, _(msg_assert_fail), - FG_BOLD, sf ? basename_compat(stats->file) : stats->file, RESET, - FG_RED, stats->line, RESET, + CR_FG_BOLD, sf ? basename_compat(stats->file) : stats->file, CR_RESET, + CR_FG_RED, stats->line, CR_RESET, line); #ifdef VANILLA_WIN32 @@ -190,30 +190,30 @@ void normal_log_test_crash(struct criterion_test_stats *stats) { bool sf = criterion_options.short_filename; criterion_pimportant(CRITERION_PREFIX_DASHES, _(msg_test_crash_line), - FG_BOLD, sf ? basename_compat(stats->file) : stats->file, RESET, - FG_RED, stats->progress, RESET); + CR_FG_BOLD, sf ? basename_compat(stats->file) : stats->file, CR_RESET, + CR_FG_RED, stats->progress, CR_RESET); criterion_pimportant(CRITERION_PREFIX_FAIL, _(msg_test_crash), stats->test->category, stats->test->name); } -void normal_log_other_crash(UNUSED struct criterion_test_stats *stats) { +void normal_log_other_crash(CR_UNUSED struct criterion_test_stats *stats) { criterion_pimportant(CRITERION_PREFIX_DASHES, _(msg_test_other_crash), - FG_BOLD, stats->test->category, stats->test->name, RESET); + CR_FG_BOLD, stats->test->category, stats->test->name, CR_RESET); } -void normal_log_abnormal_exit(UNUSED struct criterion_test_stats *stats) { +void normal_log_abnormal_exit(CR_UNUSED struct criterion_test_stats *stats) { criterion_pimportant(CRITERION_PREFIX_DASHES, _(msg_test_abnormal_exit), - FG_BOLD, stats->test->category, stats->test->name, RESET); + CR_FG_BOLD, stats->test->category, stats->test->name, CR_RESET); } void normal_log_pre_suite(struct criterion_suite_set *set) { criterion_pinfo(CRITERION_PREFIX_EQUALS, _s(msg_pre_suite[0], msg_pre_suite[1], set->tests->size), - FG_BLUE, (unsigned long) set->tests->size, RESET, - FG_GOLD, set->suite.name, RESET); + CR_FG_BLUE, (unsigned long) set->tests->size, CR_RESET, + CR_FG_GOLD, set->suite.name, CR_RESET); } void normal_log_theory_fail(struct criterion_theory_stats *stats) { @@ -224,7 +224,7 @@ void normal_log_theory_fail(struct criterion_theory_stats *stats) { stats->formatted_args); } -void normal_log_test_timeout(UNUSED struct criterion_test_stats *stats) { +void normal_log_test_timeout(CR_UNUSED struct criterion_test_stats *stats) { criterion_pimportant(CRITERION_PREFIX_FAIL, _(msg_test_timeout), stats->test->category, @@ -232,7 +232,7 @@ void normal_log_test_timeout(UNUSED struct criterion_test_stats *stats) { stats->elapsed_time); } -void normal_log_test_abort(UNUSED struct criterion_test_stats *stats, const char *msg) { +void normal_log_test_abort(CR_UNUSED struct criterion_test_stats *stats, const char *msg) { char *dup = strdup(msg); diff --git a/src/log/tap.c b/src/log/tap.c index 3a48231..70edb14 100644 --- a/src/log/tap.c +++ b/src/log/tap.c @@ -39,12 +39,16 @@ #endif static void print_prelude(struct criterion_global_stats *stats) { - criterion_important("TAP version 13\n1.." SIZE_T_FORMAT "\n", stats->nb_tests); + criterion_important("TAP version 13\n1.." + CR_SIZE_T_FORMAT + "\n", stats->nb_tests); criterion_important("# Criterion v%s\n", VERSION); } static void print_pre_suite(struct criterion_suite_stats *stats) { - criterion_important("\n# Running " SIZE_T_FORMAT " tests from %s\n", + criterion_important("\n# Running " + CR_SIZE_T_FORMAT + " tests from %s\n", stats->nb_tests, stats->suite->name); } diff --git a/src/string/extmatch.c b/src/string/extmatch.c index e6c75fc..b838ff9 100644 --- a/src/string/extmatch.c +++ b/src/string/extmatch.c @@ -127,7 +127,7 @@ static inline void handle_special(struct context *ctx, handler_arg strs[5]) { } # define Handler(Name, ...) \ - static void Name(struct context *ctx, UNUSED char c) { \ + static void Name(struct context *ctx, CR_UNUSED char c) { \ handle_special(ctx, (handler_arg[5]) { \ __VA_ARGS__ \ }); \ @@ -146,7 +146,7 @@ Handler(handle_excl, Handler(handle_at, [ELSESTR] = {_, "@"}); # undef _ -static void handle_rbra(struct context *ctx, UNUSED char c) { +static void handle_rbra(struct context *ctx, CR_UNUSED char c) { copy_char(ctx, c); if (peek_char(ctx) == '!') { read_char(ctx); @@ -159,7 +159,7 @@ static void escape_char(struct context *ctx, char c) { copy_char(ctx, c); } -static void escape_pipe(struct context *ctx, UNUSED char c) { +static void escape_pipe(struct context *ctx, CR_UNUSED char c) { if (ctx->depth == 0) copy_char(ctx, '\\'); copy_char(ctx, '|');