Remove unused code that might trigger compiler warning
When building under Windows with -DCMAKE_BUILD_TYPE=Release, we get the following warning that makes the build fail:
[225/737] Building C object bin/CMakeFiles/lib_darktable.dir/control/jobs/control_jobs.c.obj
FAILED: bin/CMakeFiles/lib_darktable.dir/control/jobs/control_jobs.c.obj
C:\msys64\ucrt64\bin\cc.exe -DAVIF_DLL -DGDK_DISABLE_DEPRECATED -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_24 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_MIN_REQUIRED -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_56 -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES -DHAVE_BUILTIN_CPU_SUPPORTS -DHAVE_CONFIG_H -DHAVE_GAME -DHAVE_GMIC -DHAVE_GPHOTO2 -DHAVE_GRAPHICSMAGICK -DHAVE_ICU -DHAVE_IMATH -DHAVE_ISO_CODES -DHAVE_LIBAVIF=1 -DHAVE_LIBEXIV2_WITH_ISOBMFF=1 -DHAVE_LIBHEIF=1 -DHAVE_LIBJXL -DHAVE_LIBRAW=1 -DHAVE_LIBSECRET -DHAVE_LIBSHARPYUV=1 -DHAVE_MAP -DHAVE_OPENCL -DHAVE_OPENEXR -DHAVE_OPENJPEG -DHAVE_OSMGPSMAP_110_OR_NEWER -DHAVE_OSMGPSMAP_NEWER_THAN_110 -DHAVE_SQLITE_324_OR_NEWER -DHAVE_VISIBILITY -DHAVE_WEBP -DIMATH_DLL -DLIBHEIF_EXPORTS -DNATIVE_ARCH -DOPENEXR_DLL -DSQLITE_CORE -DSQLITE_ENABLE_ICU -D_POSIX_THREAD_SAFE_FUNCTIONS -D_USE_MATH_DEFINES -D__USE_MINGW_ANSI_STDIO=1 -Dlib_darktable_EXPORTS -IC:/msys64/home/Victor/darktable/build/bin -IC:/msys64/home/Victor/darktable/src -IC:/msys64/home/Victor/darktable/src/external/whereami/src -isystem C:/msys64/home/Victor/darktable/src/external -isystem C:/msys64/home/Victor/darktable/src/external/OpenCL -isystem C:/msys64/ucrt64/include/glib-2.0 -isystem C:/msys64/ucrt64/lib/glib-2.0/include -isystem C:/msys64/ucrt64/include/gtk-3.0 -isystem C:/msys64/ucrt64/include/pango-1.0 -isystem C:/msys64/ucrt64/include/cairo -isystem C:/msys64/ucrt64/include/harfbuzz -isystem C:/msys64/ucrt64/include/freetype2 -isystem C:/msys64/ucrt64/include/gdk-pixbuf-2.0 -isystem C:/msys64/ucrt64/include/atk-1.0 -isystem C:/msys64/ucrt64/include/pixman-1 -isystem C:/msys64/ucrt64/include/libpng16 -isystem C:/msys64/ucrt64/include/webp -isystem C:/msys64/ucrt64/include/fribidi -isystem C:/msys64/ucrt64/include/libxml2 -isystem C:/msys64/ucrt64/include/lensfun -isystem C:/msys64/ucrt64/include/librsvg-2.0 -isystem C:/msys64/ucrt64/include/json-glib-1.0 -isystem C:/msys64/ucrt64/include/openjpeg-2.5 -isystem C:/msys64/ucrt64/include/libsecret-1 -isystem C:/msys64/ucrt64/include/GraphicsMagick -isystem C:/msys64/ucrt64/include/osmgpsmap-1.0 -isystem C:/msys64/ucrt64/include/libsoup-2.4 -isystem C:/msys64/ucrt64/include/Imath -isystem C:/msys64/ucrt64/include/OpenEXR -Wall -Wno-format -Wshadow -Wtype-limits -Wvla -Wold-style-declaration -Wmaybe-uninitialized -Wno-unknown-pragmas -Wno-error=varargs -Wno-format-truncation -Wno-error=address-of-packed-member -fopenmp -march=native -msse2 -g -mfpmath=sse -O3 -DNDEBUG -O3 -ffast-math -fno-finite-math-only -fexpensive-optimizations -std=c99 -DUNICODE -D_UNICODE -Werror -Wfatal-errors -MD -MT bin/CMakeFiles/lib_darktable.dir/control/jobs/control_jobs.c.obj -MF bin\CMakeFiles\lib_darktable.dir\control\jobs\control_jobs.c.obj.d -o bin/CMakeFiles/lib_darktable.dir/control/jobs/control_jobs.c.obj -c C:/msys64/home/Victor/darktable/src/control/jobs/control_jobs.c
C:/msys64/home/Victor/darktable/src/control/jobs/control_jobs.c: In function 'dt_control_delete_images_job_run':
C:/msys64/home/Victor/darktable/src/control/jobs/control_jobs.c:1272:5: error: 'dirname' may be used uninitialized [-Werror=maybe-uninitialized]
1272 | g_free(dirname);
| ^~~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1.exe: all warnings being treated as errors
This warning does not appear when building with -DCMAKE_BUILD_TYPE=Debug, so this problem was not caught in CI, where the Debug build type was used for faster compilation.
So, by the way, the next PR will replace the build type in CI for Windows, as Release is more important to us and we can also expect that a higher level of optimization uses more checks, so there is a higher chance of failure from triggering a compiler warning.
The code that triggers the warning here is not actually used in any way. At one point in the function, a pointer variable is assigned the address of the allocated memory filled with a string, and later that area is freed. But there is no use of this variable. It looks like it was a copy-paste from another function.
@TurboGit Since Windows nightly is built with a Release type, the last nightly build failed because of this. It would be nice to have this fix before the next nightly.
So, by the way, the next PR will replace the build type in CI for Windows, as Release is more important to us
For macOS the current CI build type is set to Debug as well, can you please change that too in that PR?
@zisoft Sure, will do.
We should, however, keep one debug build in the CI just to ensure that nothing gets broken in debug code. We have way fewer builds in CI than we used to, so adding another one to cover this case wouldn't be an issue.