NickvisionApps / Parabolic

Download web video and audio
https://flathub.org/apps/details/org.nickvision.tubeconverter
GNU General Public License v3.0
1.03k stars 56 forks source link

Clang build error: `error: non-constant-expression cannot be narrowed from type 'gboolean' (aka 'int') to 'bool' in initializer list [-Wc++11-narrowing]` #952

Open barracuda156 opened 2 hours ago

barracuda156 commented 2 hours ago

I am trying to see whether libsecret option will work on Sonoma with clang, and it fails to compile on this:

/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_devel_libnick/libnick/work/libnick-2024.11.0/src/keyring/systemcredentials.cpp:20:194: warning: missing field 'reserved' initializer [-Wmissing-field-initializers]
    static const SecretSchema KEYRING_SCHEMA = { "org.nickvision.libnick", SECRET_SCHEMA_NONE, { { "application", SECRET_SCHEMA_ATTRIBUTE_STRING }, { "NULL", SECRET_SCHEMA_ATTRIBUTE_STRING } } };
                                                                                                                                                                                                 ^
/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_devel_libnick/libnick/work/libnick-2024.11.0/src/keyring/systemcredentials.cpp:256:19: error: non-constant-expression cannot be narrowed from type 'gboolean' (aka 'int') to 'bool' in initializer list [-Wc++11-narrowing]
        bool res{ secret_password_clear_sync(&KEYRING_SCHEMA, nullptr, &error, "application", name.c_str(), nullptr) };
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_devel_libnick/libnick/work/libnick-2024.11.0/src/keyring/systemcredentials.cpp:256:19: note: insert an explicit cast to silence this issue
        bool res{ secret_password_clear_sync(&KEYRING_SCHEMA, nullptr, &error, "application", name.c_str(), nullptr) };
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                  static_cast<bool>(                                                                                )
1 warning and 1 error generated.
barracuda156 commented 2 hours ago

Possibly no error with gcc, because bool is 4 byte on Darwin powerpc. So no narrowing there.