fixes for constant conditionals, from gcc-4.2 fat binary building

This commit is contained in:
tg 2008-07-18 11:33:13 +00:00
parent eff47cf33b
commit 68e028ea4b
4 changed files with 13 additions and 11 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.218 2008/07/17 13:00:38 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.219 2008/07/18 11:33:11 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 $
@ -7,7 +7,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R35 2008/07/14
@(#)MIRBSD KSH R35 2008/07/18
description:
Check version of shell.
stdin:

4
misc.c
View File

@ -6,7 +6,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.84 2008/07/12 18:24:58 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.85 2008/07/18 11:33:12 tg Exp $");
#undef USE_CHVT
#if defined(TIOCSCTTY) && !defined(MKSH_SMALL)
@ -228,7 +228,7 @@ getoptions(void)
for (i = 0; i < NELEM(options); i++)
if (options[i].c && Flag(i))
*cp++ = options[i].c;
return (str_nsave(m, cp - m, ATEMP));
return (str_nsave_(m, cp - m, ATEMP));
}
/* change a Flag(*) value; takes care of special actions */

12
sh.h
View File

@ -100,9 +100,9 @@
#define __SCCSID(x) __IDSTRING(sccsid,x)
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.228 2008/07/14 12:29:06 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.229 2008/07/18 11:33:12 tg Exp $");
#endif
#define MKSH_VERSION "R35 2008/07/14"
#define MKSH_VERSION "R35 2008/07/18"
#ifndef MKSH_INCLUDES_ONLY
@ -1423,18 +1423,20 @@ struct tbl **ktsort(struct table *);
void setctypes(const char *, int);
void initctypes(void);
#if defined(MKSH_SMALL) || !HAVE_EXPSTMT
#define str_save_ str_save
#define str_nsave_ str_nsave
char *str_save(const char *, Area *);
char *str_nsave(const char *, int, Area *);
#else
#define str_save_(s,ap) str_nsave_((s), strlen(s), (ap))
#define str_nsave_(s,n,ap) ({ \
size_t str_save_sz = (n) + 1; \
char *str_save_rv = alloc(str_save_sz, (ap)); \
strlcpy(str_save_rv, (s), str_save_sz); \
(str_save_rv); \
})
#define str_save(s,ap) \
(!(s) ? NULL : str_nsave_((s), strlen(s), (ap)))
#define str_nsave(s,n,ap) \
#define str_save(s,ap) (!(s) ? NULL : str_save_((s), (ap)))
#define str_nsave(s,n,ap) \
(!(s) || (n) < 0 ? NULL : str_nsave_((s), (n), (ap)))
#endif
size_t option(const char *);

4
syn.c
View File

@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.24 2008/07/14 12:29:06 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.25 2008/07/18 11:33:13 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@ -366,7 +366,7 @@ get_command(int cf)
if (!is_wdvarname(yylval.cp, true))
yyerror("%s: bad identifier\n",
c == FOR ? "for" : "select");
t->str = str_save(ident, ATEMP);
t->str = str_save_(ident, ATEMP);
nesting_push(&old_nesting, c);
t->vars = wordlist();
t->left = dogroup();