error: this member function can be declared static [loplugin:staticmethods] when adding a event function in a dialog

Sakura286 Sakura286 at outlook.com
Thu Mar 28 16:16:24 UTC 2024


Greetings,


I am adding a new dialog for 
LibreOffice(https://gerrit.libreoffice.org/c/core/+/165391). But the CI 
emits the following log:


```log
In file included from 
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/cui/source/dialogs/nanpayloadwarningdlg.cxx:21:
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/cui/source/inc/nanpayloadwarningdlg.hxx:33:15: 
error: this member function can be declared static [loplugin:staticmethods]
     DECL_LINK(OnRejectClick, weld::Button&, void);
     ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/include/tools/link.hxx:30:13: 
note: expanded from macro 'DECL_LINK'
     RetType Member(ArgType)
     ~~~~~~~~^~~~~~~~~~~~~~~
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/cui/source/dialogs/nanpayloadwarningdlg.cxx:47:42: 
note: defined here: [loplugin:staticmethods]
IMPL_LINK_NOARG(NanPayloadWarningDialog, OnRejectClick, weld::Button&, void)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/include/tools/link.hxx:54:20: 
note: expanded from macro 'IMPL_LINK_NOARG'
     RetType Class::Member(SAL_UNUSED_PARAMETER ArgType)
                    ^
1 error generated.
make[1]: *** 
[/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/solenv/gbuild/LinkTarget.mk:340: 
/home/tdf/lode/jenk
```


I checked `DECL_LINK(OnRejectClick, weld::Button&, void);` but 
`OnRejectClick` has already been declared static. And the similar event 
function `OnAcceptClick` did not trigger such error.


Why this error occurred?


From,

Sakura286.


Source code:
https://gerrit.libreoffice.org/c/core/+/165391/5/cui/source/inc/nanpayloadwarningdlg.hxx
https://gerrit.libreoffice.org/c/core/+/165391/5/cui/source/dialogs/nanpayloadwarningdlg.cxx

Error log:
https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/159644/consoleFull#-124544997d107d11c-eea5-4209-baa1-fcfb59f7f8a6



More information about the LibreOffice mailing list