Skip to content

Latest Protobuf release now uses nodiscard, which causes compiler warnings #7102

@Sir-Ace-git

Description

@Sir-Ace-git

Description

comet:/usr/src/mumble/build# make
[ 1%] Built target overlay_gl
[ 1%] Built target overlay_gl_x86
[ 2%] Built target wow_x64
[ 3%] Built target link
[ 4%] Built target amongus
[ 4%] Built target aoc
[ 5%] Built target arma2
[ 5%] Built target bf1
[ 5%] Built target bf1942
[ 6%] Built target bf2
[ 6%] Built target bf2142
[ 7%] Built target bf3
[ 7%] Built target bf4
[ 7%] Built target bf4_x86
[ 8%] Built target bfbc2
[ 8%] Built target bfheroes
[ 8%] Built target blacklight
[ 9%] Built target borderlands
[ 9%] Built target borderlands2
[ 9%] Built target breach
[ 10%] Built target cod2
[ 11%] Built target cod4
[ 11%] Built target cod5
[ 11%] Built target codmw2
[ 12%] Built target codmw2so
[ 12%] Built target cs
[ 12%] Built target dys
[ 13%] Built target etqw
[ 13%] Built target ffxiv
[ 14%] Built target ffxiv_x64
[ 14%] Built target gmod
[ 15%] Built target grounded
[ 16%] Built target gtaiv
[ 16%] Built target gtasa
[ 17%] Built target gtav
[ 18%] Built target gw
[ 18%] Built target insurgency
[ 18%] Built target jc2
[ 19%] Built target lol
[ 19%] Built target lotro
[ 19%] Built target ql
[ 20%] Built target rl
[ 21%] Built target se
[ 21%] Built target sr
[ 22%] Built target ut2004
[ 22%] Built target ut3
[ 22%] Built target ut99
[ 23%] Built target wolfet
[ 23%] Built target wow
[ 23%] Built target plugins
[ 23%] Built target link_tester
[ 24%] Built target spdlog
[ 24%] Built target generate_license_header
[ 24%] Built target TracyClient
[ 25%] Built target shared_autogen_timestamp_deps
[ 25%] Built target shared_autogen
[ 25%] Building CXX object src/CMakeFiles/shared.dir/MumbleProtocol.cpp.o
/usr/src/mumble/src/MumbleProtocol.cpp: In function ‘std::size_t Mumble::Protocol::encodeProtobuf(const google::protobuf::Message&, std::vector&, std::size_t, std::size_t, bool)’:
/usr/src/mumble/src/MumbleProtocol.cpp:105:48: error: ignoring return value of ‘bool google::protobuf::MessageLite::SerializePartialToArray(void*, int) const’, declared with attribute ‘nodiscard’ [-Werror=unused-result]
105 | message.SerializePartialToArray(buffer.data() + offset, static_cast< int >(serializedSize));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/google/protobuf/generated_message_tctable_decl.h:24,
from /usr/src/mumble/build/src/MumbleUDP.pb.h:24,
from /usr/src/mumble/src/MumbleProtocol.h:9,
from /usr/src/mumble/src/MumbleProtocol.cpp:6:
/usr/include/google/protobuf/message_lite.h:770:44: note: declared here
770 | PROTOBUF_FUTURE_ADD_EARLY_NODISCARD bool SerializePartialToArray(
| ^~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [src/CMakeFiles/shared.dir/build.make:247: src/CMakeFiles/shared.dir/MumbleProtocol.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:3626: src/CMakeFiles/shared.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Steps to reproduce

cmake .. -DPostgreSQL_INCLUDE_DIR=/usr/local/pgsql/include -DPostgreSQL_LIBRARY=/usr/local/pgsql/lib/libpq.so
make -j 16

Mumble version

v1.6.870

Mumble component

Both

OS

Linux

Reproducible?

Yes

Additional information

/usr/src/mumble/src/MumbleProtocol.cpp:105:48: error: ignoring return value of ‘bool google::protobuf::MessageLite::SerializePartialToArray(void*, int) const’, declared with attribute ‘nodiscard’ [-Werror=unused-result]
105 | message.SerializePartialToArray(buffer.data() + offset, static_cast< int >(serializedSize));

/usr/include/google/protobuf/message_lite.h:770:44: note: declared here
770 | PROTOBUF_FUTURE_ADD_EARLY_NODISCARD bool SerializePartialToArray(

Relevant log output

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug (error) in the softwarebuildEverything related to compiling/building the codeclientserver

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions