System Details
OS: Gentoo Linux
Arch: AMD64
Desktop Environment: KDE
Version: v3.4.0
Installed by: Portage (compiled with clang 21.1.8)
Describe the bug
Cantata uses COMPILE_WARNING_AS_ERROR ON, but in file models/streamsmodel.cpp:1304 return value of open is ignored, thus aborting compilation.
To Reproduce
Steps to reproduce the behavior:
- Clone repo, checkout on tag
v3.4.0 (but it should work on HEAD of main, too)
- Run
CC=clang CXX=clang++ cmake -B build -S . -G Ninja -DENABLE_FFMPEG=OFF -DENABLE_MPG123=OFF && cmake --build build
- Observe compilation error
Expected behavior
Program compiles with no errors
Exact compiler message
/usr/lib/llvm/21/bin/clang++ -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DBUS_LIB -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_NO_DEBUG_OUTPUT -DQT_SQL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -DQT_XML_LIB -I/home/ginger/programming/cantata/3rdparty -I/home/ginger/programming/cantata -I/home/ginger/programming/cantata/buildClang -I/home/ginger/programming/cantata/buildClang/3rdparty/knotifications/src -I/home/ginger/programming/cantata/3rdparty/knotifications/src -isystem /home/ginger/programming/cantata/buildClang/cantata_autogen/include -isystem /usr/include/avahi-client -isystem /usr/include/avahi-common -isystem /usr/include/qt6/QtWidgets -isystem /usr/include/qt6 -isystem /usr/include/qt6/QtCore -isystem /usr/lib64/qt6/mkspecs/linux-clang -isystem /usr/include/qt6/QtGui -isystem /usr/include/qt6/QtXml -isystem /usr/include/qt6/QtNetwork -isystem /usr/include/qt6/QtConcurrent -isystem /usr/include/qt6/QtSvg -isystem /usr/include/qt6/QtSql -isystem /usr/include/qt6/QtDBus -isystem /usr/include/qt6/QtMultimedia -isystem /usr/include/taglib -isystem /usr/include/KF6/KItemViews -isystem /usr/include/KF6/KArchive -fPIE -Wno-deprecated-declarations -Wall -Wextra -Wpedantic -D_REENTRANT -fno-direct-access-external-data -Werror -MD -MT CMakeFiles/cantata.dir/models/streamsmodel.cpp.o -MF CMakeFiles/cantata.dir/models/streamsmodel.cpp.o.d -o CMakeFiles/cantata.dir/models/streamsmodel.cpp.o -c /home/ginger/programming/cantata/models/streamsmodel.cpp
/home/ginger/programming/cantata/models/streamsmodel.cpp:1304:3: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
1304 | compressor->open(QIODevice::ReadOnly);
| ^~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~
1 error generated.
Additional context
I have no idea, why GCC 14.2.1 (which I also happen to have) ignores -Werror in that case, but Clang-21.1 aborts compilation as it have to.
As a workaround not requiring to change the code, option -Wno-error=unused-result can be used.
System Details
OS: Gentoo Linux
Arch: AMD64
Desktop Environment: KDE
Version: v3.4.0
Installed by: Portage (compiled with clang 21.1.8)
Describe the bug
Cantata uses
COMPILE_WARNING_AS_ERROR ON, but in filemodels/streamsmodel.cpp:1304return value ofopenis ignored, thus aborting compilation.To Reproduce
Steps to reproduce the behavior:
v3.4.0(but it should work on HEAD of main, too)CC=clang CXX=clang++ cmake -B build -S . -G Ninja -DENABLE_FFMPEG=OFF -DENABLE_MPG123=OFF && cmake --build buildExpected behavior
Program compiles with no errors
Exact compiler message
Additional context
I have no idea, why GCC 14.2.1 (which I also happen to have) ignores
-Werrorin that case, but Clang-21.1 aborts compilation as it have to.As a workaround not requiring to change the code, option
-Wno-error=unused-resultcan be used.