aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2014-05-26 13:39:12 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2014-05-26 14:02:12 -0300
commite994b6f1b1082d5808f27addd7638e86f02aeaf1 (patch)
treec48c17c4301e254c0f468cd5c07008cc15b6e102 /src
parentf3dc04bf7f658f7d5d15047494fd15e286b4c7b6 (diff)
downloadrneovim-e994b6f1b1082d5808f27addd7638e86f02aeaf1.tar.gz
rneovim-e994b6f1b1082d5808f27addd7638e86f02aeaf1.tar.bz2
rneovim-e994b6f1b1082d5808f27addd7638e86f02aeaf1.zip
Build: Add 'nonnull' attributes to msgpack_rpc functions
Diffstat (limited to 'src')
-rw-r--r--src/nvim/os/msgpack_rpc.h103
1 files changed, 69 insertions, 34 deletions
diff --git a/src/nvim/os/msgpack_rpc.h b/src/nvim/os/msgpack_rpc.h
index 319a069df7..4d8d51699b 100644
--- a/src/nvim/os/msgpack_rpc.h
+++ b/src/nvim/os/msgpack_rpc.h
@@ -6,6 +6,7 @@
#include <msgpack.h>
+#include "nvim/func_attr.h"
#include "nvim/api/private/defs.h"
/// Validates the basic structure of the msgpack-rpc call and fills `res`
@@ -14,14 +15,16 @@
/// @param id The channel id
/// @param req The parsed request object
/// @param res A packer that contains the response
-void msgpack_rpc_call(uint64_t id, msgpack_object *req, msgpack_packer *res);
+void msgpack_rpc_call(uint64_t id, msgpack_object *req, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_NONNULL_ARG(3);
/// Packs a notification message
///
/// @param type The message type, an arbitrary string
/// @param data The notification data
/// @param packer Where the notification will be packed to
-void msgpack_rpc_notification(String type, Object data, msgpack_packer *pac);
+void msgpack_rpc_notification(String type, Object data, msgpack_packer *pac)
+ FUNC_ATTR_NONNULL_ARG(3);
/// Dispatches to the actual API function after basic payload validation by
/// `msgpack_rpc_call`. It is responsible for validating/converting arguments
@@ -34,13 +37,15 @@ void msgpack_rpc_notification(String type, Object data, msgpack_packer *pac);
/// @param res A packer that contains the response
void msgpack_rpc_dispatch(uint64_t id,
msgpack_object *req,
- msgpack_packer *res);
+ msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2) FUNC_ATTR_NONNULL_ARG(3);
/// Finishes the msgpack-rpc call with an error message.
///
/// @param msg The error message
/// @param res A packer that contains the response
-void msgpack_rpc_error(char *msg, msgpack_packer *res);
+void msgpack_rpc_error(char *msg, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ALL;
/// Functions for validating and converting from msgpack types to C types.
/// These are used by `msgpack_rpc_dispatch` to validate and convert each
@@ -49,21 +54,36 @@ void msgpack_rpc_error(char *msg, msgpack_packer *res);
/// @param obj The object to convert
/// @param[out] arg A pointer to the avalue
/// @return true if the convertion succeeded, false otherwise
-bool msgpack_rpc_to_boolean(msgpack_object *obj, Boolean *arg);
-bool msgpack_rpc_to_integer(msgpack_object *obj, Integer *arg);
-bool msgpack_rpc_to_float(msgpack_object *obj, Float *arg);
-bool msgpack_rpc_to_position(msgpack_object *obj, Position *arg);
-bool msgpack_rpc_to_string(msgpack_object *obj, String *arg);
-bool msgpack_rpc_to_buffer(msgpack_object *obj, Buffer *arg);
-bool msgpack_rpc_to_window(msgpack_object *obj, Window *arg);
-bool msgpack_rpc_to_tabpage(msgpack_object *obj, Tabpage *arg);
-bool msgpack_rpc_to_object(msgpack_object *obj, Object *arg);
-bool msgpack_rpc_to_stringarray(msgpack_object *obj, StringArray *arg);
-bool msgpack_rpc_to_bufferarray(msgpack_object *obj, BufferArray *arg);
-bool msgpack_rpc_to_windowarray(msgpack_object *obj, WindowArray *arg);
-bool msgpack_rpc_to_tabpagearray(msgpack_object *obj, TabpageArray *arg);
-bool msgpack_rpc_to_array(msgpack_object *obj, Array *arg);
-bool msgpack_rpc_to_dictionary(msgpack_object *obj, Dictionary *arg);
+bool msgpack_rpc_to_boolean(msgpack_object *obj, Boolean *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_integer(msgpack_object *obj, Integer *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_float(msgpack_object *obj, Float *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_position(msgpack_object *obj, Position *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_string(msgpack_object *obj, String *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_buffer(msgpack_object *obj, Buffer *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_window(msgpack_object *obj, Window *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_tabpage(msgpack_object *obj, Tabpage *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_object(msgpack_object *obj, Object *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_stringarray(msgpack_object *obj, StringArray *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_bufferarray(msgpack_object *obj, BufferArray *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_windowarray(msgpack_object *obj, WindowArray *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_tabpagearray(msgpack_object *obj, TabpageArray *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_array(msgpack_object *obj, Array *arg)
+ FUNC_ATTR_NONNULL_ALL;
+bool msgpack_rpc_to_dictionary(msgpack_object *obj, Dictionary *arg)
+ FUNC_ATTR_NONNULL_ALL;
/// Functions for converting from C types to msgpack types.
/// These are used by `msgpack_rpc_dispatch` to convert return values
@@ -71,21 +91,36 @@ bool msgpack_rpc_to_dictionary(msgpack_object *obj, Dictionary *arg);
///
/// @param result A pointer to the result
/// @param res A packer that contains the response
-void msgpack_rpc_from_boolean(Boolean result, msgpack_packer *res);
-void msgpack_rpc_from_integer(Integer result, msgpack_packer *res);
-void msgpack_rpc_from_float(Float result, msgpack_packer *res);
-void msgpack_rpc_from_position(Position result, msgpack_packer *res);
-void msgpack_rpc_from_string(String result, msgpack_packer *res);
-void msgpack_rpc_from_buffer(Buffer result, msgpack_packer *res);
-void msgpack_rpc_from_window(Window result, msgpack_packer *res);
-void msgpack_rpc_from_tabpage(Tabpage result, msgpack_packer *res);
-void msgpack_rpc_from_object(Object result, msgpack_packer *res);
-void msgpack_rpc_from_stringarray(StringArray result, msgpack_packer *res);
-void msgpack_rpc_from_bufferarray(BufferArray result, msgpack_packer *res);
-void msgpack_rpc_from_windowarray(WindowArray result, msgpack_packer *res);
-void msgpack_rpc_from_tabpagearray(TabpageArray result, msgpack_packer *res);
-void msgpack_rpc_from_array(Array result, msgpack_packer *res);
-void msgpack_rpc_from_dictionary(Dictionary result, msgpack_packer *res);
+void msgpack_rpc_from_boolean(Boolean result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_integer(Integer result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_float(Float result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_position(Position result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_string(String result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_buffer(Buffer result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_window(Window result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_tabpage(Tabpage result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_object(Object result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_stringarray(StringArray result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_bufferarray(BufferArray result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_windowarray(WindowArray result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_tabpagearray(TabpageArray result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_array(Array result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
+void msgpack_rpc_from_dictionary(Dictionary result, msgpack_packer *res)
+ FUNC_ATTR_NONNULL_ARG(2);
/// Helpers for initializing types that may be freed later
#define msgpack_rpc_init_boolean