Prevent GCC from emitting false-positive warnings in release build
This fixes some false-positive warnings from GCC 13.2.0 in release build that made some CIs in labwc PR for window icons fail. In addition, I fixed another warning from GCC 13.3.0 (installed via gcc-13 package from Arch) with examples/desktop-load.c
.
Feel free to close this PR if you don't want to support old versions of GCC that emit false-positive warnings. I guess we can suppress these warnings by passing some options to libsfdo subproject.
Quotes from the failed CIs:
[17/167] Compiling C object subprojects/libsfdo/libsfdo-icon.a.p/sfdo-icon_lookup.c.o
FAILED: subprojects/libsfdo/libsfdo-icon.a.p/sfdo-icon_lookup.c.o
gcc -Isubprojects/libsfdo/libsfdo-icon.a.p -Isubprojects/libsfdo -I../subprojects/libsfdo -I../subprojects/libsfdo/include -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -Werror -std=c11 -O3 -Wconversion -Wendif-labels -Wimplicit-fallthrough=2 -Wlogical-op -Wmissing-include-dirs -Wmissing-prototypes -Wold-style-definition -Wpointer-arith -Woverflow -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wundef -fvisibility=hidden -D_POSIX_C_SOURCE=200809L -fPIC -MD -MQ subprojects/libsfdo/libsfdo-icon.a.p/sfdo-icon_lookup.c.o -MF subprojects/libsfdo/libsfdo-icon.a.p/sfdo-icon_lookup.c.o.d -o subprojects/libsfdo/libsfdo-icon.a.p/sfdo-icon_lookup.c.o -c ../subprojects/libsfdo/sfdo-icon/lookup.c
In function 'curr_is_better',
inlined from 'node_lookup_icon' at ../subprojects/libsfdo/sfdo-icon/lookup.c:93:23,
inlined from 'sfdo_icon_theme_lookup_best' at ../subprojects/libsfdo/sfdo-icon/lookup.c:161:10:
../subprojects/libsfdo/sfdo-icon/lookup.c:39:20: error: 'best_dist' may be used uninitialized [-Werror=maybe-uninitialized]
39 | if (curr_dist < best_dist) {
| ^
../subprojects/libsfdo/sfdo-icon/lookup.c: In function 'sfdo_icon_theme_lookup_best':
../subprojects/libsfdo/sfdo-icon/lookup.c:76:13: note: 'best_dist' was declared here
76 | int best_dist;
| ^~~~~~~~~
cc1: all warnings being treated as errors
[22/167] Compiling C object subprojects/libsfdo/libsfdo-desktop.a.p/sfdo-desktop_db.c.o
FAILED: subprojects/libsfdo/libsfdo-desktop.a.p/sfdo-desktop_db.c.o
gcc -Isubprojects/libsfdo/libsfdo-desktop.a.p -Isubprojects/libsfdo -I../subprojects/libsfdo -I../subprojects/libsfdo/include -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -Werror -std=c11 -O3 -Wconversion -Wendif-labels -Wimplicit-fallthrough=2 -Wlogical-op -Wmissing-include-dirs -Wmissing-prototypes -Wold-style-definition -Wpointer-arith -Woverflow -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wundef -fvisibility=hidden -D_POSIX_C_SOURCE=200809L -fPIC -MD -MQ subprojects/libsfdo/libsfdo-desktop.a.p/sfdo-desktop_db.c.o -MF subprojects/libsfdo/libsfdo-desktop.a.p/sfdo-desktop_db.c.o.d -o subprojects/libsfdo/libsfdo-desktop.a.p/sfdo-desktop_db.c.o -c ../subprojects/libsfdo/sfdo-desktop/db.c
In function 'exec_add_quoted',
inlined from 'load_exec' at ../subprojects/libsfdo/sfdo-desktop/db.c:783:8:
../subprojects/libsfdo/sfdo-desktop/db.c:537:41: error: 'escape_i' may be used uninitialized [-Werror=maybe-uninitialized]
537 | logger_write(logger, SFDO_LOG_LEVEL_ERROR,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
538 | "%d:%d: unexpected field code in a quoted argument at position %zu",
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
539 | scanner->line, scanner->column, escape_i);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../subprojects/libsfdo/sfdo-desktop/db.c: In function 'load_exec':
../subprojects/libsfdo/sfdo-desktop/db.c:518:16: note: 'escape_i' was declared here
518 | size_t escape_i;
| ^~~~~~~~
cc1: all warnings being treated as errors
The warning with examples/desktop-load.c
:
[25/46] Compiling C object examples/desktop-load.p/desktop-load.c.o
../examples/desktop-load.c: In function ‘main’:
../examples/desktop-load.c:174:25: warning: ‘startup_notify’ may be used uninitialized [-Wmaybe-uninitialized]
174 | printf("StartupNotify: %s\n", startup_notify);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../examples/desktop-load.c:162:37: note: ‘startup_notify’ was declared here
162 | const char *startup_notify;
| ^~~~~~~~~~~~~~