diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-01-16 01:28:55 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-01-16 01:28:55 +0000 |
commit | 496e01e18f4d501ab034f7e71a4cb06167ff88c7 (patch) | |
tree | 3b457e6ee395b8d25e40dc6501edb7b037c62ff1 /bin | |
parent | 51f4383f61889d34ee59c9078b745fc1afd1e51d (diff) |
Use the volatile specifier to fix warnings about variables being
clobbered by longjmp / vfork instead of the gcc "(void)&foo;" hack.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/ed/main.c | 13 | ||||
-rw-r--r-- | bin/ksh/exec.c | 8 | ||||
-rw-r--r-- | bin/ksh/lex.c | 8 |
3 files changed, 9 insertions, 20 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); |