diff --git a/py/compile.c b/py/compile.c index d40d8a1ff..df6dab063 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2649,7 +2649,7 @@ STATIC void compile_const_object(compiler_t *comp, mp_parse_node_struct_t *pns) } typedef void (*compile_function_t)(compiler_t*, mp_parse_node_struct_t*); -STATIC compile_function_t compile_function[] = { +STATIC const compile_function_t compile_function[] = { #define nc NULL #define c(f) compile_##f #define DEF_RULE(rule, comp, kind, ...) comp, diff --git a/py/lexer.c b/py/lexer.c index 1639740d3..820f91be7 100644 --- a/py/lexer.c +++ b/py/lexer.c @@ -190,7 +190,7 @@ STATIC void indent_pop(mp_lexer_t *lex) { // c = continue with , if this opchar matches then continue matching // this means if the start of two ops are the same then they are equal til the last char -STATIC const char *tok_enc = +STATIC const char *const tok_enc = "()[]{},:;@~" // singles " >= >> >>= @@ -227,7 +227,7 @@ STATIC const uint8_t tok_enc_kind[] = { }; // must have the same order as enum in lexer.h -STATIC const char *tok_kw[] = { +STATIC const char *const tok_kw[] = { "False", "None", "True", diff --git a/py/map.c b/py/map.c index 445b20660..0916ec522 100644 --- a/py/map.c +++ b/py/map.c @@ -49,7 +49,7 @@ const mp_map_t mp_const_empty_map = { // The first set of sizes are chosen so the allocation fits exactly in a // 4-word GC block, and it's not so important for these small values to be // prime. The latter sizes are prime and increase at an increasing rate. -STATIC uint16_t hash_allocation_sizes[] = { +STATIC const uint16_t hash_allocation_sizes[] = { 0, 2, 4, 6, 8, 10, 12, // +2 17, 23, 29, 37, 47, 59, 73, // *1.25 97, 127, 167, 223, 293, 389, 521, 691, 919, 1223, 1627, 2161, // *1.33 diff --git a/py/objdict.c b/py/objdict.c index cc1f502d0..04da2bf62 100644 --- a/py/objdict.c +++ b/py/objdict.c @@ -414,7 +414,7 @@ typedef enum _mp_dict_view_kind_t { MP_DICT_VIEW_VALUES, } mp_dict_view_kind_t; -STATIC char *mp_dict_view_names[] = {"dict_items", "dict_keys", "dict_values"}; +STATIC const char *const mp_dict_view_names[] = {"dict_items", "dict_keys", "dict_values"}; typedef struct _mp_obj_dict_view_it_t { mp_obj_base_t base; diff --git a/py/parse.c b/py/parse.c index 0b60569d0..7da484c49 100644 --- a/py/parse.c +++ b/py/parse.c @@ -104,7 +104,7 @@ enum { #undef one_or_more #undef DEF_RULE -STATIC const rule_t *rules[] = { +STATIC const rule_t *const rules[] = { #define DEF_RULE(rule, comp, kind, ...) &rule_##rule, #include "py/grammar.h" #undef DEF_RULE diff --git a/py/repl.c b/py/repl.c index 4006bbfb6..997d80005 100644 --- a/py/repl.c +++ b/py/repl.c @@ -223,7 +223,7 @@ mp_uint_t mp_repl_autocomplete(const char *str, mp_uint_t len, const mp_print_t // If there're no better alternatives, and if it's first word // in the line, try to complete "import". if (s_start == org_str) { - static char import_str[] = "import "; + static const char import_str[] = "import "; if (memcmp(s_start, import_str, s_len) == 0) { *compl_str = import_str + s_len; return sizeof(import_str) - 1 - s_len; diff --git a/py/vmentrytable.h b/py/vmentrytable.h index f3143b5d1..9df1e40a3 100644 --- a/py/vmentrytable.h +++ b/py/vmentrytable.h @@ -29,7 +29,7 @@ #pragma clang diagnostic ignored "-Winitializer-overrides" #endif // __clang__ -static void* entry_table[256] = { +static const void *const entry_table[256] = { [0 ... 255] = &&entry_default, [MP_BC_LOAD_CONST_FALSE] = &&entry_MP_BC_LOAD_CONST_FALSE, [MP_BC_LOAD_CONST_NONE] = &&entry_MP_BC_LOAD_CONST_NONE,