gcc 6.2 warnings (stupid uninitialised that wasn't, plus FALLTHROUGH fixes)

This commit is contained in:
tg 2016-11-11 23:48:30 +00:00
parent 7b4bee7e58
commit 0ba220d2c4
3 changed files with 20 additions and 17 deletions

10
edit.c
View File

@ -28,7 +28,7 @@
#ifndef MKSH_NO_CMDLINE_EDITING
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.311 2016/11/11 23:31:33 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.312 2016/11/11 23:48:28 tg Exp $");
/*
* in later versions we might use libtermcap for this, but since external
@ -4165,6 +4165,8 @@ vi_cmd(int argcnt, const char *cmd)
case 'Y':
cmd = "y$";
/* ahhhhhh... */
/* FALLTHROUGH */
case 'c':
case 'd':
case 'y':
@ -4401,6 +4403,8 @@ vi_cmd(int argcnt, const char *cmd)
if (hnum == hlast)
hnum = -1;
/* ahhh */
/* FALLTHROUGH */
case '/':
c3 = 1;
srchlen = 0;
@ -4539,6 +4543,7 @@ vi_cmd(int argcnt, const char *cmd)
case CTRL('['):
if (!Flag(FVIESCCOMPLETE))
return (-1);
/* FALLTHROUGH */
/* AT&T ksh */
case '\\':
/* Nonstandard vi/ksh */
@ -4611,8 +4616,7 @@ domove(int argcnt, const char *cmd, int sub)
case 'T':
fsavecmd = *cmd;
fsavech = cmd[1];
/* drop through */
/* FALLTHROUGH */
case ',':
case ';':
if (fsavecmd == ' ')

23
funcs.c
View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.318 2016/11/11 22:17:08 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.319 2016/11/11 23:48:29 tg Exp $");
#if HAVE_KILLPG
/*
@ -284,8 +284,9 @@ c_print(const char **wp)
const char *s;
char *xp;
XString xs;
XPtrV words;
struct {
/* storage for columnisation */
XPtrV words;
/* temporary storage for a wide character */
mksh_ari_t wc;
/* output file descriptor (if any) */
@ -313,14 +314,12 @@ c_print(const char **wp)
bool copipe;
} po;
memset(&po, 0, sizeof(po));
po.fd = 1;
po.ws = ' ';
po.ls = '\n';
po.nl = true;
po.exp = true;
po.col = false;
po.hist = false;
po.chars = false;
if (wp[0][0] == 'e') {
/* "echo" builtin */
@ -455,7 +454,7 @@ c_print(const char **wp)
if (*wp == NULL)
return (0);
XPinit(words, 16);
XPinit(po.words, 16);
}
Xinit(xs, xp, 128, ATEMP);
@ -517,7 +516,7 @@ c_print(const char **wp)
}
if (po.col) {
Xput(xs, xp, '\0');
XPput(words, Xclose(xs, xp));
XPput(po.words, Xclose(xs, xp));
Xinit(xs, xp, 128, ATEMP);
}
if (*wp != NULL) {
@ -526,17 +525,17 @@ c_print(const char **wp)
goto print_read_arg;
}
if (po.col) {
size_t w = XPsize(words);
size_t w = XPsize(po.words);
struct columnise_opts co;
XPput(words, NULL);
XPput(po.words, NULL);
co.shf = shf_sopen(NULL, 128, SHF_WR | SHF_DYNAMIC, NULL);
co.linesep = po.ls;
co.prefcol = co.do_last = false;
pr_list(&co, (char **)XPptrv(words));
pr_list(&co, (char **)XPptrv(po.words));
while (w--)
afree(XPptrv(words)[w], ATEMP);
XPfree(words);
afree(XPptrv(po.words)[w], ATEMP);
XPfree(po.words);
w = co.shf->wp - co.shf->buf;
XcheckN(xs, xp, w);
memcpy(xp, co.shf->buf, w);

4
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.321 2016/11/11 23:31:35 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.322 2016/11/11 23:48:30 tg Exp $");
extern char **environ;
@ -566,8 +566,8 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
#endif
if (!isuc(ccp))
ccp = null;
/* FALLTHROUGH */
#endif
/* FALLTHROUGH */
/* auto-detect from environment */
case 3: