]> 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 e381af8..b3018a2 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,
-                 const char *format, ...);
+                 const char *format, ...) CHECK_PRINTF(3, 4);
 
 /*
  * 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,
-                  const char *format, va_list ap);
+                  const char *format, va_list ap) CHECK_PRINTF(3, 0);
 
 /*
  * 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 2a1132c..7caa3d0 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 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 WhatNow(int, char **);
+int WhatNow(int, char **) NORETURN;
 
 /* Includes trailing NUL */
 
index 7808e1a..fed756b 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 **);
-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 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 *);
index 58cab1b..a533042 100644 (file)
@@ -473,7 +473,7 @@ retry:
      */
 
     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;
     }
index 909d21d..88dfb15 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 void report (char *, char *, char *, char *, ...);
+static void report (char *, char *, char *, char *, ...)
+    CHECK_PRINTF(4, 5);
 static void pipeser (int);
 
 
index 550af61..1efc1e6 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 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);
@@ -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)
-       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;
 
index 53406c0..d987f69 100644 (file)
@@ -32,7 +32,7 @@ static char *errs = NULL;
 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);
 
 
index ca6599e..d4a6521 100644 (file)
@@ -24,11 +24,12 @@ static netsec_context *nsc = NULL;
  * static prototypes
  */
 
-static int command(const char *, ...);
+static int command(const char *, ...) CHECK_PRINTF(1, 2);
 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 *,
index 08e5242..1117061 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 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);
index b249dc4..e136f10 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 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 *);
 
@@ -802,12 +802,12 @@ parse (int fd)
        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++)
-           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) : "");
     }
 
@@ -887,7 +887,7 @@ glob (int fd)
 
     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));
     }
 }