Fix warnings that come from -O3 (I think)

This commit is contained in:
Scott Shawcroft 2021-01-20 17:10:28 -08:00
parent 733094aead
commit 2b4ad1ed03
No known key found for this signature in database
GPG Key ID: 9349BC7E64B1921E
3 changed files with 9 additions and 6 deletions

View File

@ -71,6 +71,7 @@ mp_vfs_mount_t *mp_vfs_lookup_path(const char *path, const char **path_out) {
STATIC mp_vfs_mount_t *lookup_path(mp_obj_t path_in, mp_obj_t *path_out) {
const char *path = mp_obj_str_get_str(path_in);
const char *p_out;
*path_out = mp_const_none;
mp_vfs_mount_t *vfs = mp_vfs_lookup_path(path, &p_out);
if (vfs != MP_VFS_NONE && vfs != MP_VFS_ROOT) {
*path_out = mp_obj_new_str_of_type(mp_obj_get_type(path_in),
@ -329,7 +330,7 @@ mp_obj_t mp_vfs_ilistdir(size_t n_args, const mp_obj_t *args) {
path_in = MP_OBJ_NEW_QSTR(MP_QSTR_);
}
mp_obj_t path_out;
mp_obj_t path_out = mp_const_none;
mp_vfs_mount_t *vfs = lookup_path(path_in, &path_out);
if (vfs == MP_VFS_ROOT) {
@ -359,7 +360,7 @@ mp_obj_t mp_vfs_listdir(size_t n_args, const mp_obj_t *args) {
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_vfs_listdir_obj, 0, 1, mp_vfs_listdir);
mp_obj_t mp_vfs_mkdir(mp_obj_t path_in) {
mp_obj_t path_out;
mp_obj_t path_out = mp_const_none;
mp_vfs_mount_t *vfs = lookup_path(path_in, &path_out);
if (vfs == MP_VFS_ROOT || (vfs != MP_VFS_NONE && !strcmp(mp_obj_str_get_str(path_out), "/"))) {
mp_raise_OSError(MP_EEXIST);

View File

@ -66,12 +66,12 @@ static void get_pin_name(const mcu_pin_obj_t *self, qstr* package, qstr* module,
STATIC void mcu_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
mcu_pin_obj_t *self = MP_OBJ_TO_PTR(self_in);
qstr package;
qstr package = MP_QSTR_Pin;
qstr module;
qstr name;
qstr name = MP_QSTR_Pin;
get_pin_name(self, &package, &module, &name);
if (package){
if (package) {
mp_printf(print, "%q.%q.%q", package, module, name);
} else {
mp_printf(print, "%q.%q", module , name);
@ -131,7 +131,7 @@ void assert_pin_free(const mcu_pin_obj_t* pin) {
if (pin != NULL && pin != MP_OBJ_TO_PTR(mp_const_none) && !common_hal_mcu_pin_is_free(pin)) {
qstr package;
qstr module;
qstr name;
qstr name = MP_QSTR_Pin;
get_pin_name(pin, &package, &module, &name);
mp_raise_ValueError_varg(translate("%q in use"), name);

View File

@ -42,6 +42,7 @@
// Version of mp_vfs_lookup_path that takes and returns uPy string objects.
STATIC mp_vfs_mount_t *lookup_path(const char* path, mp_obj_t *path_out) {
const char *p_out;
*path_out = mp_const_none;
mp_vfs_mount_t *vfs = mp_vfs_lookup_path(path, &p_out);
if (vfs != MP_VFS_NONE && vfs != MP_VFS_ROOT) {
*path_out = mp_obj_new_str_of_type(&mp_type_str,
@ -53,6 +54,7 @@ STATIC mp_vfs_mount_t *lookup_path(const char* path, mp_obj_t *path_out) {
// Strip off trailing slashes to please underlying libraries
STATIC mp_vfs_mount_t *lookup_dir_path(const char* path, mp_obj_t *path_out) {
const char *p_out;
*path_out = mp_const_none;
mp_vfs_mount_t *vfs = mp_vfs_lookup_path(path, &p_out);
if (vfs != MP_VFS_NONE && vfs != MP_VFS_ROOT) {
size_t len = strlen(p_out);