• we had an unused variable leftover

• make warning-free for both gcc and xlC
This commit is contained in:
tg 2007-07-22 14:01:50 +00:00
parent 748d09122a
commit b09b3621e2
8 changed files with 28 additions and 17 deletions

4
exec.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.35 2007/07/22 13:38:26 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.36 2007/07/22 14:01:48 tg Exp $");
static int comexec(struct op *, struct tbl *volatile, const char **,
int volatile);
@ -95,7 +95,7 @@ execute(struct op *volatile t,
*/
if (tp && tp->type == CSHELL &&
(tp->flag & SPEC_BI))
errorf("");
errorfz();
/* Deal with FERREXIT, quitenv(), etc. */
goto Break;
}

4
expr.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.11 2007/07/22 13:34:49 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.12 2007/07/22 14:01:48 tg Exp $");
/* The order of these enums is constrained by the order of opinfo[] */
enum token {
@ -178,7 +178,7 @@ v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok,
if (i == LAEXPR) {
if (error_ok == KSH_RETURN_ERROR)
return (0);
errorf("");
errorfz();
}
unwind(i);
/* NOTREACHED */

View File

@ -5,7 +5,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.59 2007/07/22 13:34:49 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.60 2007/07/22 14:01:48 tg Exp $");
int
c_cd(const char **wp)
@ -1142,7 +1142,7 @@ c_kill(const char **wp)
"Usage: kill [ -s signame | -signum | -signame ] {pid|job}...\n"
" kill -l [exit_status]\n");
#endif
bi_errorf("");
bi_errorfz();
return 1;
}

View File

@ -3,7 +3,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.52 2007/07/22 13:34:50 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.53 2007/07/22 14:01:49 tg Exp $");
Trap sigtraps[NSIG + 1];
static struct sigaction Sigact_ign;
@ -173,7 +173,6 @@ c_fc(const char **wp)
/* List history */
if (lflag) {
char *s, *t;
const char *nfmt = nflag ? "\t" : "%d\t";
for (hp = rflag ? hlast : hfirst;
hp >= hfirst && hp <= hlast; hp += rflag ? -1 : 1) {

4
lex.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.44 2007/07/22 13:34:51 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.45 2007/07/22 14:01:49 tg Exp $");
/* Structure to keep track of the lexing state and the various pieces of info
* needed for each particular state. */
@ -905,7 +905,7 @@ yyerror(const char *fmt, ...)
va_start(va, fmt);
shf_vfprintf(shl_out, fmt, va);
va_end(va);
errorf("");
errorfz();
}
/*

6
misc.c
View File

@ -6,7 +6,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.62 2007/07/22 13:38:26 tg Exp $\t"
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.63 2007/07/22 14:01:49 tg Exp $\t"
MKSH_SH_H_ID);
#undef USE_CHVT
@ -853,7 +853,7 @@ ksh_getopt(const char **argv, Getopt *go, const char *optionsp)
(go->flags & GF_NONAME) ? "" : argv[0],
(go->flags & GF_NONAME) ? "" : ": ", c);
if (go->flags & GF_ERROR)
bi_errorf("");
bi_errorfz();
}
return '?';
}
@ -879,7 +879,7 @@ ksh_getopt(const char **argv, Getopt *go, const char *optionsp)
(go->flags & GF_NONAME) ? "" : argv[0],
(go->flags & GF_NONAME) ? "" : ": ", c);
if (go->flags & GF_ERROR)
bi_errorf("");
bi_errorfz();
return '?';
}
go->p = 0;

14
sh.h
View File

@ -8,7 +8,7 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.160 2007/07/22 13:46:15 tg Exp $"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.161 2007/07/22 14:01:50 tg Exp $"
#define MKSH_VERSION "R30 2007/07/22"
#if HAVE_SYS_PARAM_H
@ -1338,6 +1338,18 @@ void warningf(bool, const char *, ...)
__attribute__((format (printf, 2, 3)));
void bi_errorf(const char *, ...)
__attribute__((format (printf, 1, 2)));
/*
* circumvent compiler format string nonnull checking
* we teach xlC to not bitch about zero-lengths, want
* gcc to do it, and so gain double-checking benefits
*/
#if defined(__xlC__)
#define errorfz() errorf("")
#define bi_errorfz() bi_errorf("")
#else
#define errorfz() errorf(null)
#define bi_errorfz() bi_errorf(null)
#endif
void internal_errorf(const char *, ...)
__attribute__((noreturn))
__attribute__((format (printf, 1, 2)));

6
var.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.41 2007/07/22 13:34:52 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.42 2007/07/22 14:01:50 tg Exp $");
/*
* Variables
@ -341,7 +341,7 @@ setstr(struct tbl *vq, const char *s, int error_ok)
if ((vq->flag & RDONLY) && !no_ro_check) {
warningf(true, "%s: is read only", vq->name);
if (!error_ok)
errorf("");
errorfz();
return 0;
}
if (!(vq->flag&INTEGER)) { /* string dest */
@ -690,7 +690,7 @@ typeset(const char *var, Tflag set, Tflag clr, int field, int base)
}
}
if (!ok)
errorf("");
errorfz();
}
if (val != NULL) {