linuxmint / cinnamon-desktop

The cinnamon-desktop library (and common settings schemas for the cinnamon desktop)
GNU General Public License v2.0
188 stars 63 forks source link

libcvc: void functions in gvc-channel-map.c should not return values [-Wreturn-type] #210

Closed vishwin closed 1 year ago

vishwin commented 2 years ago

gvc_channel_map_set_balance, gvc_channel_map_set_fade and gvc_channel_map_set_lfe are all void functions yet g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL); is in each. This causes the build to fail:

FAILED: libcvc/libcvc.so.0.0.0.p/gvc-channel-map.c.o 
cc -Ilibcvc/libcvc.so.0.0.0.p -Ilibcvc -I../libcvc -I. -I.. -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -fno-color-diagnostics -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -Wno-deprecated-declarations -O2 -pipe -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -isystem /usr/local/include -fPIC -D_REENTRANT -pthread '-DG_LOG_DOMAIN="Cvc"' -DWITH_INTROSPECTION -MD -MQ libcvc/libcvc.so.0.0.0.p/gvc-channel-map.c.o -MF libcvc/libcvc.so.0.0.0.p/gvc-channel-map.c.o.d -o libcvc/libcvc.so.0.0.0.p/gvc-channel-map.c.o -c ../libcvc/gvc-channel-map.c
../libcvc/gvc-channel-map.c:112:9: error: void function 'gvc_channel_map_set_balance' should not return a value [-Wreturn-type]
        g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/glib-2.0/glib/gmessages.h:658:9: note: expanded from macro 'g_return_val_if_fail'
        return (val); \
        ^      ~~~~~
../libcvc/gvc-channel-map.c:152:9: error: void function 'gvc_channel_map_set_fade' should not return a value [-Wreturn-type]
        g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/glib-2.0/glib/gmessages.h:658:9: note: expanded from macro 'g_return_val_if_fail'
        return (val); \
        ^      ~~~~~
../libcvc/gvc-channel-map.c:194:9: error: void function 'gvc_channel_map_set_lfe' should not return a value [-Wreturn-type]
        g_return_val_if_fail (GVC_IS_CHANNEL_MAP (map), NULL);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/glib-2.0/glib/gmessages.h:658:9: note: expanded from macro 'g_return_val_if_fail'
        return (val); \
        ^      ~~~~~
3 errors generated.
vishwin commented 2 years ago

Reverting these back to g_return_if_fail fixes the build.

ItzSwirlz commented 2 years ago

In your build remove -Werror flag and that should fix it. What platform are you building on

vishwin commented 2 years ago

The platform doesn't matter, but I'm on FreeBSD. We use LLVM/Clang, which in recent versions has always been strict about stuff like this no matter the -Werror. This error is correct no matter how it is sliced, since void functions are not to return values (but can just return; ie exit) anyway and the glib macro reflects that.

AngryPenguinPL commented 1 year ago

Hi. Same issue on OpenMandriva with Clang 14. I can confirm that it compile with gcc without any problems.

tmkcell commented 1 year ago

I think in commit 6501be4983bcff152bb5a6b0b8b9ab7cf3c7c81c the author reverted the fix since it was already fixed beforehand in commit 206a909a30f5905ac25100698d1c6cc4cdfe5d7d