summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2002-01-16 01:28:54 +0000
committermillert <millert@openbsd.org>2002-01-16 01:28:54 +0000
commitfc8048171e0691ce3520db453b5ebfdb4f1dc5e6 (patch)
treecd2b081daa4ea66115d5b3e0c3567d99f8144953
parentJust tested a Eumitcom WL11000P in the guise of a Belkin F5D6000. (diff)
downloadwireguard-openbsd-fc8048171e0691ce3520db453b5ebfdb4f1dc5e6.tar.xz
wireguard-openbsd-fc8048171e0691ce3520db453b5ebfdb4f1dc5e6.zip
Use the volatile specifier to fix warnings about variables being
clobbered by longjmp / vfork instead of the gcc "(void)&foo;" hack.
-rw-r--r--bin/ed/main.c13
-rw-r--r--bin/ksh/exec.c8
-rw-r--r--bin/ksh/lex.c8
-rw-r--r--games/phantasia/fight.c12
-rw-r--r--games/phantasia/io.c11
-rw-r--r--lib/libc/gen/popen.c8
-rw-r--r--lib/libutil/passwd.c10
-rw-r--r--usr.bin/make/compat.c12
8 files changed, 26 insertions, 56 deletions
diff --git a/bin/ed/main.c b/bin/ed/main.c
index da57782a7b0..b8efb8aaf5e 100644
--- a/bin/ed/main.c
+++ b/bin/ed/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.24 2001/11/17 19:54:56 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.25 2002/01/16 01:28:54 millert Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
@@ -39,7 +39,7 @@ char *copyright =
#if 0
static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.24 2001/11/17 19:54:56 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.25 2002/01/16 01:28:54 millert Exp $";
#endif
#endif /* not lint */
@@ -118,17 +118,12 @@ seterrmsg(char *s)
/* ed: line editor */
int
main(argc, argv)
- int argc;
- char **argv;
+ volatile int argc;
+ char ** volatile argv;
{
int c, n;
long status = 0;
-#ifdef __GNUC__
- (void)&argc;
- (void)&argv;
-#endif
-
home = getenv("HOME");
red = (n = strlen(argv[0])) > 2 && argv[0][n - 3] == 'r';
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c
index 137b0ba8502..270857662f8 100644
--- a/bin/ksh/exec.c
+++ b/bin/ksh/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.24 2001/07/19 16:46:27 millert Exp $ */
+/* $OpenBSD: exec.c,v 1.25 2002/01/16 01:28:54 millert Exp $ */
/*
* execute command tree
@@ -450,7 +450,7 @@ comexec(t, tp, ap, flags)
int volatile flags;
{
int i;
- int rv = 0;
+ volatile int rv = 0;
register char *cp;
register char **lastp;
static struct op texec; /* Must be static (XXX but why?) */
@@ -458,10 +458,6 @@ comexec(t, tp, ap, flags)
int keepasn_ok;
int fcflags = FC_BI|FC_FUNC|FC_PATH;
-#ifdef __GNUC__
- (void)&rv;
-#endif
-
#ifdef KSH
/* snag the last argument for $_ XXX not the same as at&t ksh,
* which only seems to set $_ after a newline (but not in
diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c
index ecba1a46910..d28c5aaec33 100644
--- a/bin/ksh/lex.c
+++ b/bin/ksh/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.14 1999/06/15 01:18:34 millert Exp $ */
+/* $OpenBSD: lex.c,v 1.15 2002/01/16 01:28:54 millert Exp $ */
/*
* lexical analysis and source input
@@ -1124,11 +1124,9 @@ set_prompt(to, s)
*/
{
struct shf *shf;
- char *ps1;
+ char * volatile ps1;
Area *saved_atemp;
-#ifdef __GNUC__
- (void)&ps1;
-#endif
+
ps1 = str_val(global("PS1"));
shf = shf_sopen((char *) 0, strlen(ps1) * 2,
SHF_WR | SHF_DYNAMIC, (struct shf *) 0);
diff --git a/games/phantasia/fight.c b/games/phantasia/fight.c
index f4dfd46def6..bac020cf490 100644
--- a/games/phantasia/fight.c
+++ b/games/phantasia/fight.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fight.c,v 1.6 2002/01/04 16:16:32 art Exp $ */
+/* $OpenBSD: fight.c,v 1.7 2002/01/16 01:28:54 millert Exp $ */
/* $NetBSD: fight.c,v 1.2 1995/03/24 03:58:39 cgd Exp $ */
/*
@@ -41,18 +41,14 @@ void
encounter(particular)
int particular;
{
- bool firsthit = Player.p_blessing; /* set if player gets the
- * first hit */
- int flockcnt = 1; /* how many time flocked */
+ int flockcnt = 1; /* how many time flocked */
+ volatile bool firsthit = Player.p_blessing; /* set if player gets
+ * the first hit */
/* let others know what we are doing */
Player.p_status = S_MONSTER;
writerecord(&Player, Fileloc);
-#if __GNUC__
- (void)&firsthit; /* XXX shut up gcc */
-#endif
-
#ifdef SYS5
flushinp();
#endif
diff --git a/games/phantasia/io.c b/games/phantasia/io.c
index 47ca6909d1f..5d0cbce9da1 100644
--- a/games/phantasia/io.c
+++ b/games/phantasia/io.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: io.c,v 1.4 1998/11/29 19:56:57 pjanzen Exp $ */
+/* $OpenBSD: io.c,v 1.5 2002/01/16 01:28:54 millert Exp $ */
/* $NetBSD: io.c,v 1.2 1995/03/24 03:58:50 cgd Exp $ */
/*
@@ -325,16 +325,13 @@ getanswer(choices, def)
char *choices;
bool def;
{
- int ch; /* input */
- int loop; /* counter */
- int oldx, oldy; /* original coordinates on screen */
+ int ch; /* input */
+ volatile int loop; /* counter */
+ volatile int oldx, oldy; /* original coordinates on screen */
getyx(stdscr, oldy, oldx);
alarm(0); /* make sure alarm is off */
-#if __GNUC__
- (void)&loop; /* XXX quiet gcc */
-#endif
for (loop = 3; loop; --loop)
for (loop = 3; loop; --loop)
/* try for 3 times */
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index aa21ca3e957..f26612133bb 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: popen.c,v 1.11 2002/01/02 20:18:31 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: popen.c,v 1.12 2002/01/16 01:28:54 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -60,15 +60,11 @@ popen(program, type)
const char *program;
const char *type;
{
- struct pid *cur;
+ struct pid * volatile cur;
FILE *iop;
int pdes[2];
pid_t pid;
-#ifdef __GNUC__
- (void)&cur;
-#endif
-
if ((*type != 'r' && *type != 'w') || type[1] != '\0') {
errno = EINVAL;
return (NULL);
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c
index 461ed94fb6f..698407f4873 100644
--- a/lib/libutil/passwd.c
+++ b/lib/libutil/passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: passwd.c,v 1.29 2001/11/14 19:50:23 deraadt Exp $ */
+/* $OpenBSD: passwd.c,v 1.30 2002/01/16 01:28:54 millert Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: passwd.c,v 1.29 2001/11/14 19:50:23 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: passwd.c,v 1.30 2002/01/16 01:28:54 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -379,12 +379,10 @@ pw_edit(notsetuid, filename)
const char *filename;
{
int pstat;
- char *p, *editor;
+ char *p;
+ char * volatile editor;
char *argp[] = {"sh", "-c", NULL, NULL};
-#ifdef __GNUC__
- (void)&editor;
-#endif
if (!filename) {
filename = pw_lck;
if (!filename)
diff --git a/usr.bin/make/compat.c b/usr.bin/make/compat.c
index a2f91b47359..8edf215e7c7 100644
--- a/usr.bin/make/compat.c
+++ b/usr.bin/make/compat.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: compat.c,v 1.45 2001/12/02 00:13:16 espie Exp $ */
+/* $OpenBSD: compat.c,v 1.46 2002/01/16 01:28:54 millert Exp $ */
/* $NetBSD: compat.c,v 1.14 1996/11/06 17:59:01 christos Exp $ */
/*
@@ -167,14 +167,14 @@ CompatRunCommand(cmdp, gnp)
char *cmdStart; /* Start of expanded command */
char *cp, *bp = NULL;
bool silent, /* Don't print command */
- errCheck, /* Check errors */
doExecute; /* Execute the command */
+ volatile bool errCheck; /* Check errors */
int reason; /* Reason for child's death */
int status; /* Description of child's death */
int cpid; /* Child actually found */
int stat; /* Status of fork */
LstNode cmdNode; /* Node where current command is located */
- char **av; /* Argument vector for thing to exec */
+ char ** volatile av; /* Argument vector for thing to exec */
int argc; /* Number of arguments in av or 0 if not
* dynamically allocated */
bool local; /* true if command should be executed
@@ -183,12 +183,6 @@ CompatRunCommand(cmdp, gnp)
GNode *gn = (GNode *)gnp;
static char *shargv[4] = { _PATH_BSHELL };
- /* Avoid clobbered variable warnings by forcing the compiler
- * to ``unregister'' variables. */
-#if __GNUC__
- (void)&av;
- (void)&errCheck;
-#endif
silent = gn->type & OP_SILENT;
errCheck = !(gn->type & OP_IGNORE);
doExecute = !noExecute;