llvm/clang scan-build is now content…

This commit is contained in:
tg 2009-12-05 17:43:50 +00:00
parent 437f9b76e1
commit 8213a28403
9 changed files with 50 additions and 31 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.347 2009/12/01 19:15:31 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.348 2009/12/05 17:43:43 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -25,7 +25,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R39 2009/12/01
@(#)MIRBSD KSH R39 2009/12/05
description:
Check version of shell.
stdin:

30
edit.c
View File

@ -25,7 +25,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.184 2009/10/30 00:57:36 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.185 2009/12/05 17:43:44 tg Exp $");
/* tty driver characters we are interested in */
typedef struct {
@ -70,11 +70,17 @@ static int x_vi(char *, size_t);
#define x_putc(c) shf_putc((c), shl_out)
static int path_order_cmp(const void *aa, const void *bb);
static char *add_glob(const char *, int);
static char *add_glob(const char *, int)
__attribute__((nonnull (1)))
__bound_att__((bounded (string, 1, 2)));
static void glob_table(const char *, XPtrV *, struct table *);
static void glob_path(int flags, const char *, XPtrV *, const char *);
static int x_file_glob(int, const char *, int, char ***);
static int x_command_glob(int, const char *, int, char ***);
static int x_file_glob(int, const char *, int, char ***)
__attribute__((nonnull (2)))
__bound_att__((bounded (string, 2, 3)));
static int x_command_glob(int, const char *, int, char ***)
__attribute__((nonnull (2)))
__bound_att__((bounded (string, 2, 3)));
static int x_locate_word(const char *, int, int, int *, bool *);
static int x_e_getmbc(char *);
@ -528,6 +534,9 @@ add_glob(const char *str, int slen)
if (slen < 0)
return (NULL);
/* for clang's static analyser, the nonnull attribute isn't enough */
mkssert(str != NULL);
strndupx(toglob, str, slen + 1, ATEMP); /* + 1 for "*" */
toglob[slen] = '\0';
@ -848,14 +857,16 @@ static void x_load_hist(char **);
static int x_search(char *, int, int);
#ifndef MKSH_SMALL
static int x_search_dir(int);
int x_bind(const char *, const char *, bool, bool);
int x_bind(const char *, const char *, bool, bool)
#else
int x_bind(const char *, const char *, bool);
int x_bind(const char *, const char *, bool)
#endif
__attribute__((nonnull (1, 2)));
static int x_match(char *, char *);
static void x_redraw(int);
static void x_push(int);
static char *x_mapin(const char *, Area *);
static char *x_mapin(const char *, Area *)
__attribute__((nonnull (1)));
static char *x_mapout(int);
static void x_mapout2(int, char **);
static void x_print(int, int);
@ -2229,6 +2240,9 @@ x_mapin(const char *cp, Area *ap)
{
char *new, *op;
/* for clang's static analyser, the nonnull attribute isn't enough */
mkssert(cp != NULL);
strdupx(new, cp, ap);
op = new;
while (*cp) {
@ -2338,7 +2352,7 @@ x_bind(const char *a1, const char *a2,
return (0);
}
m2 = m1 = x_mapin(a1, ATEMP);
prefix = key = 0;
prefix = 0;
for (;; m1++) {
key = (unsigned char)*m1;
f = XFUNC_VALUE(x_tab[prefix][key]);

5
eval.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.77 2009/12/05 17:02:25 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.78 2009/12/05 17:43:45 tg Exp $");
/*
* string expansion
@ -236,7 +236,8 @@ expand(const char *cp, /* input word */
doblank = 0;
make_magic = 0;
word = (f&DOBLANK) ? IFS_WS : IFS_WORD;
st_head.next = NULL;
/* clang doesn't know OSUBST comes before CSUBST */
memset(&st_head, 0, sizeof(st_head));
st = &st_head;
while (1) {

4
exec.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.70 2009/11/28 14:28:00 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.71 2009/12/05 17:43:46 tg Exp $");
static int comexec(struct op *, struct tbl *volatile, const char **,
int volatile, volatile int *);
@ -296,7 +296,7 @@ execute(struct op *volatile t,
}
is_first = false;
setstr(global(t->str), cp, KSH_UNWIND_ERROR);
rv = execute(t->left, flags & XERROK, xerrok);
execute(t->left, flags & XERROK, xerrok);
}
}
break;

View File

@ -25,7 +25,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.145 2009/12/01 13:12:30 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.146 2009/12/05 17:43:46 tg Exp $");
#if HAVE_KILLPG
/*
@ -2339,7 +2339,8 @@ c_brkcont(const char **wp)
int
c_set(const char **wp)
{
int argi, setargs;
int argi;
bool setargs;
struct block *l = e->loc;
const char **owp;
@ -2353,7 +2354,8 @@ c_set(const char **wp)
return (1);
/* set $# and $* */
if (setargs) {
owp = wp += argi - 1;
wp += argi - 1;
owp = wp;
wp[0] = l->argv[0]; /* save $0 */
while (*++wp != NULL)
strdupx(*wp, *wp, &l->area);

7
main.c
View File

@ -33,7 +33,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.156 2009/12/05 13:02:26 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.157 2009/12/05 17:43:47 tg Exp $");
extern char **environ;
@ -769,7 +769,10 @@ cleanup_parents_env(void)
struct env *ep;
int fd;
/* Don't clean up temporary files - parent will probably need them.
mkssert(e != NULL);
/*
* Don't clean up temporary files - parent will probably need them.
* Also, can't easily reclaim memory since variables, etc. could be
* anywhere.
*/

4
misc.c
View File

@ -29,7 +29,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.133 2009/11/28 14:28:02 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.134 2009/12/05 17:43:48 tg Exp $");
unsigned char chtypes[UCHAR_MAX + 1]; /* type bits for unsigned char */
@ -244,7 +244,7 @@ change_flag(enum sh_flag f, int what, unsigned int newval)
int
parse_args(const char **argv,
int what, /* OF_CMDLINE or OF_SET */
int *setargsp)
bool *setargsp)
{
static char cmd_opts[NELEM(options) + 5]; /* o:T:\0 */
static char set_opts[NELEM(options) + 6]; /* A:o;s\0 */

8
sh.h
View File

@ -134,9 +134,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.367 2009/12/01 19:15:34 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.368 2009/12/05 17:43:49 tg Exp $");
#endif
#define MKSH_VERSION "R39 2009/12/01"
#define MKSH_VERSION "R39 2009/12/05"
#ifndef MKSH_INCLUDES_ONLY
@ -410,11 +410,13 @@ char *ucstrstr(char *, const char *);
})
#define vstrchr(s,c) (cstrchr((s), (c)) != NULL)
#define vstrstr(b,l) (cstrstr((b), (l)) != NULL)
#define mkssert(e) ((e) ? (void)0 : exit(255))
#else /* !DEBUG, !gcc */
#define cstrchr(s,c) ((const char *)strchr((s), (c)))
#define cstrstr(s,c) ((const char *)strstr((s), (c)))
#define vstrchr(s,c) (strchr((s), (c)) != NULL)
#define vstrstr(b,l) (strstr((b), (l)) != NULL)
#define mkssert(e) ((void)0)
#endif
/* use this ipv strchr(s, 0) but no side effects in s! */
@ -1535,7 +1537,7 @@ void initctypes(void);
size_t option(const char *);
char *getoptions(void);
void change_flag(enum sh_flag, int, unsigned int);
int parse_args(const char **, int, int *);
int parse_args(const char **, int, bool *);
int getn(const char *, int *);
int bi_getn(const char *, int *);
int gmatchx(const char *, const char *, bool);

11
var.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.99 2009/12/01 19:15:35 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.100 2009/12/05 17:43:50 tg Exp $");
/*
* Variables
@ -160,12 +160,9 @@ array_index_calc(const char *n, bool *arrayp, uint32_t *valp)
strndupx(vn, n, p - n, ATEMP);
h = hash(vn);
/* check if this is a reference */
for (l = e->loc; ; l = l->next) {
if ((vp = ktsearch(&l->vars, vn, h)) != NULL)
break;
if (l->next == NULL)
break;
}
do {
vp = ktsearch(&l->vars, vn, h);
} while (!vp && (l = l->next));
afree(vn, ATEMP);
if (vp && (vp->flag & (DEFINED|ASSOC|ARRAY)) ==
(DEFINED|ASSOC)) {