mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
func_attr.h: FUNC_ATTR_PRINTF
This commit is contained in:
parent
2b06c32a23
commit
197d907e09
@ -41,7 +41,7 @@ MsgpackRpcRequestHandler msgpack_rpc_get_handler_for(const char *name,
|
|||||||
|
|
||||||
if (!rv.fn) {
|
if (!rv.fn) {
|
||||||
api_set_error(error, kErrorTypeException, "Invalid method: %.*s",
|
api_set_error(error, kErrorTypeException, "Invalid method: %.*s",
|
||||||
m.size > 0 ? m.size : sizeof("<empty>"),
|
m.size > 0 ? (int)m.size : (int)sizeof("<empty>"),
|
||||||
m.size > 0 ? m.data : "<empty>");
|
m.size > 0 ? m.data : "<empty>");
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -1157,7 +1157,7 @@ static void set_option_value_err(char *key,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void api_set_error(Error *err, ErrorType errType, const char *format, ...)
|
void api_set_error(Error *err, ErrorType errType, const char *format, ...)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PRINTF(3, 4)
|
||||||
{
|
{
|
||||||
assert(kErrorTypeNone != errType);
|
assert(kErrorTypeNone != errType);
|
||||||
va_list args1;
|
va_list args1;
|
||||||
|
@ -222,9 +222,8 @@ static void ui_set_option(UI *ui, bool init, String name, Object value,
|
|||||||
if (strequal(name.data, ui_ext_names[i])
|
if (strequal(name.data, ui_ext_names[i])
|
||||||
|| (i == kUIPopupmenu && is_popupmenu)) {
|
|| (i == kUIPopupmenu && is_popupmenu)) {
|
||||||
if (value.type != kObjectTypeBoolean) {
|
if (value.type != kObjectTypeBoolean) {
|
||||||
snprintf((char *)IObuff, IOSIZE, "%s must be a Boolean",
|
api_set_error(error, kErrorTypeValidation, "%s must be a Boolean",
|
||||||
name.data);
|
name.data);
|
||||||
api_set_error(error, kErrorTypeValidation, (char *)IObuff);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool boolval = value.data.boolean;
|
bool boolval = value.data.boolean;
|
||||||
|
@ -99,6 +99,10 @@
|
|||||||
# undef FUNC_ATTR_NO_SANITIZE_UNDEFINED
|
# undef FUNC_ATTR_NO_SANITIZE_UNDEFINED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FUNC_ATTR_PRINTF
|
||||||
|
# undef FUNC_ATTR_PRINTF
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DID_REAL_ATTR
|
#ifndef DID_REAL_ATTR
|
||||||
# define DID_REAL_ATTR
|
# define DID_REAL_ATTR
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
@ -117,6 +121,7 @@
|
|||||||
# define REAL_FATTR_NONNULL_ALL __attribute__((nonnull))
|
# define REAL_FATTR_NONNULL_ALL __attribute__((nonnull))
|
||||||
# define REAL_FATTR_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__)))
|
# define REAL_FATTR_NONNULL_ARG(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||||
# define REAL_FATTR_NORETURN __attribute__((noreturn))
|
# define REAL_FATTR_NORETURN __attribute__((noreturn))
|
||||||
|
# define REAL_FATTR_PRINTF(x, y) __attribute__((format (printf, x, y)))
|
||||||
|
|
||||||
# if NVIM_HAS_ATTRIBUTE(returns_nonnull)
|
# if NVIM_HAS_ATTRIBUTE(returns_nonnull)
|
||||||
# define REAL_FATTR_NONNULL_RET __attribute__((returns_nonnull))
|
# define REAL_FATTR_NONNULL_RET __attribute__((returns_nonnull))
|
||||||
@ -193,6 +198,10 @@
|
|||||||
# ifndef REAL_FATTR_NO_SANITIZE_UNDEFINED
|
# ifndef REAL_FATTR_NO_SANITIZE_UNDEFINED
|
||||||
# define REAL_FATTR_NO_SANITIZE_UNDEFINED
|
# define REAL_FATTR_NO_SANITIZE_UNDEFINED
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# ifndef REAL_FATTR_PRINTF
|
||||||
|
# define REAL_FATTR_PRINTF(x, y)
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEFINE_FUNC_ATTRIBUTES
|
#ifdef DEFINE_FUNC_ATTRIBUTES
|
||||||
@ -215,6 +224,7 @@
|
|||||||
# define FUNC_ATTR_NONNULL_RET REAL_FATTR_NONNULL_RET
|
# define FUNC_ATTR_NONNULL_RET REAL_FATTR_NONNULL_RET
|
||||||
# define FUNC_ATTR_NORETURN REAL_FATTR_NORETURN
|
# define FUNC_ATTR_NORETURN REAL_FATTR_NORETURN
|
||||||
# define FUNC_ATTR_NO_SANITIZE_UNDEFINED REAL_FATTR_NO_SANITIZE_UNDEFINED
|
# define FUNC_ATTR_NO_SANITIZE_UNDEFINED REAL_FATTR_NO_SANITIZE_UNDEFINED
|
||||||
|
# define FUNC_ATTR_PRINTF(x, y) REAL_FATTR_PRINTF(x, y)
|
||||||
#elif !defined(DO_NOT_DEFINE_EMPTY_ATTRIBUTES)
|
#elif !defined(DO_NOT_DEFINE_EMPTY_ATTRIBUTES)
|
||||||
# define FUNC_ATTR_MALLOC
|
# define FUNC_ATTR_MALLOC
|
||||||
# define FUNC_ATTR_ALLOC_SIZE(x)
|
# define FUNC_ATTR_ALLOC_SIZE(x)
|
||||||
@ -230,4 +240,5 @@
|
|||||||
# define FUNC_ATTR_NONNULL_RET
|
# define FUNC_ATTR_NONNULL_RET
|
||||||
# define FUNC_ATTR_NORETURN
|
# define FUNC_ATTR_NORETURN
|
||||||
# define FUNC_ATTR_NO_SANITIZE_UNDEFINED
|
# define FUNC_ATTR_NO_SANITIZE_UNDEFINED
|
||||||
|
# define FUNC_ATTR_PRINTF(x, y)
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user