fix libFirm/cparser -Wsign-compare

This commit is contained in:
tg 2012-12-05 19:38:25 +00:00
parent 75af4e244a
commit f654a3dea4
7 changed files with 36 additions and 34 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.570 2012/12/04 01:18:24 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.571 2012/12/05 19:38:18 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 $
@ -29,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R41 2012/12/03
@(#)MIRBSD KSH R41 2012/12/05
description:
Check version of shell.
stdin:
@ -38,7 +38,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R41 2012/12/03
@(#)LEGACY KSH R41 2012/12/05
description:
Check version of legacy shell.
stdin:

6
lex.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.173 2012/12/05 18:54:08 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.174 2012/12/05 19:38:20 tg Exp $");
/*
* states while lexing word
@ -272,8 +272,8 @@ yylex(int cf)
statep->nparen++;
else if (c == ')')
statep->nparen--;
else if (statep->nparen == 0 &&
(c == /*{*/ '}' || c == statep->ls_adelim.delimiter)) {
else if (statep->nparen == 0 && (c == /*{*/ '}' ||
c == (int)statep->ls_adelim.delimiter)) {
*wp++ = ADELIM;
*wp++ = c;
if (c == /*{*/ '}' || --statep->ls_adelim.num == 0)

6
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.246 2012/11/30 20:19:13 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.247 2012/12/05 19:38:21 tg Exp $");
extern char **environ;
@ -254,7 +254,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
#ifdef MKSH_BINSHREDUCED
/* set FSH if we're called as -sh or /bin/sh or so */
if (!strcmp(ccp, "sh"))
change_flag(FSH, OF_FIRSTTIME, 1);
change_flag(FSH, OF_FIRSTTIME, true);
#endif
}
@ -329,7 +329,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
* by the environment or the user. Also, we want tab completion
* on in vi by default.
*/
change_flag(FEMACS, OF_SPECIAL, 1);
change_flag(FEMACS, OF_SPECIAL, true);
#if !MKSH_S_NOVI
Flag(FVITABCOMPLETE) = 1;
#endif

36
misc.c
View File

@ -30,7 +30,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.203 2012/12/04 01:18:31 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.204 2012/12/05 19:38:22 tg Exp $");
#define KSH_CHVT_FLAG
#ifdef MKSH_SMALL
@ -52,7 +52,7 @@ static const unsigned char *pat_scan(const unsigned char *,
const unsigned char *, bool);
static int do_gmatch(const unsigned char *, const unsigned char *,
const unsigned char *, const unsigned char *);
static const unsigned char *cclass(const unsigned char *, int);
static const unsigned char *cclass(const unsigned char *, unsigned char);
#ifdef KSH_CHVT_CODE
static void chvt(const char *);
#endif
@ -226,13 +226,13 @@ getoptions(void)
/* change a Flag(*) value; takes care of special actions */
void
change_flag(enum sh_flag f, int what, unsigned int newval)
change_flag(enum sh_flag f, int what, bool newset)
{
unsigned char oldval;
unsigned char newval;
oldval = Flag(f);
/* needed for tristates */
Flag(f) = newval ? 1 : 0;
Flag(f) = newval = (newset ? 1 : 0);
#ifndef MKSH_UNEMPLOYED
if (f == FMONITOR) {
if (what != OF_CMDLINE && newval != oldval)
@ -249,7 +249,7 @@ change_flag(enum sh_flag f, int what, unsigned int newval)
Flag(FVI) =
#endif
Flag(FEMACS) = Flag(FGMACS) = 0;
Flag(f) = (unsigned char)newval;
Flag(f) = newval;
} else
#endif
if (f == FPRIVILEGED && oldval && !newval) {
@ -278,12 +278,12 @@ change_flag(enum sh_flag f, int what, unsigned int newval)
#endif
} else if ((f == FPOSIX || f == FSH) && newval) {
Flag(FPOSIX) = Flag(FSH) = Flag(FBRACEEXPAND) = 0;
Flag(f) = (unsigned char)newval;
Flag(f) = newval;
}
/* Changing interactive flag? */
if (f == FTALKING) {
if ((what == OF_CMDLINE || what == OF_SET) && procpid == kshpid)
Flag(FTALKING_I) = (unsigned char)newval;
Flag(FTALKING_I) = newval;
}
}
@ -299,7 +299,8 @@ parse_args(const char **argv,
{
static char cmd_opts[NELEM(options) + 5]; /* o:T:\0 */
static char set_opts[NELEM(options) + 6]; /* A:o;s\0 */
char set, *opts;
bool set;
char *opts;
const char *array = NULL;
Getopt go;
size_t i;
@ -354,7 +355,7 @@ parse_args(const char **argv,
opts = set_opts;
ksh_getopt_reset(&go, GF_ERROR|GF_PLUSOPT);
while ((optc = ksh_getopt(argv, &go, opts)) != -1) {
set = (go.info & GI_PLUS) ? 0 : 1;
set = tobool(!(go.info & GI_PLUS));
switch (optc) {
case 'A':
if (what == OF_FIRSTTIME)
@ -378,7 +379,7 @@ parse_args(const char **argv,
break;
}
i = option(go.optarg);
if ((i != (size_t)-1) && set == Flag(i))
if ((i != (size_t)-1) && (set ? 1U : 0U) == Flag(i))
/*
* Don't check the context if the flag
* isn't changing - makes "set -o interactive"
@ -401,7 +402,7 @@ parse_args(const char **argv,
#ifndef KSH_CHVT_CODE
errorf("no TIOCSCTTY ioctl");
#else
change_flag(FTALKING, OF_CMDLINE, 1);
change_flag(FTALKING, OF_CMDLINE, true);
chvt(go.optarg);
break;
#endif
@ -706,7 +707,7 @@ static int
do_gmatch(const unsigned char *s, const unsigned char *se,
const unsigned char *p, const unsigned char *pe)
{
int sc, pc;
unsigned char sc, pc;
const unsigned char *prest, *psub, *pnext;
const unsigned char *srest;
@ -836,12 +837,13 @@ do_gmatch(const unsigned char *s, const unsigned char *se,
}
static const unsigned char *
cclass(const unsigned char *p, int sub)
cclass(const unsigned char *p, unsigned char sub)
{
int c, d, notp, found = 0;
unsigned char c, d;
bool notp, found = false;
const unsigned char *orig_p = p;
if ((notp = (ISMAGIC(*p) && *++p == '!')))
if ((notp = tobool(ISMAGIC(*p) && *++p == '!')))
p++;
do {
c = *p++;
@ -875,7 +877,7 @@ cclass(const unsigned char *p, int sub)
} else
d = c;
if (c == sub || (c <= sub && sub <= d))
found = 1;
found = true;
} while (!(ISMAGIC(p[0]) && p[1] == ']'));
return ((found != notp) ? p+2 : NULL);

6
sh.h
View File

@ -152,9 +152,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.613 2012/12/05 18:54:09 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.614 2012/12/05 19:38:23 tg Exp $");
#endif
#define MKSH_VERSION "R41 2012/12/03"
#define MKSH_VERSION "R41 2012/12/05"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES
@ -1872,7 +1872,7 @@ void setctypes(const char *, int);
void initctypes(void);
size_t option(const char *);
char *getoptions(void);
void change_flag(enum sh_flag, int, unsigned int);
void change_flag(enum sh_flag, int, bool);
int parse_args(const char **, int, bool *);
int getn(const char *, int *);
int gmatchx(const char *, const char *, bool);

6
shf.c
View File

@ -1,7 +1,7 @@
/* $OpenBSD: shf.c,v 1.15 2006/04/02 00:48:33 deraadt Exp $ */
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012
* Thorsten Glaser <tg@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -24,7 +24,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.48 2012/12/04 01:11:16 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.49 2012/12/05 19:38:24 tg Exp $");
/* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */
@ -552,7 +552,7 @@ shf_ungetc(int c, struct shf *shf)
* Can unget what was read, but not something different;
* we don't want to modify a string.
*/
if (shf->rp[-1] != c)
if ((int)(shf->rp[-1]) != c)
return (EOF);
shf->flags &= ~SHF_EOF;
shf->rp--;

4
syn.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.86 2012/12/05 18:54:10 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.87 2012/12/05 19:38:25 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@ -1015,7 +1015,7 @@ dbtestp_isa(Test_env *te, Test_meta meta)
db_close)) ? TO_NONNULL : TO_NONOP;
if (ret != TO_NONOP) {
ACCEPT;
if (meta < NELEM(dbtest_tokens))
if ((unsigned int)meta < NELEM(dbtest_tokens))
save = wdcopy(dbtest_tokens[(int)meta], ATEMP);
if (save)
XPput(*te->pos.av, save);