slint-ui / slint-cpp-template

A template for a C++ Application using Slint
https://slint.dev
MIT License
45 stars 11 forks source link

C++ API: generated header warnings with gcc -pedantic #11

Closed abwitek closed 1 year ago

abwitek commented 1 year ago

Using:

I'm trying to build a very simple skeleton project (mostly the same as hello world from the docs, with filenames changed). Passing -Werror -pedantic to gcc triggers a compilation failure in generated API code.

In file included from /home/<CMAKE_BUILD_DIR>/_deps/slint-src/api/cpp/include/slint_image.h:8,
                 from /home/<CMAKE_BUILD_DIR>/_deps/slint-build/generated_include/slint_internal.h:17,
                 from /home/<CMAKE_BUILD_DIR>/_deps/slint-src/api/cpp/include/slint.h:29,
                 from /home/<CMAKE_BUILD_DIR>/sample/slint_sender_ui.h:5,
                 from /home/<CMAKE_PROJECT_DIR>/sample/slint_sender.cpp:12:
/home/<CMAKE_BUILD_DIR>/_deps/slint-build/generated_include/slint_image_internal.h:84:12: error: ISO C++ prohibits anonymous structs [-Werror=pedantic]
   84 |     struct {
      |            ^
In file included from /home/<CMAKE_BUILD_DIR>/_deps/slint-src/api/cpp/include/slint_image.h:8,
                 from /home/<CMAKE_BUILD_DIR>/_deps/slint-build/generated_include/slint_internal.h:17,
                 from /home/<CMAKE_BUILD_DIR>/_deps/slint-src/api/cpp/include/slint.h:29,
                 from /home/<CMAKE_BUILD_DIR>/sample/slint_sender_ui.h:5,
                 from /home/<CMAKE_PROJECT_DIR>/sample/slint_sender.cpp:12:
/home/<CMAKE_BUILD_DIR>/_deps/slint-build/generated_include/slint_image_internal.h:545:12: error: ISO C++ prohibits anonymous structs [-Werror=pedantic]
  545 |     struct {
      |            ^
In file included from /home/<CMAKE_BUILD_DIR>/_deps/slint-src/api/cpp/include/slint.h:29,
                 from /home/<CMAKE_BUILD_DIR>/sample/slint_sender_ui.h:5,
                 from /home/<CMAKE_PROJECT_DIR>/sample/slint_sender.cpp:12:
/home/<CMAKE_BUILD_DIR>/_deps/slint-build/generated_include/slint_internal.h:387:12: error: ISO C++ prohibits anonymous structs [-Werror=pedantic]
  387 |     struct {
      |            ^
cc1plus: all warnings being treated as errors

This is not a blocker bug, just a minor annoyance. However, it seems those anonymous struct should be painless to name.

abwitek commented 1 year ago

Sorry, wrong project. Reposting in the right place.