eez-open / studio

Cross-platform low-code GUI and automation
https://www.envox.eu/studio/studio-introduction/
GNU General Public License v3.0
510 stars 90 forks source link

[LVGL] Generated arrays always have an additional comma (,) in the end causing compilation to fail #375

Closed RE2012 closed 4 months ago

RE2012 commented 4 months ago

Describe the bug Generated arrays always have an additional comma (,) in the end causing compilation to fail as there is no additional value afterwards.

To Reproduce

  1. in studio go to "Home" page, select "examples" and select project "eez_lvgl_demo"

  2. click "edit project"

  3. click on "build" button

  4. from output folder open ui_image_logo_eez.c in any editor

  5. go to end of the array and see the addtional comma in the end before the array is closed: 00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, <- addtional comma };

  6. same happens with image description: const lv_img_dsc_t img_logo_eez = { .header.cf = LV_IMG_CF_RGB565A8, .header.always_zero = 0, .header.reserved = 0, .header.w = 220, .header.h = 64, .data_size = 42240, .data = img_logo_eez_map, <- addtional comma };

  7. same with images.c: const ext_img_desc_t images[2] = { { "logo_eez", &img_logo_eez }, { "logo_lvgl", &img_logo_lvgl }, <- addtional comma };

  8. same with flow_def.c: native_var_t native_vars[] = { { NATIVE_VAR_TYPE_NONE, 0, 0 }, <- addtional comma };

  9. screens.h: enum ScreensEnum { SCREEN_ID_MAIN = 1, <- addtional comma };

  10. ui.c: ActionExecFunc actions[] = { has an addtional comma after last item

Expected behavior Generated arrays should not contain a comma after last value.

Desktop (please complete the following information):

LVGL version (if used)

eez-studio version

Additional information

mvladic commented 4 months ago

I'm surprised that compilation fails, because trailing comma in initializer-list should be allowed in C or C++. Also, regarding image descriptions, these files are generated by the https://github.com/lvgl/lv_img_conv library.

RE2012 commented 4 months ago

You are right. I faced so many problems with generated code of EEZ Studio and optional EEZ framework that this also looked wrong - but it is okay. Please close this one.

mvladic commented 4 months ago

A lot of bugs have been fixed in the last few releases, so I recommend that you install the latest version if you haven't already. If you notice any error, please report it. Thank you.