summaryrefslogtreecommitdiff
path: root/py/obj.h
diff options
context:
space:
mode:
authorstijn <stijn@ignitron.net>2018-09-24 11:57:14 +0200
committerDamien George <damien.p.george@gmail.com>2018-09-26 15:34:59 +1000
commit57a7d5be9ae3d367982c0f25b9f0215f58029faa (patch)
tree07340553e3388adfd134227e4fcc7c3d75cd7dc6 /py/obj.h
parent8181ec04a45826ac33ea3247fbc36bef98236123 (diff)
py: Fix msvc C++ compiler warnings with MP_OBJ_FUN_MAKE_SIG macro.
When obj.h is compiled as C++ code, the cl compiler emits a warning about possibly unsafe mixing of size_t and bool types in the or operation in MP_OBJ_FUN_MAKE_SIG. Similarly there's an implicit narrowing integer conversion in runtime.h. This commit fixes this by being explicit.
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/obj.h b/py/obj.h
index 4a371bc63..950384816 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -278,7 +278,7 @@ typedef struct _mp_rom_obj_t { mp_const_obj_t o; } mp_rom_obj_t;
#define MP_DECLARE_CONST_FUN_OBJ_KW(obj_name) extern const mp_obj_fun_builtin_var_t obj_name
#define MP_OBJ_FUN_ARGS_MAX (0xffff) // to set maximum value in n_args_max below
-#define MP_OBJ_FUN_MAKE_SIG(n_args_min, n_args_max, takes_kw) (((n_args_min) << 17) | ((n_args_max) << 1) | (takes_kw))
+#define MP_OBJ_FUN_MAKE_SIG(n_args_min, n_args_max, takes_kw) (((n_args_min) << 17) | ((n_args_max) << 1) | ((takes_kw) ? 1 : 0))
#define MP_DEFINE_CONST_FUN_OBJ_0(obj_name, fun_name) \
const mp_obj_fun_builtin_fixed_t obj_name = \