]> diplodocus.org Git - nmh/commitdiff
Add more NORETURN and CHECK_PRINTF function attributes.
authorRalph Corderoy <ralph@inputplus.co.uk>
Sat, 26 Aug 2017 14:01:35 +0000 (15:01 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Sat, 26 Aug 2017 14:01:35 +0000 (15:01 +0100)
And fix the errors that the compiler then detects.

h/netsec.h
h/prototypes.h
mts/smtp/smtp.c
sbr/netsec.c
uip/mhfixmsg.c
uip/mhlsbr.c
uip/mhmisc.c
uip/popsbr.c
uip/post.c
uip/slocal.c

index e381af86142728d0ef9918768d7daf2981303151..b3018a244356fb8dc985eb17383f4df992678a56 100644 (file)
@@ -201,7 +201,7 @@ int netsec_write(netsec_context *ns_context, const void *buffer, size_t size,
  */
 
 int netsec_printf(netsec_context *ns_context, char **errstr,
  */
 
 int netsec_printf(netsec_context *ns_context, char **errstr,
-                 const char *format, ...);
+                 const char *format, ...) CHECK_PRINTF(3, 4);
 
 /*
  * Write bytes using a va_list argument.
 
 /*
  * Write bytes using a va_list argument.
@@ -217,7 +217,7 @@ int netsec_printf(netsec_context *ns_context, char **errstr,
  */
 
 int netsec_vprintf(netsec_context *ns_context, char **errstr,
  */
 
 int netsec_vprintf(netsec_context *ns_context, char **errstr,
-                  const char *format, va_list ap);
+                  const char *format, va_list ap) CHECK_PRINTF(3, 0);
 
 /*
  * Flush any buffered bytes to the network.
 
 /*
  * Flush any buffered bytes to the network.
@@ -418,4 +418,5 @@ int netsec_negotiate_tls(netsec_context *ns_context, char **errstr);
  *
  */
 
  *
  */
 
-void netsec_err(char **errstr, const char *format, ...);
+void netsec_err(char **errstr, const char *format, ...)
+    CHECK_PRINTF(2, 3);
index 2a1132c7313f0c0c5782bcd92fb6297b1cbd0be9..7caa3d0fa77c16d7876ffa4f82a7f99afa092380 100644 (file)
@@ -385,10 +385,10 @@ int sc_width(void);
 int build_form (char *, char *, int *, char *, char *, char *, char *,
                char *, char *);
 int sendsbr (char **, int, char *, char *, struct stat *, int, const char *);
 int build_form (char *, char *, int *, char *, char *, char *, char *,
                char *, char *);
 int sendsbr (char **, int, char *, char *, struct stat *, int, const char *);
-int SOprintf (char *, ...);
+int SOprintf (char *, ...) CHECK_PRINTF(1, 2);
 int what_now (char *, int, int, char *, char *,
        int, struct msgs *, char *, int, char *, int);
 int what_now (char *, int, int, char *, char *,
        int, struct msgs *, char *, int, char *, int);
-int WhatNow(int, char **);
+int WhatNow(int, char **) NORETURN;
 
 /* Includes trailing NUL */
 
 
 /* Includes trailing NUL */
 
index 7808e1a70871454de78e9e306e4ad147f7383bdd..fed756b7d1b615b4ed3092ef4d7a5e1eff2175b0 100644 (file)
@@ -59,9 +59,9 @@ static int sendmail_init (char *, int, int, int, int, const char *,
                          const char *);
 
 static int rclient (char *, char *, char **);
                          const char *);
 
 static int rclient (char *, char *, char **);
-static int sm_ierror (const char *fmt, ...);
+static int sm_ierror (const char *fmt, ...) CHECK_PRINTF(1, 2);
 static int sm_nerror (char *);
 static int sm_nerror (char *);
-static int smtalk (int time, char *fmt, ...);
+static int smtalk (int time, char *fmt, ...) CHECK_PRINTF(2, 3);
 static int sm_wstream (char *, int);
 static int smhear (void);
 static char *EHLOset (char *);
 static int sm_wstream (char *, int);
 static int smhear (void);
 static char *EHLOset (char *);
index 58cab1bbd1093ffe5eabed03c3e8ee82a72d08ff..a533042e5980878c4ed5e4d00d5545d5b905f238 100644 (file)
@@ -473,7 +473,7 @@ retry:
      */
 
     if (count >= nsc->ns_inbufsize / 2) {
      */
 
     if (count >= nsc->ns_inbufsize / 2) {
-       netsec_err(errstr, "Unable to find a line terminator after %d bytes",
+       netsec_err(errstr, "Unable to find a line terminator after %zu bytes",
                   count);
        return NULL;
     }
                   count);
        return NULL;
     }
index 909d21def564c2900c54e4b28dc26d4837116f58..88dfb153b9c7ba6e1f78dd6a4f08c545ea5898b4 100644 (file)
@@ -125,7 +125,8 @@ static int fix_filename_encoding (CT);
 static int write_content (CT, const char *, char *, FILE *, int, int);
 static void set_text_ctparams(CT, char *, int);
 static int remove_file (const char *);
 static int write_content (CT, const char *, char *, FILE *, int, int);
 static void set_text_ctparams(CT, char *, int);
 static int remove_file (const char *);
-static void report (char *, char *, char *, char *, ...);
+static void report (char *, char *, char *, char *, ...)
+    CHECK_PRINTF(4, 5);
 static void pipeser (int);
 
 
 static void pipeser (int);
 
 
index 550af6144af2e0c53dc6e1c9584b213ffda64810..1efc1e6a2ae0213ed0f8980ec7c8ad6303fd6390 100644 (file)
@@ -327,7 +327,7 @@ static void putch (char, unsigned long);
 static void intrser (int);
 static void pipeser (int);
 static void quitser (int);
 static void intrser (int);
 static void pipeser (int);
 static void quitser (int);
-static void mhladios (char *, char *, ...);
+static void mhladios (char *, char *, ...) CHECK_PRINTF(2, 3);
 static void mhldone (int);
 static void filterbody (struct mcomp *, char *, int, int,
                         m_getfld_state_t);
 static void mhldone (int);
 static void filterbody (struct mcomp *, char *, int, int,
                         m_getfld_state_t);
@@ -1305,7 +1305,7 @@ putcomp (struct mcomp *c1, struct mcomp *c2, int flag)
     if ((ovtxt = c1->c_ovtxt ? c1->c_ovtxt : global.c_ovtxt) == NULL)
        ovtxt = "";
     if (wid < ovoff + strlen (ovtxt) + 5)
     if ((ovtxt = c1->c_ovtxt ? c1->c_ovtxt : global.c_ovtxt) == NULL)
        ovtxt = "";
     if (wid < ovoff + strlen (ovtxt) + 5)
-       mhladios (NULL, "component: %s width(%d) too small for overflow(%d)",
+       mhladios(NULL, "component: %s width(%d) too small for overflow(%zu)",
                c1->c_name, wid, ovoff + strlen (ovtxt) + 5);
     onelp = NULL;
 
                c1->c_name, wid, ovoff + strlen (ovtxt) + 5);
     onelp = NULL;
 
index 53406c03826320739b464ccd98db8565cefc60f5..d987f6935080e98947a77e0e73b62d35c37bb818 100644 (file)
@@ -32,7 +32,7 @@ static char *errs = NULL;
 int part_ok (CT);
 int part_exact(CT ct);
 int type_ok (CT, int);
 int part_ok (CT);
 int part_exact(CT ct);
 int type_ok (CT, int);
-void content_error (char *, CT, char *, ...);
+void content_error (char *, CT, char *, ...) CHECK_PRINTF(3, 4);
 void flush_errors (void);
 
 
 void flush_errors (void);
 
 
index ca6599e0352e3e69e54725ee2def76e31dc3738b..d4a65212490faf20b6f995b82290ae29a07826fe 100644 (file)
@@ -24,11 +24,12 @@ static netsec_context *nsc = NULL;
  * static prototypes
  */
 
  * static prototypes
  */
 
-static int command(const char *, ...);
+static int command(const char *, ...) CHECK_PRINTF(1, 2);
 static int multiline(void);
 
 static int multiline(void);
 
-static int traverse (int (*)(void *, char *), void *closure, const char *, ...);
-static int vcommand(const char *, va_list);
+static int traverse(int (*)(void *, char *), void *closure,
+    const char *, ...) CHECK_PRINTF(3, 4);
+static int vcommand(const char *, va_list) CHECK_PRINTF(1, 0);
 static int pop_getline (char *, int, netsec_context *);
 static int pop_sasl_callback(enum sasl_message_type, unsigned const char *,
                             unsigned int, unsigned char **, unsigned int *,
 static int pop_getline (char *, int, netsec_context *);
 static int pop_sasl_callback(enum sasl_message_type, unsigned const char *,
                             unsigned int, unsigned char **, unsigned int *,
index 08e524265b1afa237e8393e56708a3d59f8f19cf..11170615cdfff06b5c1062bbd9f6c25f0f6c4ec1 100644 (file)
@@ -306,7 +306,7 @@ static void sigon (void);
 static void sigoff (void);
 static void p_refile (char *);
 static void fcc (char *, char *);
 static void sigoff (void);
 static void p_refile (char *);
 static void fcc (char *, char *);
-static void die (char *, char *, ...);
+static void die (char *, char *, ...) CHECK_PRINTF(2, 3);
 static void post (char *, int, int, int, char *, int, char *);
 static void do_text (char *file, int fd);
 static void do_an_address (struct mailname *, int);
 static void post (char *, int, int, int, char *, int, char *);
 static void do_text (char *file, int fd);
 static void do_an_address (struct mailname *, int);
index b249dc4b7ede3819bda2a99dd2c813003c40a206..e136f101df4b5cff24b6e90c454b015abe0922c7 100644 (file)
@@ -172,9 +172,9 @@ static int usr_folder (int, char *);
 static void alrmser (int);
 static void get_sender (char *, char **);
 static int copy_message (int, char *, int);
 static void alrmser (int);
 static void get_sender (char *, char **);
 static int copy_message (int, char *, int);
-static void verbose_printf (char *fmt, ...);
-static void adorn (char *, char *, ...);
-static void debug_printf (char *fmt, ...);
+static void verbose_printf (char *fmt, ...) CHECK_PRINTF(1, 2);
+static void adorn (char *, char *, ...) CHECK_PRINTF(2, 3);
+static void debug_printf (char *fmt, ...) CHECK_PRINTF(1, 2);
 static int suppress_duplicates (int, char *);
 static char *trim (char *);
 
 static int suppress_duplicates (int, char *);
 static char *trim (char *);
 
@@ -802,12 +802,12 @@ parse (int fd)
        p->p_value = getcpy (q ? q->p_value : "");
        p->p_flags &= ~P_CHK;
        if (debug)
        p->p_value = getcpy (q ? q->p_value : "");
        p->p_flags &= ~P_CHK;
        if (debug)
-           debug_printf ("vars[%d]: name=\"%s\" value=\"%s\"\n",
+           debug_printf ("vars[%ld]: name=\"%s\" value=\"%s\"\n",
                    p - vars, p->p_name, trim(p->p_value));
     }
     if (debug) {
        for (p = hdrs; p->p_name; p++)
                    p - vars, p->p_name, trim(p->p_value));
     }
     if (debug) {
        for (p = hdrs; p->p_name; p++)
-           debug_printf ("hdrs[%d]: name=\"%s\" value=\"%s\"\n",
+           debug_printf ("hdrs[%ld]: name=\"%s\" value=\"%s\"\n",
                p - hdrs, p->p_name, p->p_value ? trim(p->p_value) : "");
     }
 
                p - hdrs, p->p_name, p->p_value ? trim(p->p_value) : "");
     }
 
@@ -887,7 +887,7 @@ glob (int fd)
 
     if (debug) {
        for (p = vars; p->p_name; p++)
 
     if (debug) {
        for (p = vars; p->p_name; p++)
-           debug_printf ("vars[%d]: name=\"%s\" value=\"%s\"\n",
+           debug_printf ("vars[%ld]: name=\"%s\" value=\"%s\"\n",
                    p - vars, p->p_name, trim(p->p_value));
     }
 }
                    p - vars, p->p_name, trim(p->p_value));
     }
 }