From: David Levine Date: Fri, 13 Jan 2012 04:19:24 +0000 (-0600) Subject: Added NMH_UNUSED macro for suppressing warnings about unused parameters X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=3a84d814004fd4557bf4f44952648e9e69bd22a8;hp=f5e7506daeb8f52e02348504fb1699284b299f25;p=mmh Added NMH_UNUSED macro for suppressing warnings about unused parameters with gcc -Wunused-parameter --- diff --git a/h/mh.h b/h/mh.h index e3a382a..b0a841a 100644 --- a/h/mh.h +++ b/h/mh.h @@ -32,8 +32,10 @@ typedef unsigned char boolean; /* not int so we can pack in a structure */ */ #if __GNUC__ > 2 #define NORETURN __attribute__((__noreturn__)) +#define NMH_UNUSED(i) (void) i #else #define NORETURN +#define NMH_UNUSED(i) i #endif /* diff --git a/mts/smtp/smtp.c b/mts/smtp/smtp.c index caa1c73..df1dbbf 100644 --- a/mts/smtp/smtp.c +++ b/mts/smtp/smtp.c @@ -396,6 +396,8 @@ smtp_init (char *client, char *server, char *port, int watch, int verbose, return RP_RPLY; } } +#else /* TLS_SUPPORT */ + NMH_UNUSED (tls); #endif /* TLS_SUPPORT */ #ifdef CYRUS_SASL @@ -1121,6 +1123,8 @@ static int sm_get_pass(sasl_conn_t *conn, void *context, int id, sasl_secret_t **psecret) { + NMH_UNUSED (conn); + char **pw_context = (char **) context; char *pass = NULL; int len; @@ -1666,6 +1670,8 @@ sm_rerror (int rc) static void alrmser (int i) { + NMH_UNUSED (i); + #ifndef RELIABLE_SIGNALS SIGNAL (SIGALRM, alrmser); #endif diff --git a/sbr/getans.c b/sbr/getans.c index 5c70ba0..173e1b4 100644 --- a/sbr/getans.c +++ b/sbr/getans.c @@ -70,6 +70,8 @@ getans (char *prompt, struct swit *ansp) static void intrser (int i) { + NMH_UNUSED (i); + /* * should this be siglongjmp? */ diff --git a/sbr/lock_file.c b/sbr/lock_file.c index c7dffcf..d378749 100644 --- a/sbr/lock_file.c +++ b/sbr/lock_file.c @@ -167,6 +167,8 @@ lkclose (int fd, char *file) lockfile_remove(lkinfo.curlock); #endif /* HAVE_LIBLOCKFILE */ timerOFF (fd); /* turn off lock timer */ +#else /* DOT_LOCKING */ + NMH_UNUSED (file); #endif /* DOT_LOCKING */ return (close (fd)); @@ -258,6 +260,8 @@ lkfclose (FILE *fp, char *file) lockfile_remove(lkinfo.curlock); #endif /* HAVE_LIBLOCKFILE */ timerOFF (fileno(fp)); /* turn off lock timer */ +#else /* DOT_LOCKING */ + NMH_UNUSED (file); #endif /* DOT_LOCKING */ return (fclose (fp)); diff --git a/sbr/mts.c b/sbr/mts.c index 6e19bd1..834579d 100644 --- a/sbr/mts.c +++ b/sbr/mts.c @@ -141,6 +141,8 @@ static struct bind binds[] = { void mts_init (char *name) { + NMH_UNUSED (name); + const char *cp; FILE *fp; static int inited = 0; diff --git a/uip/folder.c b/uip/folder.c index 3e7c85d..f3b4ba4 100644 --- a/uip/folder.c +++ b/uip/folder.c @@ -457,6 +457,8 @@ get_folder_info_body (char *fold, char *msg, boolean *crawl_children) static boolean get_folder_info_callback (char *fold, void *baton) { + NMH_UNUSED (baton); + boolean crawl_children; get_folder_info_body (fold, NULL, &crawl_children); fflush (stdout); diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index 4cd3770..a0d1306 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -1447,6 +1447,8 @@ putch (char ch) static void intrser (int i) { + NMH_UNUSED (i); + discard (stdout); putchar ('\n'); longjmp (env, DONE); @@ -1456,6 +1458,8 @@ intrser (int i) static void pipeser (int i) { + NMH_UNUSED (i); + done (NOTOK); } @@ -1463,6 +1467,8 @@ pipeser (int i) static void quitser (int i) { + NMH_UNUSED (i); + putchar ('\n'); fflush (stdout); done (NOTOK); diff --git a/uip/mhparse.c b/uip/mhparse.c index 4959dfe..1b49efd 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -1042,6 +1042,8 @@ invalid: static int InitGeneric (CT ct) { + NMH_UNUSED (ct); + return OK; /* not much to do here */ } diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 5225825..44371f1 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -1051,6 +1051,9 @@ show_message_rfc822 (CT ct, int serial, int alternate) static int show_partial (CT ct, int serial, int alternate) { + NMH_UNUSED (serial); + NMH_UNUSED (alternate); + content_error (NULL, ct, "in order to display this message, you must reassemble it"); return NOTOK; @@ -1084,6 +1087,8 @@ show_external (CT ct, int serial, int alternate) static void intrser (int i) { + NMH_UNUSED (i); + putchar ('\n'); siglongjmp (intrenv, DONE); } diff --git a/uip/msh.c b/uip/msh.c index 3a5cc97..2339821 100644 --- a/uip/msh.c +++ b/uip/msh.c @@ -805,6 +805,7 @@ m_gMsgs (int n) FILE * msh_ready (int msgnum, int full) { + NMH_UNUSED (full); register int msgp; int fd; char *cp; @@ -1582,6 +1583,7 @@ seq_setcur (struct msgs *mp, int msgnum) static void intrser (int i) { + NMH_UNUSED (i); discard (stdout); interrupted++; } @@ -1590,6 +1592,7 @@ intrser (int i) static void pipeser (int i) { + NMH_UNUSED (i); if (broken_pipe++ == 0) fprintf (stderr, "broken pipe\n"); told_to_quit++; @@ -1600,6 +1603,7 @@ pipeser (int i) static void quitser (int i) { + NMH_UNUSED (i); told_to_quit++; interrupted++; } @@ -1608,6 +1612,7 @@ quitser (int i) static void alrmser (int i) { + NMH_UNUSED (i); longjmp (peerenv, DONE); } @@ -1672,6 +1677,7 @@ pINI (void) static int pQRY (char *str, int scansw) { + NMH_UNUSED (str); if (pQRY1 (scansw) == NOTOK || pQRY2 () == NOTOK) return NOTOK; diff --git a/uip/mshcmds.c b/uip/mshcmds.c index 64957e8..b46f753 100644 --- a/uip/mshcmds.c +++ b/uip/mshcmds.c @@ -1086,6 +1086,8 @@ static char *hlpmsg[] = { void helpcmd (char **args) { + NMH_UNUSED (args); + int i; for (i = 0; hlpmsg[i]; i++) { @@ -2366,6 +2368,8 @@ show (int msgnum) static int eom_action (int c) { + NMH_UNUSED (c); + return (ftell (mhlfp) >= Msgs[mhlnum].m_stop); } diff --git a/uip/picksbr.c b/uip/picksbr.c index 4afd094..85bc4bc 100644 --- a/uip/picksbr.c +++ b/uip/picksbr.c @@ -656,6 +656,8 @@ static int GREPaction (params) plist { + NMH_UNUSED (msgnum); + int c, body, lf; long pos = start; register char *p1, *p2, *ebp, *cbp; @@ -929,6 +931,8 @@ static int TWSaction (params) plist { + NMH_UNUSED (stop); + int state; register char *bp; char buf[BUFSIZ], name[NAMESZ]; diff --git a/uip/post.c b/uip/post.c index 515e1d5..2048228 100644 --- a/uip/post.c +++ b/uip/post.c @@ -1608,6 +1608,8 @@ do_text (char *file, int fd) static void sigser (int i) { + NMH_UNUSED (i); + unlink (tmpfil); if (msgflags & MINV) unlink (bccfil); diff --git a/uip/prompter.c b/uip/prompter.c index a016c1f..981e820 100644 --- a/uip/prompter.c +++ b/uip/prompter.c @@ -396,6 +396,8 @@ getln (char *buffer, int n) static void intrser (int i) { + NMH_UNUSED (i); + if (wtuser) longjmp (sigenv, NOTOK); sigint++; diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 5a3093b..74d19d5 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -207,6 +207,8 @@ main (int argc, char **argv) static void alrmser (int i) { + NMH_UNUSED (i); + longjmp (myctx, 1); } diff --git a/uip/replsbr.c b/uip/replsbr.c index 9ca0bb9..7f0f523 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -71,6 +71,8 @@ void replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, int mime, char *form, char *filter, char *fcc) { + NMH_UNUSED (msg); + register int state, i; register struct comp *cptr; register char *tmpbuf; diff --git a/uip/slocal.c b/uip/slocal.c index 36a25f0..f08f2ff 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -1210,6 +1210,8 @@ usr_pipe (int fd, char *cmd, char *pgm, char **vec, int suppress) static void alrmser (int i) { + NMH_UNUSED (i); + longjmp (myctx, DONE); }