diff --git a/py/argcheck.c b/py/argcheck.c index 2a606d613aa67..a5ba0fbf69b50 100644 --- a/py/argcheck.c +++ b/py/argcheck.c @@ -32,7 +32,9 @@ void mp_arg_check_num(size_t n_args, size_t n_kw, size_t n_args_min, size_t n_args_max, bool takes_kw) { // NOTE(tannewt): This prevents this function from being optimized away. // Without it, functions can crash when reading invalid args. +#ifdef __GNUC__ __asm volatile (""); +#endif // TODO maybe take the function name as an argument so we can print nicer error messages if (n_kw && !takes_kw) { diff --git a/py/nlr.h b/py/nlr.h index 8fa6eb950d58f..9a7b81e297637 100644 --- a/py/nlr.h +++ b/py/nlr.h @@ -55,6 +55,7 @@ struct _nlr_buf_t { #elif defined(__xtensa__) void *regs[10]; #else + #undef MICROPY_NLR_SETJMP #define MICROPY_NLR_SETJMP (1) //#warning "No native NLR support for this arch, using setjmp implementation" #endif diff --git a/py/persistentcode.c b/py/persistentcode.c index ba126a3fb254c..7aec46ac59385 100644 --- a/py/persistentcode.c +++ b/py/persistentcode.c @@ -124,7 +124,11 @@ STATIC size_t read_uint(mp_reader_t *reader) { STATIC qstr load_qstr(mp_reader_t *reader) { size_t len = read_uint(reader); +#ifdef __GNUC__ char str[len]; +#else + char *str = alloca(len); +#endif read_bytes(reader, (byte*)str, len); qstr qst = qstr_from_strn(str, len); return qst; diff --git a/py/stackctrl.c b/py/stackctrl.c index b4ec15b0da1a3..3244c871a112a 100644 --- a/py/stackctrl.c +++ b/py/stackctrl.c @@ -29,7 +29,9 @@ void mp_stack_ctrl_init(void) { // Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto. +#ifdef __GNUC__ __asm volatile (""); +#endif volatile int stack_dummy; MP_STATE_THREAD(stack_top) = (char*)&stack_dummy; } @@ -41,7 +43,9 @@ void mp_stack_set_top(void *top) { mp_uint_t mp_stack_usage(void) { // Assumes descending stack // Force routine to not be inlined. Better guarantee than MP_NOINLINE for -flto. +#ifdef __GNUC__ __asm volatile (""); +#endif volatile int stack_dummy; return MP_STATE_THREAD(stack_top) - (char*)&stack_dummy; } diff --git a/tests/run-tests b/tests/run-tests index f1035c4353e91..109dfb8a7b5d4 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -389,7 +389,10 @@ def run_tests(pyb, tests, args, base_path="."): # run CPython to work out expected output e = {"PYTHONPATH": os.getcwd(), "PATH": os.environ["PATH"], - "LANG": "en_US.UTF-8"} + "LANG": "en_US.UTF-8", + "PYTHONIOENCODING": "utf-8"} + if 'SYSTEMROOT' in os.environ: + e['SYSTEMROOT'] = os.environ['SYSTEMROOT'] p = subprocess.Popen([CPYTHON3, '-B', test_file], env=e, stdout=subprocess.PIPE) output_expected = b'' while p.poll() is None: