From 1d1e797309115915e04472a419a9c548011cb093 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 6 Jul 2019 20:44:45 +0100 Subject: [PATCH] more function attribute annotation --- src/src/functions.h | 14 +++++++------- src/src/mytypes.h | 10 ++++++++-- src/src/store.h | 6 +++--- src/src/transports/smtp.c | 2 ++ 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/src/functions.h b/src/src/functions.h index 1273e8138..3fc27cb5a 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -215,7 +215,7 @@ extern void msg_event_raise(const uschar *, const address_item *); extern int exim_chown_failure(int, const uschar*, uid_t, gid_t); extern const uschar * exim_errstr(int); -extern void exim_exit(int, const uschar *); +extern void exim_exit(int, const uschar *) NORETURN; extern void exim_nullstd(void); extern void exim_setugid(uid_t, gid_t, BOOL, uschar *); extern void exim_wait_tick(struct timeval *, int); @@ -378,7 +378,7 @@ extern void readconf_rest(void); extern uschar *readconf_retry_error(const uschar *, const uschar *, int *, int *); extern void readconf_save_config(const uschar *); extern void read_message_body(BOOL); -extern void receive_bomb_out(uschar *, uschar *); +extern void receive_bomb_out(uschar *, uschar *) NORETURN; extern BOOL receive_check_fs(int); extern BOOL receive_check_set_sender(uschar *); extern BOOL receive_msg(BOOL); @@ -436,10 +436,10 @@ extern int sieve_interpret(uschar *, int, uschar *, uschar *, uschar *, extern void sigalrm_handler(int); extern BOOL smtp_buffered(void); extern void smtp_closedown(uschar *); -extern void smtp_command_timeout_exit(void); -extern void smtp_command_sigterm_exit(void); -extern void smtp_data_timeout_exit(void); -extern void smtp_data_sigint_exit(void); +extern void smtp_command_timeout_exit(void) NORETURN; +extern void smtp_command_sigterm_exit(void) NORETURN; +extern void smtp_data_timeout_exit(void) NORETURN; +extern void smtp_data_sigint_exit(void) NORETURN; extern uschar *smtp_cmd_hist(void); extern int smtp_connect(smtp_connect_args *, const blob *); extern int smtp_sock_connect(host_item *, int, int, uschar *, @@ -456,7 +456,7 @@ extern void smtp_get_cache(void); extern int smtp_handle_acl_fail(int, int, uschar *, uschar *); extern void smtp_log_no_mail(void); extern void smtp_message_code(uschar **, int *, uschar **, uschar **, BOOL); -extern void smtp_proxy_tls(void *, uschar *, size_t, int *, int); +extern void smtp_proxy_tls(void *, uschar *, size_t, int *, int) NORETURN; extern BOOL smtp_read_response(void *, uschar *, int, int, int); extern void smtp_reset(void *); extern void smtp_respond(uschar *, int, BOOL, uschar *); diff --git a/src/src/mytypes.h b/src/src/mytypes.h index 5871bddfc..be11240bf 100644 --- a/src/src/mytypes.h +++ b/src/src/mytypes.h @@ -33,10 +33,16 @@ the arguments of printf-like functions. This is done by a macro. */ # define PRINTF_FUNCTION(A,B) __attribute__((format(printf,A,B))) # define ARG_UNUSED __attribute__((__unused__)) # define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) +# define ALLOC __attribute__((malloc)) +# define ALLOC_SIZE(A) __attribute__((alloc_size(A))) +# define NORETURN __attribute__((noreturn)) #else # define PRINTF_FUNCTION(A,B) -# define ARG_UNUSED /**/ -# define WARN_UNUSED_RESULT /**/ +# define ARG_UNUSED /**/ +# define WARN_UNUSED_RESULT /**/ +# define ALLOC /**/ +# define ALLOC_SIZE(A) /**/ +# define NORETURN /**/ #endif #ifdef WANT_DEEPER_PRINTF_CHECKS diff --git a/src/src/store.h b/src/src/store.h index cb0a3cae9..393f6c7b5 100644 --- a/src/src/store.h +++ b/src/src/store.h @@ -44,9 +44,9 @@ tracing information for debugging. */ /* The value of the 2nd arg is __FILE__ in every call, so give its correct type */ extern BOOL store_extend_3(void *, int, int, const char *, int); extern void store_free_3(void *, const char *, int); -extern void *store_get_3(int, const char *, int); -extern void *store_get_perm_3(int, const char *, int); -extern void *store_malloc_3(int, const char *, int); +extern void *store_get_3(int, const char *, int) ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT; +extern void *store_get_perm_3(int, const char *, int) ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT; +extern void *store_malloc_3(int, const char *, int) ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT; extern void *store_newblock_3(void *, int, int, const char *, int); extern void store_reset_3(void *, const char *, int); diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index baf304405..ad0de52b6 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -3307,6 +3307,8 @@ Arguments: bufsiz size of buffer pfd pipe filedescriptor array; [0] is comms to proxied process timeout per-read timeout, seconds + +Does not return. */ void -- 2.25.1