On Fri, 2024-03-29 at 09:07 +0100, Heiko Tietze wrote: > On 28.03.24 6:09 PM, Caolán McNamara wrote: > > On Fri, 2024-03-29 at 00:16 +0800, Sakura286 wrote: > > > > > > https://gerrit.libreoffice.org/c/core/+/165391 > > > > You might want DECL_STATIC_LINK instead of DECL_LINK. The matching > > IMPL_LINK then needs to be IMPL_STATIC_LINK etc. > > Curious to learn why this needs to be static. What makes the one > button different from the other? Nothing special about the button itself, it's the content of the function that has triggered the warning. The plugin has just detected that the function doesn't actually use anything from an instance of the class it is a member of, so the function could be static, not need the implicit "this" passed as an argument which frees up a register and can potentially be that tiny little bit more optimized. And/or make it clearer to the reader that calling it will only have an effect on the passed-in arg and not an effect on any specific object. These are our own clang plugins, so this isn't a C++ requirement of any kind, just our extra stylistic rules. Taking https://cgit.freedesktop.org/libreoffice/core/tree/sfx2/source/appl/sfxhelp.cxx#n91 if HelpRequestHdl did something like m_xErrBox->set_primary_text("hello world") then HelpRequestHdl couldn't be a static and we would use DECL_LINK and IMPL_LINK instead, and m_xErrBox->connect_help(LINK(nullptr, NoHelpErrorBox, HelpRequestHdl)); would instead have to be m_xErrBox->connect_help(LINK(this, NoHelpErrorBox, HelpRequestHdl)); and vice versa if the code was like this already, and someone dropped the m_xErrBox->set_primary_text("hello world") line then the plugin would begin to warn that it could be static instead