Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Oct 2012 10:33:16 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241777 - in head: bin/dd libexec/rpc.rusersd libexec/talkd usr.bin/cksum usr.bin/m4 usr.sbin/mtree usr.sbin/newsyslog usr.sbin/services_mkdb
Message-ID:  <201210201033.q9KAXGRm007583@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Sat Oct 20 10:33:15 2012
New Revision: 241777
URL: http://svn.freebsd.org/changeset/base/241777

Log:
  More -Wmissing-variable-declarations fixes.
  
  In addition to adding missing `static' keywords:
  - bin/dd: Pull in `extern.h' to guarantee consistency with source file.
  - libexec/rpc.rusersd: Move shared globals into an extern.h.
  - libexec/talkd: Move `debug' and `hostname' into extern.h.
  - usr.bin/cksum: Put counters in extern.h, as they are used by ckdist/mtree.
  - usr.bin/m4: Move `end_result' into extern.h.
  - usr.sbin/services_mkdb: Move shared globals into an extern.h.

Added:
  head/libexec/rpc.rusersd/extern.h   (contents, props changed)
  head/usr.sbin/services_mkdb/extern.h   (contents, props changed)
Modified:
  head/bin/dd/conv_tab.c
  head/libexec/rpc.rusersd/Makefile
  head/libexec/rpc.rusersd/rusers_proc.c
  head/libexec/rpc.rusersd/rusersd.c
  head/libexec/talkd/announce.c
  head/libexec/talkd/extern.h
  head/libexec/talkd/process.c
  head/libexec/talkd/table.c
  head/libexec/talkd/talkd.c
  head/usr.bin/cksum/extern.h
  head/usr.bin/m4/expr.c
  head/usr.bin/m4/extern.h
  head/usr.bin/m4/gnum4.c
  head/usr.bin/m4/main.c
  head/usr.bin/m4/parser.y
  head/usr.sbin/mtree/mtree.c
  head/usr.sbin/newsyslog/newsyslog.c
  head/usr.sbin/services_mkdb/Makefile
  head/usr.sbin/services_mkdb/services_mkdb.c
  head/usr.sbin/services_mkdb/uniq.c

Modified: head/bin/dd/conv_tab.c
==============================================================================
--- head/bin/dd/conv_tab.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/bin/dd/conv_tab.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -41,6 +41,11 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 
+#include <stdint.h>
+
+#include "dd.h"
+#include "extern.h"
+
 /*
  * There are currently six tables:
  *

Modified: head/libexec/rpc.rusersd/Makefile
==============================================================================
--- head/libexec/rpc.rusersd/Makefile	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/libexec/rpc.rusersd/Makefile	Sat Oct 20 10:33:15 2012	(r241777)
@@ -1,7 +1,7 @@
 # $FreeBSD$
 
 PROG =	rpc.rusersd
-SRCS =	rusersd.c rusers_proc.c
+SRCS =	rusersd.c rusers_proc.c extern.h
 MAN =	rpc.rusersd.8
 
 DPADD=	${LIBRPCSVC} ${LIBUTIL}

Added: head/libexec/rpc.rusersd/extern.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/libexec/rpc.rusersd/extern.h	Sat Oct 20 10:33:15 2012	(r241777)
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 1993, John Brezak
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+extern int from_inetd;
+
+void rusers_service(struct svc_req *, SVCXPRT *);

Modified: head/libexec/rpc.rusersd/rusers_proc.c
==============================================================================
--- head/libexec/rpc.rusersd/rusers_proc.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/libexec/rpc.rusersd/rusers_proc.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -53,6 +53,8 @@ static const char rcsid[] =
 #endif
 #include <rpcsvc/rnusers.h>
 
+#include "extern.h"
+
 #ifndef _PATH_DEV
 #define _PATH_DEV "/dev"
 #endif
@@ -61,10 +63,6 @@ static utmpidle utmp_idle[MAXUSERS];
 static utmp old_utmp[MAXUSERS];
 static struct utmpx utmp_list[MAXUSERS];
 
-extern int from_inetd;
-
-void rusers_service(struct svc_req *, SVCXPRT *);
-
 #ifdef XIDLE
 static Display *dpy;
 

Modified: head/libexec/rpc.rusersd/rusersd.c
==============================================================================
--- head/libexec/rpc.rusersd/rusersd.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/libexec/rpc.rusersd/rusersd.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -43,7 +43,7 @@ static const char rcsid[] =
 #include <syslog.h>
 #include <rpcsvc/rnusers.h>
 
-extern void rusers_service(struct svc_req *, SVCXPRT *);
+#include "extern.h"
 
 int from_inetd = 1;
 

Modified: head/libexec/talkd/announce.c
==============================================================================
--- head/libexec/talkd/announce.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/libexec/talkd/announce.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -60,8 +60,6 @@ static const char rcsid[] =
 #include "ttymsg.h"
 #include "extern.h"
 
-extern char hostname[];
-
 /*
  * Announce an invitation to talk.
  */

Modified: head/libexec/talkd/extern.h
==============================================================================
--- head/libexec/talkd/extern.h	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/libexec/talkd/extern.h	Sat Oct 20 10:33:15 2012	(r241777)
@@ -25,6 +25,9 @@
  * $FreeBSD$
  */
 
+extern int debug;
+extern char hostname[];
+
 int	announce(CTL_MSG *, const char *);
 int	delete_invite(u_int32_t);
 void	do_announce(CTL_MSG *, CTL_RESPONSE *);

Modified: head/libexec/talkd/process.c
==============================================================================
--- head/libexec/talkd/process.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/libexec/talkd/process.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -63,8 +63,6 @@ static const char rcsid[] =
 
 #include "extern.h"
 
-extern int debug;
-
 void
 process_request(CTL_MSG *mp, CTL_RESPONSE *rp)
 {

Modified: head/libexec/talkd/table.c
==============================================================================
--- head/libexec/talkd/table.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/libexec/talkd/table.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -64,8 +64,7 @@ static const char rcsid[] =
 
 #define NIL ((TABLE_ENTRY *)0)
 
-extern	int debug;
-struct	timeval tp;
+static struct timeval tp;
 
 typedef struct table_entry TABLE_ENTRY;
 
@@ -78,7 +77,7 @@ struct table_entry {
 
 static void delete(TABLE_ENTRY *);
 
-TABLE_ENTRY *table = NIL;
+static TABLE_ENTRY *table = NIL;
 
 /*
  * Look in the table for an invitation that matches the current

Modified: head/libexec/talkd/talkd.c
==============================================================================
--- head/libexec/talkd/talkd.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/libexec/talkd/talkd.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -69,13 +69,13 @@ static const char rcsid[] =
 
 #include "extern.h"
 
-CTL_MSG		request;
-CTL_RESPONSE	response;
+static CTL_MSG		request;
+static CTL_RESPONSE	response;
 
-int	debug = 0;
-long	lastmsgtime;
+int			debug = 0;
+static long		lastmsgtime;
 
-char	hostname[MAXHOSTNAMELEN];
+char			hostname[MAXHOSTNAMELEN];
 
 #define TIMEOUT 30
 #define MAXIDLE 120

Modified: head/usr.bin/cksum/extern.h
==============================================================================
--- head/usr.bin/cksum/extern.h	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.bin/cksum/extern.h	Sat Oct 20 10:33:15 2012	(r241777)
@@ -32,6 +32,9 @@
 
 #include <sys/cdefs.h>
 
+extern uint32_t crc_total;
+extern uint32_t crc32_total;
+
 __BEGIN_DECLS
 int	crc(int, uint32_t *, off_t *);
 void	pcrc(char *, uint32_t, off_t);

Modified: head/usr.bin/m4/expr.c
==============================================================================
--- head/usr.bin/m4/expr.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.bin/m4/expr.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -24,7 +24,7 @@ __FBSDID("$FreeBSD$");
 #include "extern.h"
 
 int32_t end_result;
-const char *copy_toeval;
+static const char *copy_toeval;
 int yyerror(const char *msg);
 
 extern void yy_scan_string(const char *);

Modified: head/usr.bin/m4/extern.h
==============================================================================
--- head/usr.bin/m4/extern.h	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.bin/m4/extern.h	Sat Oct 20 10:33:15 2012	(r241777)
@@ -43,6 +43,7 @@ extern unsigned long expansion_id;
 
 /* expr.c */
 extern int	expr(const char *);
+extern int32_t end_result;
 
 /* gnum4.c */
 extern void	addtoincludepath(const char *);

Modified: head/usr.bin/m4/gnum4.c
==============================================================================
--- head/usr.bin/m4/gnum4.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.bin/m4/gnum4.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -59,7 +59,7 @@ int mimic_gnu = 0;
  * Then M4PATH env variable
  */
 
-struct path_entry {
+static struct path_entry {
 	char *name;
 	struct path_entry *next;
 } *first, *last;

Modified: head/usr.bin/m4/main.c
==============================================================================
--- head/usr.bin/m4/main.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.bin/m4/main.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -85,7 +85,7 @@ struct keyblk {
         int     ktyp;           /* keyword type */
 };
 
-struct keyblk keywrds[] = {	/* m4 keywords to be installed */
+static struct keyblk keywrds[] = {	/* m4 keywords to be installed */
 	{ "include",      INCLTYPE },
 	{ "sinclude",     SINCTYPE },
 	{ "define",       DEFITYPE },

Modified: head/usr.bin/m4/parser.y
==============================================================================
--- head/usr.bin/m4/parser.y	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.bin/m4/parser.y	Sat Oct 20 10:33:15 2012	(r241777)
@@ -17,10 +17,17 @@
  *
  * $FreeBSD$
  */
+
 #include <math.h>
+#include <stddef.h>
+#include <stdio.h>
 #include <stdint.h>
+
+#include "mdef.h"
+#include "extern.h"
+
 #define YYSTYPE	int32_t
-extern int32_t end_result;
+
 extern int yylex(void);
 extern int yyerror(const char *);
 %}

Modified: head/usr.sbin/mtree/mtree.c
==============================================================================
--- head/usr.sbin/mtree/mtree.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.sbin/mtree/mtree.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -52,7 +52,8 @@ __FBSDID("$FreeBSD$");
 #include "extern.h"
 
 int ftsoptions = FTS_PHYSICAL;
-int cflag, dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, Uflag, wflag;
+int dflag, eflag, iflag, nflag, qflag, rflag, sflag, uflag, wflag;
+static int cflag, Uflag;
 u_int keys;
 char fullpath[MAXPATHLEN];
 

Modified: head/usr.sbin/newsyslog/newsyslog.c
==============================================================================
--- head/usr.sbin/newsyslog/newsyslog.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.sbin/newsyslog/newsyslog.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -145,7 +145,7 @@ struct compress_types {
 	const char *path;	/* Path to compression program */
 };
 
-const struct compress_types compress_type[COMPRESS_TYPES] = {
+static const struct compress_types compress_type[COMPRESS_TYPES] = {
 	{ "", "", "" },					/* no compression */
 	{ "Z", COMPRESS_SUFFIX_GZ, _PATH_GZIP },	/* gzip compression */
 	{ "J", COMPRESS_SUFFIX_BZ2, _PATH_BZIP2 },	/* bzip2 compression */
@@ -206,42 +206,44 @@ typedef enum {
 }	fk_entry;
 
 STAILQ_HEAD(cflist, conf_entry);
-SLIST_HEAD(swlisthead, sigwork_entry) swhead = SLIST_HEAD_INITIALIZER(swhead);
-SLIST_HEAD(zwlisthead, zipwork_entry) zwhead = SLIST_HEAD_INITIALIZER(zwhead);
+static SLIST_HEAD(swlisthead, sigwork_entry) swhead =
+    SLIST_HEAD_INITIALIZER(swhead);
+static SLIST_HEAD(zwlisthead, zipwork_entry) zwhead =
+    SLIST_HEAD_INITIALIZER(zwhead);
 STAILQ_HEAD(ilist, include_entry);
 
 int dbg_at_times;		/* -D Show details of 'trim_at' code */
 
-int archtodir = 0;		/* Archive old logfiles to other directory */
-int createlogs;			/* Create (non-GLOB) logfiles which do not */
+static int archtodir = 0;	/* Archive old logfiles to other directory */
+static int createlogs;		/* Create (non-GLOB) logfiles which do not */
 				/*    already exist.  1=='for entries with */
 				/*    C flag', 2=='for all entries'. */
 int verbose = 0;		/* Print out what's going on */
-int needroot = 1;		/* Root privs are necessary */
+static int needroot = 1;	/* Root privs are necessary */
 int noaction = 0;		/* Don't do anything, just show it */
-int norotate = 0;		/* Don't rotate */
-int nosignal;			/* Do not send any signals */
-int enforcepid = 0;		/* If PID file does not exist or empty, do nothing */
-int force = 0;			/* Force the trim no matter what */
-int rotatereq = 0;		/* -R = Always rotate the file(s) as given */
+static int norotate = 0;	/* Don't rotate */
+static int nosignal;		/* Do not send any signals */
+static int enforcepid = 0;	/* If PID file does not exist or empty, do nothing */
+static int force = 0;		/* Force the trim no matter what */
+static int rotatereq = 0;	/* -R = Always rotate the file(s) as given */
 				/*    on the command (this also requires   */
 				/*    that a list of files *are* given on  */
 				/*    the run command). */
-char *requestor;		/* The name given on a -R request */
-char *timefnamefmt = NULL;	/* Use time based filenames instead of .0 etc */
-char *archdirname;		/* Directory path to old logfiles archive */
-char *destdir = NULL;		/* Directory to treat at root for logs */
-const char *conf;		/* Configuration file to use */
+static char *requestor;		/* The name given on a -R request */
+static char *timefnamefmt = NULL;/* Use time based filenames instead of .0 */
+static char *archdirname;	/* Directory path to old logfiles archive */
+static char *destdir = NULL;	/* Directory to treat at root for logs */
+static const char *conf;	/* Configuration file to use */
 
 struct ptime_data *dbg_timenow;	/* A "timenow" value set via -D option */
-struct ptime_data *timenow;	/* The time to use for checking at-fields */
+static struct ptime_data *timenow; /* The time to use for checking at-fields */
 
 #define	DAYTIME_LEN	16
-char daytime[DAYTIME_LEN];	/* The current time in human readable form,
-				 * used for rotation-tracking messages. */
-char hostname[MAXHOSTNAMELEN];	/* hostname */
+static char daytime[DAYTIME_LEN];/* The current time in human readable form,
+				  * used for rotation-tracking messages. */
+static char hostname[MAXHOSTNAMELEN]; /* hostname */
 
-const char *path_syslogpid = _PATH_SYSLOGPID;
+static const char *path_syslogpid = _PATH_SYSLOGPID;
 
 static struct cflist *get_worklist(char **files);
 static void parse_file(FILE *cf, struct cflist *work_p, struct cflist *glob_p,

Modified: head/usr.sbin/services_mkdb/Makefile
==============================================================================
--- head/usr.sbin/services_mkdb/Makefile	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.sbin/services_mkdb/Makefile	Sat Oct 20 10:33:15 2012	(r241777)
@@ -2,7 +2,7 @@
 
 PROG=	services_mkdb
 MAN=	services_mkdb.8
-SRCS=	services_mkdb.c uniq.c
+SRCS=	services_mkdb.c uniq.c extern.h
 
 DPADD+=	${LIBUTIL}
 LDADD+=	-lutil

Added: head/usr.sbin/services_mkdb/extern.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/usr.sbin/services_mkdb/extern.h	Sat Oct 20 10:33:15 2012	(r241777)
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+extern const HASHINFO hinfo;

Modified: head/usr.sbin/services_mkdb/services_mkdb.c
==============================================================================
--- head/usr.sbin/services_mkdb/services_mkdb.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.sbin/services_mkdb/services_mkdb.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$");
 #include <errno.h>
 #include <stringlist.h>
 
+#include "extern.h"
+
 static char tname[MAXPATHLEN];
 
 #define	PMASK		0xffff

Modified: head/usr.sbin/services_mkdb/uniq.c
==============================================================================
--- head/usr.sbin/services_mkdb/uniq.c	Sat Oct 20 10:20:06 2012	(r241776)
+++ head/usr.sbin/services_mkdb/uniq.c	Sat Oct 20 10:33:15 2012	(r241777)
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
 #include <ctype.h>
 #include <fcntl.h>
 
-extern const HASHINFO hinfo;
+#include "extern.h"
 
 void uniq(const char *);
 static int comp(const char *, char **, size_t *);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210201033.q9KAXGRm007583>