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

SourceHook (GCC): maybe-uninitialized warning #191

Open
Wend4r opened this issue Sep 12, 2024 · 0 comments
Open

SourceHook (GCC): maybe-uninitialized warning #191

Wend4r opened this issue Sep 12, 2024 · 0 comments

Comments

@Wend4r
Copy link
Contributor

Wend4r commented Sep 12, 2024

When building on GCC, I get the following warning:

[14/196] Building CXX object CMakeFiles/mms2-sample.dir/src/sample_plugin.cpp.o
In file included from /__w/mms2-sample/mms2-sample/external/metamod-source/core/ISmmPlugin.h:37,
                 from /__w/mms2-sample/mms2-sample/include/sample_plugin.hpp:33,
                 from /__w/mms2-sample/mms2-sample/src/sample_plugin.cpp:22:
/__w/mms2-sample/mms2-sample/external/metamod-source/core/sourcehook/sourcehook.h: In member function 'virtual CServerSideClientBase* __SourceHook_FHCls_CNetworkGameServerBaseConnectClient0::Func(const char*, ns_address*, int, CCLCMsg_SplitPlayerConnect_t*, const char*, const byte*, int, bool)':
/__w/mms2-sample/mms2-sample/external/metamod-source/core/sourcehook/sourcehook.h:947:62: warning: 'orig_ret' may be used uninitialized [-Wmaybe-uninitialized]
  947 |         IHookContext *pContext = SH_GLOB_SHPTR->SetupHookLoop(ms_HI, ourvfnptr, reinterpret_cast<void*>(this), \
      |                                                              ^
/__w/mms2-sample/mms2-sample/external/metamod-source/core/sourcehook/sourcehook.h:947:62: note: by argument 9 of type 'const void*' to 'SourceHook::IHookContext* (SourceHook::ISourceHook::)(SourceHook::IHookManagerInfo*, void*, void*, void**, META_RES*, META_RES*, META_RES*, const void*, void*)'
  947 |         IHookContext *pContext = SH_GLOB_SHPTR->SetupHookLoop(ms_HI, ourvfnptr, reinterpret_cast<void*>(this), \
      |                                                              ^
/__w/mms2-sample/mms2-sample/external/metamod-source/core/sourcehook/sourcehook.h:980:9: note: in expansion of macro 'SH_SETUPCALLS'
  980 |         SH_SETUPCALLS(rettype, paramtypes, params) \
      |         ^~~~~~~~~~~~~
/__w/mms2-sample/mms2-sample/external/metamod-source/core/sourcehook/sourcehook.h:2551:19: note: in expansion of macro 'SH_HANDLEFUNC'
 2551 |                 { SH_HANDLEFUNC((param1, param2, param3, param4, param5, param6, param7, param8), (p1, p2, p3, p4, p5, p6, p7, p8), rettype); } \
      |                   ^~~~~~~~~~~~~
/__w/mms2-sample/mms2-sample/src/sample_plugin.cpp:[33](https://github.com/Wend4r/mms2-sample/actions/runs/10829113288/job/30046540185#step:9:34):1: note: in expansion of macro 'SH_DECL_HOOK8'
   33 | SH_DECL_HOOK8(CNetworkGameServerBase, ConnectClient, SH_NOATTRIB, 0, CServerSideClientBase *, const char *, ns_address *, int, CCLCMsg_SplitPlayerConnect_t *, const char *, const byte *, int, bool);
      | ^~~~~~~~~~~~~
/__w/mms2-sample/mms2-sample/external/metamod-source/core/sourcehook/sourcehook.h:943:20: note: 'orig_ret' declared here
  943 |         my_rettype orig_ret; \
      |                    ^~~~~~~~
/__w/mms2-sample/mms2-sample/external/metamod-source/core/sourcehook/sourcehook.h:943:20: note: in definition of macro 'SH_SETUPCALLS'
  943 |         my_rettype orig_ret; \
      |                    ^~~~~~~~
/__w/mms2-sample/mms2-sample/external/metamod-source/core/sourcehook/sourcehook.h:2551:19: note: in expansion of macro 'SH_HANDLEFUNC'
 2551 |                 { SH_HANDLEFUNC((param1, param2, param3, param4, param5, param6, param7, param8), (p1, p2, p3, p4, p5, p6, p7, p8), rettype); } \
      |                   ^~~~~~~~~~~~~
/__w/mms2-sample/mms2-sample/src/sample_plugin.cpp:33:1: note: in expansion of macro 'SH_DECL_HOOK8'
   33 | SH_DECL_HOOK8(CNetworkGameServerBase, ConnectClient, SH_NOATTRIB, 0, CServerSideClientBase *, const char *, ns_address *, int, CCLCMsg_SplitPlayerConnect_t *, const char *, const byte *, int, bool);
      | ^~~~~~~~~~~~~

https://github.com/Wend4r/mms2-sample/actions/runs/10829113288/job/30046540185
https://github.com/Wend4r/mms2-sample/blob/eef2a254d5427c6428f3cbd8fd1aa870f3d2e9d7/src/sample_plugin.cpp#L33

I know it can be mute by -Wno-maybe-uninitialized, but wouldn't better to fix it in SourceHook?

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

1 participant