diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2019-09-26 22:52:04 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-04-05 14:11:51 +1000 |
commit | a9a745e4b4838749a47857f1d0c95de52dc85f58 (patch) | |
tree | 60469e58476c5a68999ad0a2e8d58dbca8a6abb8 /py/parsenum.c | |
parent | 312c699491830daacd33f032a6d6fc6cc6ff0c96 (diff) | |
download | micropython-a9a745e4b4838749a47857f1d0c95de52dc85f58.tar.gz micropython-a9a745e4b4838749a47857f1d0c95de52dc85f58.zip |
py: Use preprocessor to detect error reporting level (terse/detailed).
Instead of compiler-level if-logic. This is necessary to know what error
strings are included in the build at the preprocessor stage, so that string
compression can be implemented.
Diffstat (limited to 'py/parsenum.c')
-rw-r--r-- | py/parsenum.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/py/parsenum.c b/py/parsenum.c index 10654115bd..d3fa918b74 100644 --- a/py/parsenum.c +++ b/py/parsenum.c @@ -144,15 +144,16 @@ overflow: } value_error: - if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) { + { + #if MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE mp_obj_t exc = mp_obj_new_exception_msg(&mp_type_ValueError, "invalid syntax for integer"); raise_exc(exc, lex); - } else if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL) { + #elif MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_NORMAL mp_obj_t exc = mp_obj_new_exception_msg_varg(&mp_type_ValueError, "invalid syntax for integer with base %d", base); raise_exc(exc, lex); - } else { + #else vstr_t vstr; mp_print_t print; vstr_init_print(&vstr, 50, &print); @@ -161,6 +162,7 @@ value_error: mp_obj_t exc = mp_obj_new_exception_arg1(&mp_type_ValueError, mp_obj_new_str_from_vstr(&mp_type_str, &vstr)); raise_exc(exc, lex); + #endif } } |