INN commit: trunk (21 files)

INN Commit rra at isc.org
Fri Dec 29 05:05:15 UTC 2017


    Date: Thursday, December 28, 2017 @ 21:05:15
  Author: eagle
Revision: 10203

Enable -Wredundant-decls and clean up some issues

Some prototypes were duplicated across inn/ov.h and inn/overview.h.
Remove the redundancy and just include both headers for files that
need both sets of functions, which avoids one version drifting out
of sync.

No modern system is missing memcmp and Autoconf marks AC_FUNC_MEMCMP
as obsolete.  The macro doesn't set HAVE_MEMCMP, so we were always
prototyping memcmp in clibrary.h, which seems like a bad idea.  Just
remove this probe and our memcmp replacement, since it's highly
unlikely you'd find a system needing this outside of a museum.

Remove some duplicate declarations of generated functions in the
innfeed yacc and lex code.  This appears to compile without warnings
on GCC 7 anyway.  Hopefully it will work on older versions too.

Move the lexer to parser interface declaration into the parser
file from the header since otherwise we collide with the definition
generated by flex.

Delete a few duplicate prototypes or variable declarations elsewhere.

Modified:
  trunk/configure.ac
  trunk/expire/makehistory.c
  trunk/include/clibrary.h
  trunk/include/inn/ov.h
  trunk/innd/art.c
  trunk/innfeed/configfile.h
  trunk/innfeed/configfile.l
  trunk/innfeed/configfile.y
  trunk/innfeed/main.c
  trunk/lib/resource.c
  trunk/nnrpd/article.c
  trunk/nnrpd/list.c
  trunk/nnrpd/newnews.c
  trunk/nnrpd/nnrpd.c
  trunk/nnrpd/nnrpd.h
  trunk/storage/expire.c
  trunk/storage/overdata.c
  trunk/storage/ovinterface.h
  trunk/storage/tradindexed/tdx-data.c
  trunk/storage/tradindexed/tdx-util.c
Deleted:
  trunk/lib/memcmp.c

--------------------------------+
 configure.ac                   |    4 ---
 expire/makehistory.c           |    1 
 include/clibrary.h             |    3 --
 include/inn/ov.h               |   27 ------------------------
 innd/art.c                     |    1 
 innfeed/configfile.h           |    3 --
 innfeed/configfile.l           |    4 ---
 innfeed/configfile.y           |    4 ++-
 innfeed/main.c                 |    2 -
 lib/memcmp.c                   |   43 ---------------------------------------
 lib/resource.c                 |    2 -
 nnrpd/article.c                |    1 
 nnrpd/list.c                   |    1 
 nnrpd/newnews.c                |    1 
 nnrpd/nnrpd.c                  |    2 -
 nnrpd/nnrpd.h                  |    1 
 storage/expire.c               |    1 
 storage/overdata.c             |    1 
 storage/ovinterface.h          |    1 
 storage/tradindexed/tdx-data.c |    1 
 storage/tradindexed/tdx-util.c |    1 
 21 files changed, 14 insertions(+), 91 deletions(-)

Modified: configure.ac
===================================================================
--- configure.ac	2017-12-27 06:34:25 UTC (rev 10202)
+++ configure.ac	2017-12-29 05:05:15 UTC (rev 10203)
@@ -622,7 +622,6 @@
 
 dnl Checks for library functions.
 AC_FUNC_ALLOCA
-AC_FUNC_MEMCMP
 INN_FUNC_GETADDRINFO_ADDRCONFIG
 INN_FUNC_INET_NTOA
 INN_FUNC_SNPRINTF
@@ -702,7 +701,6 @@
 dnl   -Wmissing-noreturn    Not necessary (unless for optimization).
 dnl   -Wpacked              Used by INN.
 dnl   -Wpadded              Used by INN.
-dnl   -Wredundant-decls     Too much noise from system headers.
 dnl   -Wlong-long           Too much noise from system headers.
 dnl   -Woverlength-strings  Useless noise.
 dnl   -Wunused-function     Noise from embedded Perl (at least with Perl 5.20).
@@ -741,7 +739,7 @@
      -Wjump-misses-init -Wstrict-prototypes
      -Wold-style-definition
      -Wmissing-prototypes -Wmissing-declarations
-     -Wnormalized=nfc -Wrestrict -Wnested-externs -Winline
+     -Wnormalized=nfc -Wrestrict -Wredundant-decls -Wnested-externs -Winline
      -Winvalid-pch -Wvla -Wno-unknown-warning-option
      -Wno-unused-function],
     [INN_PROG_CC_FLAG(flag, [CC_WARNINGS="${CC_WARNINGS} flag"], [])])

Modified: expire/makehistory.c
===================================================================
--- expire/makehistory.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ expire/makehistory.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -18,6 +18,7 @@
 #include "inn/messages.h"
 #include "inn/newsuser.h"
 #include "inn/ov.h"
+#include "inn/overview.h"
 #include "inn/paths.h"
 #include "inn/qio.h"
 #include "inn/storage.h"

Modified: include/clibrary.h
===================================================================
--- include/clibrary.h	2017-12-27 06:34:25 UTC (rev 10202)
+++ include/clibrary.h	2017-12-29 05:05:15 UTC (rev 10203)
@@ -214,9 +214,6 @@
 #if !HAVE_STRTOK
 extern char * strtok(char *, const char *);
 #endif
-#if !HAVE_MEMCMP
-extern int memcmp(const void *, const void *, size_t);
-#endif
 
 END_DECLS
 

Modified: include/inn/ov.h
===================================================================
--- include/inn/ov.h	2017-12-27 06:34:25 UTC (rev 10202)
+++ include/inn/ov.h	2017-12-29 05:05:15 UTC (rev 10203)
@@ -51,33 +51,6 @@
 bool OVctl(OVCTLTYPE type, void *val);
 void OVclose(void);
 
-/* Overview data manipulation functions. */
-const struct cvector *overview_fields(void);
-struct vector *overview_extra_fields(bool hidden);
-struct buffer *overview_build(ARTNUM number, const char *article,
-                              size_t length, const struct vector *extra,
-                              struct buffer *);
-bool overview_check(const char *data, size_t length, ARTNUM article);
-int overview_index(const char *field, const struct vector *extra);
-struct cvector *overview_split(const char *line, size_t length,
-			       ARTNUM *number, struct cvector *vector);
-char *overview_get_standard_header(const struct cvector *vector, unsigned int element);
-char *overview_get_extra_header(const struct cvector *vector, const char *header);
-
-/* Offsets into vectors for standard overview headers. */
-#ifndef INN_OVERVIEW_H
-enum {
-    OVERVIEW_SUBJECT = 0,
-    OVERVIEW_FROM,
-    OVERVIEW_DATE,
-    OVERVIEW_MESSAGE_ID,
-    OVERVIEW_REFERENCES,
-    OVERVIEW_BYTES,
-    OVERVIEW_LINES,
-    OVERVIEW_MAX
-};
-#endif
-
 END_DECLS
 
 #endif /* INN_OV_H */

Modified: innd/art.c
===================================================================
--- innd/art.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ innd/art.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -11,6 +11,7 @@
 #include "inn/innconf.h"
 #include "inn/md5.h"
 #include "inn/ov.h"
+#include "inn/overview.h"
 #include "inn/storage.h"
 #include "inn/vector.h"
 #include "inn/wire.h"

Modified: innfeed/configfile.h
===================================================================
--- innfeed/configfile.h	2017-12-27 06:34:25 UTC (rev 10202)
+++ innfeed/configfile.h	2017-12-29 05:05:15 UTC (rev 10203)
@@ -85,7 +85,4 @@
 #define INHERIT 1
 #define NO_INHERIT 0
 
-/* Interface between lexer and parser. */
-int yylex (void) ; 
-
 #endif /* configfile_h__ */

Modified: innfeed/configfile.l
===================================================================
--- innfeed/configfile.l	2017-12-27 06:34:25 UTC (rev 10202)
+++ innfeed/configfile.l	2017-12-29 05:05:15 UTC (rev 10203)
@@ -34,10 +34,6 @@
 #define YY_USER_INIT yy_flex_debug = (getenv ("YYDEBUG") == NULL ? 0 : 1)
 #endif
 
-/* We never use this function but flex always defines it, so silence the
-   warnings about it. */
-static void yyunput(int, char *) UNUSED;
-
 char *strPtr = 0 ;
 int strPtrLen = 0 ;
 int strIdx = 0 ;

Modified: innfeed/configfile.y
===================================================================
--- innfeed/configfile.y	2017-12-27 06:34:25 UTC (rev 10202)
+++ innfeed/configfile.y	2017-12-29 05:05:15 UTC (rev 10203)
@@ -47,9 +47,11 @@
 static int strNCaseCmp (const char *a, const char *b, size_t len) ;
 #endif 
 
+/* Interface between lexer and parser. */
+int yylex (void) ; 
+
 int yyerror (const char *s) ;
 int yywrap (void) ;
-int yyparse (void) ;
 
 
 #if 0

Modified: innfeed/main.c
===================================================================
--- innfeed/main.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ innfeed/main.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -79,8 +79,6 @@
 extern bool fastExit;
 extern unsigned int stdioFdMax;
 
-extern void openInputFile (void);
-
 /* privates */
 static char *logFile ;
 static char *newsspool ;

Deleted: lib/memcmp.c
===================================================================
--- lib/memcmp.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ lib/memcmp.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -1,43 +0,0 @@
-/*  $Id$
-**
-**  Replacement for a missing or broken memcmp.
-**
-**  Written by Russ Allbery <eagle at eyrie.org>
-**  This work is hereby placed in the public domain by its author.
-**
-**  Provides the same functionality as the standard library routine memcmp
-**  for those platforms that don't have it or where it doesn't work right
-**  (such as on SunOS where it can't deal with eight-bit characters).
-*/
-
-#include "config.h"
-#include "clibrary.h"
-
-/* If we're running the test suite, rename memcmp to avoid conflicts with
-   the system version. */
-#if TESTING
-# undef memcmp
-# define memcmp test_memcmp
-int test_memcmp(const void *, const void *, size_t);
-#endif
-
-int
-memcmp(const void *s1, const void *s2, size_t n)
-{
-    size_t i;
-    const unsigned char *p1, *p2;
-
-    /* It's technically illegal to call memcmp with NULL pointers, but we
-       may as well check anyway. */
-    if (!s1)
-        return !s2 ? 0 : -1;
-    if (!s2)
-        return 1;
-
-    p1 = (const unsigned char *) s1;
-    p2 = (const unsigned char *) s2;
-    for (i = 0; i < n; i++, p1++, p2++)
-        if (*p1 != *p2)
-	    return (int) *p1 - (int) *p2;
-    return 0;
-}

Modified: lib/resource.c
===================================================================
--- lib/resource.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ lib/resource.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -17,8 +17,6 @@
 #define TIMEVALasDOUBLE(t)	\
     ((double)(t).tv_sec + ((double)(t).tv_usec) / 1000000.0)
 
-int getrusage(int who, struct rusage *rusage);
-
 int GetResourceUsage(double *usertime, double *systime)
 {
     struct rusage	R;

Modified: nnrpd/article.c
===================================================================
--- nnrpd/article.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ nnrpd/article.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -17,6 +17,7 @@
 #include "inn/wire.h"
 #include "nnrpd.h"
 #include "inn/ov.h"
+#include "inn/overview.h"
 #include "tls.h"
 #include "cache.h"
 

Modified: nnrpd/list.c
===================================================================
--- nnrpd/list.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ nnrpd/list.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -8,6 +8,7 @@
 
 #include "nnrpd.h"
 #include "inn/ov.h"
+#include "inn/overview.h"
 #include "inn/innconf.h"
 #include "inn/messages.h"
 

Modified: nnrpd/newnews.c
===================================================================
--- nnrpd/newnews.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ nnrpd/newnews.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -10,6 +10,7 @@
 #include "inn/wire.h"
 #include "nnrpd.h"
 #include "inn/ov.h"
+#include "inn/overview.h"
 #include "cache.h"
 
 #define GROUP_LIST_DELTA	10

Modified: nnrpd/nnrpd.c
===================================================================
--- nnrpd/nnrpd.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ nnrpd/nnrpd.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -29,6 +29,7 @@
 #include "inn/network-innbind.h"
 #include "inn/newsuser.h"
 #include "inn/ov.h"
+#include "inn/overview.h"
 #include "inn/version.h"
 #define MAINLINE
 #include "nnrpd.h"
@@ -91,7 +92,6 @@
 static char 	*LocalLogFileName = NULL;
 static char 	*LocalLogDirName;
 
-struct history *History;
 static double	STATstart;
 static double	STATfinish;
 static char	*PushedBack;

Modified: nnrpd/nnrpd.h
===================================================================
--- nnrpd/nnrpd.h	2017-12-27 06:34:25 UTC (rev 10202)
+++ nnrpd/nnrpd.h	2017-12-29 05:05:15 UTC (rev 10203)
@@ -230,7 +230,6 @@
 extern void		InitBackoffConstants(void);
 extern char		*PostRecFilename(char *ip, char *user);
 extern int		LockPostRec(char *path);
-extern int		LockPostRec(char *path);
 extern void		UnlockPostRec(char *path);
 extern int		RateLimit(long *sleeptime, char *path);
 extern void		ExitWithStats(int x, bool readconf)

Modified: storage/expire.c
===================================================================
--- storage/expire.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ storage/expire.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -16,6 +16,7 @@
 #include "inn/innconf.h"
 #include "inn/libinn.h"
 #include "inn/ov.h"
+#include "inn/overview.h"
 #include "ovinterface.h"
 #include "inn/paths.h"
 #include "inn/storage.h"

Modified: storage/overdata.c
===================================================================
--- storage/overdata.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ storage/overdata.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -13,6 +13,7 @@
 #include "inn/buffer.h"
 #include "inn/innconf.h"
 #include "inn/messages.h"
+#include "inn/overview.h"
 #include "inn/wire.h"
 #include "inn/vector.h"
 #include "inn/libinn.h"

Modified: storage/ovinterface.h
===================================================================
--- storage/ovinterface.h	2017-12-27 06:34:25 UTC (rev 10202)
+++ storage/ovinterface.h	2017-12-29 05:05:15 UTC (rev 10203)
@@ -41,7 +41,6 @@
 void OVEXPremove(TOKEN token, bool deletedgroups, char **xref, int ngroups);
 void OVEXPcleanup(void);
 
-extern bool OVstatall;
 extern time_t OVnow;
 extern char *ACTIVE;
 extern FILE *EXPunlinkfile;

Modified: storage/tradindexed/tdx-data.c
===================================================================
--- storage/tradindexed/tdx-data.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ storage/tradindexed/tdx-data.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -29,6 +29,7 @@
 #include "inn/mmap.h"
 #include "inn/libinn.h"
 #include "inn/ov.h"
+#include "inn/overview.h"
 #include "ovinterface.h"
 #include "inn/storage.h"
 #include "tdx-private.h"

Modified: storage/tradindexed/tdx-util.c
===================================================================
--- storage/tradindexed/tdx-util.c	2017-12-27 06:34:25 UTC (rev 10202)
+++ storage/tradindexed/tdx-util.c	2017-12-29 05:05:15 UTC (rev 10203)
@@ -21,6 +21,7 @@
 #include "inn/messages.h"
 #include "inn/newsuser.h"
 #include "inn/ov.h"
+#include "inn/overview.h"
 #include "inn/paths.h"
 #include "inn/vector.h"
 #include "inn/wire.h"



More information about the inn-committers mailing list