INN commit: trunk (11 files)

INN Commit rra at isc.org
Sun Jan 7 13:38:58 UTC 2018


    Date: Sunday, January 7, 2018 @ 05:38:58
  Author: iulius
Revision: 10217

Silent format-nonliteral warnings for older GCC releases

It allows INN to build on GCC 4.x versions.

The presence of this warning is now not blocking
for next major release (see #140).

Modified:
  trunk/backends/batcher.c
  trunk/backends/buffchan.c
  trunk/backends/ninpaths.c
  trunk/frontends/rnews.c
  trunk/innd/site.c
  trunk/innfeed/imap_connection.c
  trunk/innfeed/misc.c
  trunk/lib/getmodaddr.c
  trunk/nnrpd/post.c
  trunk/support/getc-tap-harness
  trunk/tests/tap/basic.c

---------------------------+
 backends/batcher.c        |   16 ++++++++++++----
 backends/buffchan.c       |    8 ++++++--
 backends/ninpaths.c       |    8 ++++++--
 frontends/rnews.c         |   16 ++++++++++++----
 innd/site.c               |   18 +++++++++++++-----
 innfeed/imap_connection.c |   16 ++++++++++++----
 innfeed/misc.c            |    8 ++++++--
 lib/getmodaddr.c          |   16 ++++++++++++----
 nnrpd/post.c              |    8 ++++++--
 support/getc-tap-harness  |   16 ++++++++++++----
 tests/tap/basic.c         |   16 ++++++++++++----
 11 files changed, 109 insertions(+), 37 deletions(-)

Modified: backends/batcher.c
===================================================================
--- backends/batcher.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ backends/batcher.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -54,9 +54,13 @@
     char	buff[SMBUF];
 
     if (Processor && *Processor) {
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
 	snprintf(buff, sizeof(buff), Processor, Host);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
 	F = popen(buff, "w");
 	if (F == NULL)
 	    return NULL;
@@ -372,9 +376,13 @@
     SendIt:
 	/* Now we can start to send the article! */
 	if (Separator && *Separator) {
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
 	    snprintf(buff, sizeof(buff), Separator, BytesInArt);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
 	    BytesInCB += strlen(buff) + 1;
 	    BytesWritten += strlen(buff) + 1;
 	    if (fprintf(F, "%s\n", buff) == EOF || ferror(F)) {

Modified: backends/buffchan.c
===================================================================
--- backends/buffchan.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ backends/buffchan.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -177,9 +177,13 @@
 
     /* Fill in the structure for the new site. */
     sp->Name = xstrdup(Name);
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     snprintf(buff, sizeof(buff), Format, Map ? MAPname(Name) : sp->Name);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
     sp->Filename = xstrdup(buff);
     if (BufferMode == 'u')
 	sp->Buffer = NULL;

Modified: backends/ninpaths.c
===================================================================
--- backends/ninpaths.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ backends/ninpaths.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -199,9 +199,13 @@
 	writedump(stdout);
 	return;
     }
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     snprintf(buf, sizeof(buf), n, time(0));
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
     d=fopen(buf, "w");
     if (d) {
 	if (writedump(d)<0)

Modified: frontends/rnews.c
===================================================================
--- frontends/rnews.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ frontends/rnews.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -170,14 +170,22 @@
     int fd;
 #endif	/* defined(DO_RNEWS_SAVE_BAD) */
 
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     notice(reason, arg);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
     if (Verbose) {
 	fprintf(stderr, "%s: ", InputFile);
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
 	fprintf(stderr, reason, arg);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
 	fprintf(stderr, " [%.40s...]\n", article);
     }
 

Modified: innd/site.c
===================================================================
--- innd/site.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ innd/site.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -528,15 +528,23 @@
 	    xasprintf(&temp, "%s%.*s%s", sp->Param, (int) sp->FNLnames.left,
 		      sp->FNLnames.data, &p[1]);
 	    *p = '*';
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
 	    snprintf(buff, sizeof(buff), temp, Data->TokenText);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
 	    free(temp);
 	} else {
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
 	    snprintf(buff, sizeof(buff), sp->Param, Data->TokenText);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
-        }
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
+    }
 
 	if (NeedShell(buff, (const char **)argv, (const char **)ARRAY_END(argv))) {
 	    argv[0] = SITEshell;

Modified: innfeed/imap_connection.c
===================================================================
--- innfeed/imap_connection.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ innfeed/imap_connection.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -3650,9 +3650,13 @@
 
     c = newrcpt[newrcptlen];
     newrcpt[newrcptlen] = '\0';
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     rc = snprintf((*out) + size, newsize - size, deliver_rcpt_to, newrcpt);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
     if (rc < 0) {
         /* Do nothing. */
     } else if (rc >= newsize - size) {
@@ -3742,9 +3746,13 @@
 
     c = newrcpt[newrcptlen];
     newrcpt[newrcptlen] = '\0';
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     rc = snprintf((*out) + size, newsize - size, deliver_to_header,newrcpt);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
     if (rc < 0) {
         /* Do nothing. */
     } else if (rc >= newsize - size) {

Modified: innfeed/misc.c
===================================================================
--- innfeed/misc.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ innfeed/misc.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -593,10 +593,14 @@
 {
   static const char defaultFormat[] = "%a %b %d %H:%M:%S %Y" ;
   const struct tm *const tm = localtime(&t);
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
   strftime (buffer, size,
     timeToStringFormat == 0 ? defaultFormat : timeToStringFormat, tm);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
   return buffer;
 }
 

Modified: lib/getmodaddr.c
===================================================================
--- lib/getmodaddr.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ lib/getmodaddr.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -201,9 +201,13 @@
 		    if (*p == '.')
 			*p = '-';
                 if (IsValidSubmissionTemplate(save)) {
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
                     snprintf(address, sizeof(address), save, name);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
                     break;
                 }
 	    }
@@ -223,9 +227,13 @@
 	    *p = '-';
 
     if (IsValidSubmissionTemplate(save)) {
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
         snprintf(address, sizeof(address), save, name);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
     } else {
         return NULL;
     }

Modified: nnrpd/post.c
===================================================================
--- nnrpd/post.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ nnrpd/post.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -726,9 +726,13 @@
      * in case %s isn't in inconf->mta) and send the headers. */
     if (innconf->mta == NULL)
 	return "Can't start mailer -- mta not set";
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     snprintf(buff, sizeof(buff), innconf->mta, address);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
     if ((F = popen(buff, "w")) == NULL)
 	return "Can't start mailer";
     fprintf(F, "To: %s\n", address);

Modified: support/getc-tap-harness
===================================================================
--- support/getc-tap-harness	2018-01-04 15:37:29 UTC (rev 10216)
+++ support/getc-tap-harness	2018-01-07 13:38:58 UTC (rev 10217)
@@ -93,9 +93,13 @@
 void\\
 skip(int n UNUSED, const char *reason)\\
 {\\
-#pragma GCC diagnostic ignored \"-Wformat-nonliteral\"\\
+#if __GNUC__ > 4\\
+# pragma GCC diagnostic ignored \"-Wformat-nonliteral\"\\
+#endif\\
     new_skip(reason, NULL);\\
-#pragma GCC diagnostic warning \"-Wformat-nonliteral\"\\
+#if __GNUC__ > 4\\
+# pragma GCC diagnostic warning \"-Wformat-nonliteral\"\\
+#endif\\
 }\\
 \\
 void\\
@@ -107,9 +111,13 @@
 void\\
 skip_block(int n UNUSED, int count, const char *reason)\\
 {\\
-#pragma GCC diagnostic ignored \"-Wformat-nonliteral\"\\
+#if __GNUC__ > 4\\
+# pragma GCC diagnostic ignored \"-Wformat-nonliteral\"\\
+#endif\\
     new_skip_block(count, reason, NULL);\\
-#pragma GCC diagnostic warning \"-Wformat-nonliteral\"\\
+#if __GNUC__ > 4\\
+# pragma GCC diagnostic warning \"-Wformat-nonliteral\"\\
+#endif\\
 }\\
 \\
 void\\

Modified: tests/tap/basic.c
===================================================================
--- tests/tap/basic.c	2018-01-04 15:37:29 UTC (rev 10216)
+++ tests/tap/basic.c	2018-01-07 13:38:58 UTC (rev 10217)
@@ -72,9 +72,13 @@
 void
 skip(int n UNUSED, const char *reason)
 {
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     new_skip(reason, NULL);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
 }
 
 void
@@ -86,9 +90,13 @@
 void
 skip_block(int n UNUSED, int count, const char *reason)
 {
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic ignored "-Wformat-nonliteral"
+#endif
     new_skip_block(count, reason, NULL);
-#pragma GCC diagnostic warning "-Wformat-nonliteral"
+#if __GNUC__ > 4
+# pragma GCC diagnostic warning "-Wformat-nonliteral"
+#endif
 }
 
 void



More information about the inn-committers mailing list