Skip to content

Various code fixes to allow stricter warn flags#408

Open
SamantazFox wants to merge 2 commits intolvgl:masterfrom
SamantazFox:warn-fixes
Open

Various code fixes to allow stricter warn flags#408
SamantazFox wants to merge 2 commits intolvgl:masterfrom
SamantazFox:warn-fixes

Conversation

@SamantazFox
Copy link
Copy Markdown

@SamantazFox SamantazFox commented Apr 5, 2026

When I tried to compile this with CircuitPython (MP fork), I encountered a lot of compilation errors, notably due to missing void in function prototypes and declarations when those take no arguments.

This PR addresses that.


Error summary

Encountered a few thousand times in generated lv_mpy.c:

build/lvgl/lv_mpy.c: In function 'get_mp_lv_event_dsc_t_type':
build/lvgl/lv_mpy.c:13923:36: error: old-style function definition [-Werror=old-style-definition]
13923 | static inline const mp_obj_type_t *get_mp_lv_event_dsc_t_type()
      |                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated due to -fmax-errors=50.

Strict/missing prototypes:

In file included from user_modules/lvgl_mpy/lvgl/src/lv_conf_internal.h:56,
                 from user_modules/lvgl_mpy/lvgl/src/lv_init.h:16,
                 from user_modules/lvgl_mpy/lvgl/lvgl.h:21,
                 from build/lvgl/lv_mpy.c:33:
user_modules/lvgl_mpy/lv_conf.h:432:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
  432 | extern void mp_lv_init_gc();
      | ^~~~~~
user_modules/lvgl_mpy/lv_conf.h:433:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
  433 | extern void mp_lv_deinit_gc();
      | ^~~~~~
build/lvgl/lv_mpy.c: At top level:
build/lvgl/lv_mpy.c:359:6: error: no previous prototype for 'mp_lv_log_cb' [-Werror=missing-prototypes]
  359 | void mp_lv_log_cb(lv_log_level_t level, const char * buf){
      |      ^~~~~~~~~~~~
build/lvgl/lv_mpy.c:364:6: error: no previous prototype for 'mp_lv_init_gc' [-Werror=missing-prototypes]
  364 | void mp_lv_init_gc(void)
      |      ^~~~~~~~~~~~~
build/lvgl/lv_mpy.c:373:6: error: no previous prototype for 'mp_lv_deinit_gc' [-Werror=missing-prototypes]
  373 | void mp_lv_deinit_gc(void)
      |      ^~~~~~~~~~~~~~~
build/lvgl/lv_mpy.c: In function 'mp_mp_lv_init_gc':
build/lvgl/lv_mpy.c:41561:5: error: function declaration isn't a prototype [-Werror=strict-prototypes]
41561 |     ((void (*)())lv_func_ptr)();
      |     ^

Shadowed variable:

build/lvgl/lv_mpy.c: In function 'lv_to_mp':
build/lvgl/lv_mpy.c:249:31: error: declaration of 'lv_obj_class' shadows a global declaration [-Werror=shadow]
  249 |         const lv_obj_class_t *lv_obj_class = lv_obj_get_class(lv_obj);
      |                               ^~~~~~~~~~~~
In file included from user_modules/lvgl_mpy/lvgl/lvgl.h:43:
user_modules/lvgl_mpy/lvgl/src/core/lv_obj.h:218:54: note: shadowed declaration is here
  218 | LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_obj_class;
      |                                                      ^~~~~~~~~~~~

Allows the use of the following flags
 * -Wstrict-prototypes
 * -Wmissing-prototypes
 * -Wold-style-definition
 * -Werror
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant