Add void function prototypes to NativeCall and MenuHandler (#2081)

* Add void prototype to NativeCall typeset

`void` prototype can be used for simple natives which don't return any value.
This is done to silence compiler warnings 209 (`function has explicit 'int' tag but does not return a value`) and 242 (`function "NativeCallback" should return an explicit value`).

* Make MenuHandler into typeset and add void prototype

This can be used for basic menu handlers that don't return modified item styles and don't redraw menu items.
This commit is contained in:
Ivan Zaitsev 2023-12-19 04:57:58 +05:00 committed by GitHub
parent 385eae892c
commit ab6b45b81c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -448,6 +448,16 @@ typeset NativeCall
* @return Value for the native call to return.
*/
function any (Handle plugin, int numParams);
/**
* Defines a native function.
*
* It is not necessary to validate the parameter count
*
* @param plugin Handle of the calling plugin.
* @param numParams Number of parameters passed to the native.
*/
function void (Handle plugin, int numParams);
}
/**

View File

@ -148,8 +148,15 @@ enum MenuSource
* @param action The action of the menu.
* @param param1 First action parameter (usually the client).
* @param param2 Second action parameter (usually the item).
*
* Use void-typed prototype if you don't plan to handle MenuAction_DrawItem
* and MenuAction_DisplayItem actions.
*/
typedef MenuHandler = function int (Menu menu, MenuAction action, int param1, int param2);
typeset MenuHandler
{
function int (Menu menu, MenuAction action, int param1, int param2);
function void (Menu menu, MenuAction action, int param1, int param2);
};
// Panels are used for drawing raw menus without any extra helper functions.
// Handles must be closed via delete or CloseHandle().