From 4158ddfc17c825017d4e989d2cdf027f9563e3d6 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 8 Nov 2022 15:40:59 -0600 Subject: [PATCH] compile out terse mismatch message when not used --- py/argcheck.c | 2 ++ py/runtime.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/py/argcheck.c b/py/argcheck.c index 9ec21d4898..01c712ac36 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -145,9 +145,11 @@ void mp_arg_parse_all_kw_array(size_t n_pos, size_t n_kw, const mp_obj_t *args, mp_arg_parse_all(n_pos, args, &kw_args, n_allowed, allowed, out_vals); } +#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE NORETURN void mp_arg_error_terse_mismatch(void) { mp_raise_TypeError(MP_ERROR_TEXT("argument num/types mismatch")); } +#endif #if MICROPY_CPYTHON_COMPAT NORETURN void mp_arg_error_unimpl_kw(void) { diff --git a/py/runtime.h b/py/runtime.h index 951165e279..a5f66b1507 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -91,7 +91,9 @@ static inline void mp_arg_check_num(size_t n_args, size_t n_kw, size_t n_args_mi } void mp_arg_parse_all(size_t n_pos, const mp_obj_t *pos, mp_map_t *kws, size_t n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals); void mp_arg_parse_all_kw_array(size_t n_pos, size_t n_kw, const mp_obj_t *args, size_t n_allowed, const mp_arg_t *allowed, mp_arg_val_t *out_vals); +#if MICROPY_ERROR_REPORTING <= MICROPY_ERROR_REPORTING_TERSE NORETURN void mp_arg_error_terse_mismatch(void); +#endif NORETURN void mp_arg_error_unimpl_kw(void); NORETURN void mp_arg_error_invalid(qstr arg_name);