Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build failed on openSUSE due to "no return statement in function returning non-void" #178

Open
sagiben opened this issue Jan 17, 2023 · 3 comments

Comments

@sagiben
Copy link

sagiben commented Jan 17, 2023

[  707s] /usr/bin/g++-12 -DADDON_GLOBAL_VERSION_FILESYSTEM_USED -DADDON_GLOBAL_VERSION_GENERAL_USED -DADDON_GLOBAL_VERSION_GUI_USED -DADDON_GLOBAL_VERSION_MAIN_USED -DADDON_GLOBAL_VERSION_TOOLS_USED -DADDON_INSTANCE_VERSION_PVR_USED -DBSD=1 -DBUILD_KODI_ADDON -DLIVE555 -DSOCKLEN_T=socklen_t -D_WINSOCK_DEPRECATED_NO_WARNINGS -D__STDC_FORMAT_MACROS -Dpvr_mediaportal_tvserver_EXPORTS -I/home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/depends/include/kodi/.. -I/home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src -I/home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/tools/depends/target/binary-addons/build/pvr.mediaportal.tvserver-prefix/src/pvr.mediaportal.tvserver-build -I/home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/live555/liveMedia/include -I/home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/live555/BasicUsageEnvironment/include -I/home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/live555/UsageEnvironment/include -I/home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/live555/groupsock/include -I/home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/live555 -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -fPIC -O2 -g -DNDEBUG -fPIC   -DTARGET_POSIX -DTARGET_LINUX -fPIC -std=c++17 -MD -MT CMakeFiles/pvr.mediaportal.tvserver.dir/src/lib/tsreader/MemoryReader.cpp.o -MF CMakeFiles/pvr.mediaportal.tvserver.dir/src/lib/tsreader/MemoryReader.cpp.o.d -o CMakeFiles/pvr.mediaportal.tvserver.dir/src/lib/tsreader/MemoryReader.cpp.o -c /home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/tsreader/MemoryReader.cpp
[  707s] In file included from /home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/tsreader/MemoryReader.h:33,
[  707s]                  from /home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/tsreader/MemoryReader.cpp:32:
[  707s] /home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/tsreader/FileReader.h:41:11: warning: 'MPTV::FileReader' declared with greater visibility than the type of its field 'MPTV::FileReader::m_hFile' [-Wattributes]
[  707s]    41 |     class FileReader
[  707s]       |           ^~~~~~~~~~
[  707s] /home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/tsreader/MemoryReader.h: In member function 'MPTV::CMemoryReader& MPTV::CMemoryReader::operator=(const MPTV::CMemoryReader&)':
[  707s] /home/abuild/rpmbuild/BUILD/xbmc-20.0-Nexus/cmake/addons/build/pvr.mediaportal.tvserver/src/lib/tsreader/MemoryReader.h:52:70: error: no return statement in function returning non-void [-Werror=return-type]
[  707s]    52 |         CMemoryReader& operator=(const CMemoryReader& memoryreader) {};
[  707s]       |                                                                      ^
[  707s]       |                                                                      return *this;
[  708s] cc1plus: some warnings being treated as errors

The error comes from the private assignment operator.
We can delete it instead of empty declaration

diff --git a/src/lib/tsreader/MemoryReader.h b/src/lib/tsreader/MemoryReader.h
index 288984b..9a502ae 100644
--- a/src/lib/tsreader/MemoryReader.h
+++ b/src/lib/tsreader/MemoryReader.h
@@ -41,6 +41,7 @@ namespace MPTV
       public:
         CMemoryReader(CMemoryBuffer& buffer);
         virtual ~CMemoryReader(void);
+        CMemoryReader& operator=(const CMemoryReader& memoryreader) = delete;
         virtual long Read(unsigned char* pbData, size_t lDataLength, size_t *dwReadBytes);
         virtual int64_t SetFilePointer(int64_t llDistanceToMove, unsigned long dwMoveMethod);
         virtual bool IsBuffer() { return true; };
@@ -49,7 +50,6 @@ namespace MPTV
 
       private:
         CMemoryBuffer& m_buffer;
-        CMemoryReader& operator=(const CMemoryReader& memoryreader) {};
     };
 }
 #endif //LIVE555
@phunkyfish
Copy link
Member

phunkyfish commented Jan 17, 2023

I believe we try to minimise changes to the LIVE 555 library if at all possible so I don’t know if this change is acceptable.m

I also don’t know if we support gcc12.

@sagiben
Copy link
Author

sagiben commented Jan 17, 2023

happens also on different versions of gcc. in openSUSE build service it is not allowed to have a function that should return something without a return statement, so they added the -Werror=return-type flag

@phunkyfish
Copy link
Member

Ok, let’s leave the maintainer chime in here. If they are ok with it, no issues from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants