summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2017-06-09 01:20:07 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2017-06-13 19:45:55 +0100
commit268d00ffff678f5c061e34880020d164dca5795e (patch)
tree8c33861a036d042ea805ba933a23f22621c677cf
parent65e061b76867a9ea7aeeb535341b790b90ae6c21 (diff)
Add compile-time checks on expanding-string function use
-rw-r--r--src/src/functions.h8
-rw-r--r--src/src/mytypes.h6
2 files changed, 8 insertions, 6 deletions
diff --git a/src/src/functions.h b/src/src/functions.h
index 4be375d77..34f6434d0 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -14,7 +14,7 @@ are in in fact in separate headers. */
#ifdef EXIM_PERL
extern uschar *call_perl_cat(uschar *, int *, int *, uschar **, uschar *,
- uschar **);
+ uschar **) WARN_UNUSED_RESULT;
extern void cleanup_perl(void);
extern uschar *init_perl(uschar *);
#endif
@@ -439,12 +439,12 @@ extern int stdin_getc(unsigned);
extern int stdin_feof(void);
extern int stdin_ferror(void);
extern int stdin_ungetc(int);
-extern uschar *string_append(uschar *, int *, int *, int, ...);
+extern uschar *string_append(uschar *, int *, int *, int, ...) WARN_UNUSED_RESULT;
extern uschar *string_append_listele(uschar *, uschar, const uschar *);
extern uschar *string_append_listele_n(uschar *, uschar, const uschar *, unsigned);
extern uschar *string_base62(unsigned long int);
-extern uschar *string_cat(uschar *, int *, int *, const uschar *);
-extern uschar *string_catn(uschar *, int *, int *, const uschar *, int);
+extern uschar *string_cat(uschar *, int *, int *, const uschar *) WARN_UNUSED_RESULT;
+extern uschar *string_catn(uschar *, int *, int *, const uschar *, int) WARN_UNUSED_RESULT;
extern int string_compare_by_pointer(const void *, const void *);
extern uschar *string_copy_dnsdomain(uschar *);
extern uschar *string_copy_malloc(const uschar *);
diff --git a/src/src/mytypes.h b/src/src/mytypes.h
index b288a32cb..a74705739 100644
--- a/src/src/mytypes.h
+++ b/src/src/mytypes.h
@@ -30,11 +30,13 @@ local_scan.h includes it and exim.h includes them both (to get this earlier). */
the arguments of printf-like functions. This is done by a macro. */
#if defined(__GNUC__) || defined(__clang__)
-# define PRINTF_FUNCTION(A,B) __attribute__((format(printf,A,B)))
-# define ARG_UNUSED __attribute__((__unused__))
+# define PRINTF_FUNCTION(A,B) __attribute__((format(printf,A,B)))
+# define ARG_UNUSED __attribute__((__unused__))
+# define WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))
#else
# define PRINTF_FUNCTION(A,B)
# define ARG_UNUSED /**/
+# define WARN_UNUSED_RESULT /**/
#endif
#ifdef WANT_DEEPER_PRINTF_CHECKS