* Scan for __attribute__((...)) in general (the earliest was 2.5,
where we had 'noreturn' etc. but no '__noreturn__') * Scan for __attribute__((bounded)) and __attribute__((used)) if we have __attribute__((noreturn)) * To be able to scan if certain attributes give warnings, scan for -Werror with a simple programme which hopefully triggers none * Convert __attribute__((unused)) to __unused, noreturn -> __dead * Unify other attributes * Clean up typography a little more
This commit is contained in:
parent
70eb6d19c2
commit
5891915f1b
40
Build.sh
40
Build.sh
@ -1,15 +1,9 @@
|
||||
#!/bin/sh
|
||||
# $MirOS: src/bin/mksh/Build.sh,v 1.98 2007/01/12 01:44:32 tg Exp $
|
||||
# $MirOS: src/bin/mksh/Build.sh,v 1.99 2007/01/12 01:49:26 tg Exp $
|
||||
#-
|
||||
# Environment: CC, CFLAGS, CPPFLAGS, LDFLAGS, LIBS, NOWARN, NROFF
|
||||
# With -x: SRCS (extra), TARGET_OS (uname -s)
|
||||
|
||||
# XXX TODO: check for __attribute__ (Minix 3 ACK probably doesn't)
|
||||
# and other gccisms in the code, handle appropriately. Note that I
|
||||
# sometimes _want_ gccisms, because of the improved error checks.
|
||||
|
||||
# XXX TODO: check for $CPP -dD and if that works
|
||||
|
||||
v()
|
||||
{
|
||||
$e "$*"
|
||||
@ -180,6 +174,38 @@ ac_testn can_wnoerror '' "if '$NOWARN' can be used" <<-'EOF'
|
||||
EOF
|
||||
test 1 = $HAVE_CAN_WNOERROR || NOWARN=
|
||||
|
||||
save_NOWARN=$NOWARN
|
||||
NOWARN=-Werror
|
||||
ac_testn can_werror '' "if -Werror can be used" <<-'EOF'
|
||||
int main(void) { return (0); }
|
||||
EOF
|
||||
test 1 = $HAVE_CAN_WERROR || NOWARN=
|
||||
|
||||
ac_test attribute '' 'if we have __attribute__((...)) at all' <<-'EOF'
|
||||
#include <stdlib.h>
|
||||
void fnord(void) __attribute__((noreturn));
|
||||
int main(void) { fnord(); }
|
||||
void fnord(void) { exit(0); }
|
||||
EOF
|
||||
|
||||
ac_test attribute_bounded attribute 0 'for __attribute__((bounded))' <<-'EOF'
|
||||
#include <string.h>
|
||||
int xcopy(const void *, void *, size_t)
|
||||
__attribute__((bounded (buffer, 1, 3)))
|
||||
__attribute__((bounded (buffer, 2, 3)));
|
||||
int main(int ac, char *av[]) { return (xcopy(av[0], av[1], 1)); }
|
||||
int xcopy(const void *s, void *d, size_t n) {
|
||||
memmove(d, s, n); return (n);
|
||||
}
|
||||
EOF
|
||||
|
||||
ac_test attribute_used attribute 0 'for __attribute__((used))' <<-'EOF'
|
||||
static const char fnord[] __attribute__((used)) = "42";
|
||||
int main(void) { return (0); }
|
||||
EOF
|
||||
|
||||
NOWARN=$save_NOWARN
|
||||
|
||||
ac_testn mksh_full '' "if we're building without MKSH_SMALL" <<-'EOF'
|
||||
#ifdef MKSH_SMALL
|
||||
#error OK, we are building an extra small mksh.
|
||||
|
105
edit.c
105
edit.c
@ -5,7 +5,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.74 2006/11/19 20:43:12 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.75 2007/01/12 01:49:27 tg Exp $");
|
||||
|
||||
/* tty driver characters we are interested in */
|
||||
typedef struct {
|
||||
@ -80,7 +80,7 @@ x_init(void)
|
||||
#if defined(TIOCGWINSZ) && defined(SIGWINCH)
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
x_sigwinch(int sig __attribute__((unused)))
|
||||
x_sigwinch(int sig __unused)
|
||||
{
|
||||
got_sigwinch = 1;
|
||||
}
|
||||
@ -280,8 +280,7 @@ x_print_expansions(int nwords, char * const *words, int is_command)
|
||||
* - returns number of matching strings
|
||||
*/
|
||||
static int
|
||||
x_file_glob(int flags __attribute__((unused)), const char *str,
|
||||
int slen, char ***wordsp)
|
||||
x_file_glob(int flags __unused, const char *str, int slen, char ***wordsp)
|
||||
{
|
||||
char *toglob;
|
||||
char **words;
|
||||
@ -1629,7 +1628,7 @@ x_emacs_putbuf(const char *s, size_t len)
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_back(int c __attribute__((unused)))
|
||||
x_del_back(int c __unused)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@ -1645,7 +1644,7 @@ x_del_back(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_char(int c __attribute__((unused)))
|
||||
x_del_char(int c __unused)
|
||||
{
|
||||
char *cp, *cp2;
|
||||
int i = 0;
|
||||
@ -1734,28 +1733,28 @@ x_delete(int nc, int push)
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_bword(int c __attribute__((unused)))
|
||||
x_del_bword(int c __unused)
|
||||
{
|
||||
x_delete(x_bword(), true);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_bword(int c __attribute__((unused)))
|
||||
x_mv_bword(int c __unused)
|
||||
{
|
||||
(void)x_bword();
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_fword(int c __attribute__((unused)))
|
||||
x_mv_fword(int c __unused)
|
||||
{
|
||||
x_fword(1);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_fword(int c __attribute__((unused)))
|
||||
x_del_fword(int c __unused)
|
||||
{
|
||||
x_delete(x_fword(0), true);
|
||||
return KSTD;
|
||||
@ -1909,7 +1908,7 @@ x_zotc3(char **cp)
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_back(int c __attribute__((unused)))
|
||||
x_mv_back(int c __unused)
|
||||
{
|
||||
if (xcp == xbuf) {
|
||||
x_e_putc2(7);
|
||||
@ -1924,7 +1923,7 @@ x_mv_back(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_forw(int c __attribute__((unused)))
|
||||
x_mv_forw(int c __unused)
|
||||
{
|
||||
char *cp = xcp, *cp2;
|
||||
|
||||
@ -1943,7 +1942,7 @@ x_mv_forw(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_search_char_forw(int c __attribute__((unused)))
|
||||
x_search_char_forw(int c __unused)
|
||||
{
|
||||
char *cp = xcp;
|
||||
char tmp[4];
|
||||
@ -1965,7 +1964,7 @@ x_search_char_forw(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_search_char_back(int c __attribute__((unused)))
|
||||
x_search_char_back(int c __unused)
|
||||
{
|
||||
char *cp = xcp, *p;
|
||||
char tmp[4];
|
||||
@ -2001,7 +2000,7 @@ x_search_char_back(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_newline(int c __attribute__((unused)))
|
||||
x_newline(int c __unused)
|
||||
{
|
||||
x_e_putc2('\r');
|
||||
x_e_putc2('\n');
|
||||
@ -2011,7 +2010,7 @@ x_newline(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_end_of_text(int c __attribute__((unused)))
|
||||
x_end_of_text(int c __unused)
|
||||
{
|
||||
x_zotc2(edchars.eof);
|
||||
x_putc('\r');
|
||||
@ -2021,28 +2020,28 @@ x_end_of_text(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_beg_hist(int c __attribute__((unused)))
|
||||
x_beg_hist(int c __unused)
|
||||
{
|
||||
x_load_hist(history);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_end_hist(int c __attribute__((unused)))
|
||||
x_end_hist(int c __unused)
|
||||
{
|
||||
x_load_hist(histptr);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_prev_com(int c __attribute__((unused)))
|
||||
x_prev_com(int c __unused)
|
||||
{
|
||||
x_load_hist(x_histp - x_arg);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_next_com(int c __attribute__((unused)))
|
||||
x_next_com(int c __unused)
|
||||
{
|
||||
x_load_hist(x_histp + x_arg);
|
||||
return KSTD;
|
||||
@ -2053,7 +2052,7 @@ x_next_com(int c __attribute__((unused)))
|
||||
* want so we'll simply go to the oldest one.
|
||||
*/
|
||||
static int
|
||||
x_goto_hist(int c __attribute__((unused)))
|
||||
x_goto_hist(int c __unused)
|
||||
{
|
||||
if (x_arg_defaulted)
|
||||
x_load_hist(history);
|
||||
@ -2202,7 +2201,7 @@ x_match(char *str, char *pat)
|
||||
}
|
||||
|
||||
static int
|
||||
x_del_line(int c __attribute__((unused)))
|
||||
x_del_line(int c __unused)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
@ -2220,21 +2219,21 @@ x_del_line(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_end(int c __attribute__((unused)))
|
||||
x_mv_end(int c __unused)
|
||||
{
|
||||
x_goto(xep);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_mv_begin(int c __attribute__((unused)))
|
||||
x_mv_begin(int c __unused)
|
||||
{
|
||||
x_goto(xbuf);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_draw_line(int c __attribute__((unused)))
|
||||
x_draw_line(int c __unused)
|
||||
{
|
||||
x_redraw(-1);
|
||||
return KSTD;
|
||||
@ -2314,7 +2313,7 @@ x_redraw(int limit)
|
||||
}
|
||||
|
||||
static int
|
||||
x_transpose(int c __attribute__((unused)))
|
||||
x_transpose(int c __unused)
|
||||
{
|
||||
unsigned tmpa, tmpb;
|
||||
|
||||
@ -2378,28 +2377,28 @@ x_transpose(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_literal(int c __attribute__((unused)))
|
||||
x_literal(int c __unused)
|
||||
{
|
||||
x_curprefix = -1;
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_meta1(int c __attribute__((unused)))
|
||||
x_meta1(int c __unused)
|
||||
{
|
||||
x_curprefix = 1;
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_meta2(int c __attribute__((unused)))
|
||||
x_meta2(int c __unused)
|
||||
{
|
||||
x_curprefix = 2;
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_kill(int c __attribute__((unused)))
|
||||
x_kill(int c __unused)
|
||||
{
|
||||
int col = xcp - xbuf;
|
||||
int lastcol = xep - xbuf;
|
||||
@ -2429,7 +2428,7 @@ x_push(int nchars)
|
||||
}
|
||||
|
||||
static int
|
||||
x_yank(int c __attribute__((unused)))
|
||||
x_yank(int c __unused)
|
||||
{
|
||||
if (killsp == 0)
|
||||
killtp = KILLSIZE;
|
||||
@ -2447,7 +2446,7 @@ x_yank(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_meta_yank(int c __attribute__((unused)))
|
||||
x_meta_yank(int c __unused)
|
||||
{
|
||||
int len;
|
||||
if ((x_last_command != XFUNC_yank && x_last_command != XFUNC_meta_yank) ||
|
||||
@ -2471,7 +2470,7 @@ x_meta_yank(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_abort(int c __attribute__((unused)))
|
||||
x_abort(int c __unused)
|
||||
{
|
||||
/* x_zotc(c); */
|
||||
xlp = xep = xcp = xbp = xbuf;
|
||||
@ -2481,7 +2480,7 @@ x_abort(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_error(int c __attribute__((unused)))
|
||||
x_error(int c __unused)
|
||||
{
|
||||
x_e_putc2(7);
|
||||
return KSTD;
|
||||
@ -2681,14 +2680,14 @@ bind_if_not_bound(int p, int k, int func)
|
||||
}
|
||||
|
||||
static int
|
||||
x_set_mark(int c __attribute__((unused)))
|
||||
x_set_mark(int c __unused)
|
||||
{
|
||||
xmp = xcp;
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_kill_region(int c __attribute__((unused)))
|
||||
x_kill_region(int c __unused)
|
||||
{
|
||||
int rsize;
|
||||
char *xr;
|
||||
@ -2711,7 +2710,7 @@ x_kill_region(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_xchg_point_mark(int c __attribute__((unused)))
|
||||
x_xchg_point_mark(int c __unused)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
@ -2726,7 +2725,7 @@ x_xchg_point_mark(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_noop(int c __attribute__((unused)))
|
||||
x_noop(int c __unused)
|
||||
{
|
||||
return KSTD;
|
||||
}
|
||||
@ -2735,56 +2734,56 @@ x_noop(int c __attribute__((unused)))
|
||||
* File/command name completion routines
|
||||
*/
|
||||
static int
|
||||
x_comp_comm(int c __attribute__((unused)))
|
||||
x_comp_comm(int c __unused)
|
||||
{
|
||||
do_complete(XCF_COMMAND, CT_COMPLETE);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_list_comm(int c __attribute__((unused)))
|
||||
x_list_comm(int c __unused)
|
||||
{
|
||||
do_complete(XCF_COMMAND, CT_LIST);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_complete(int c __attribute__((unused)))
|
||||
x_complete(int c __unused)
|
||||
{
|
||||
do_complete(XCF_COMMAND_FILE, CT_COMPLETE);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_enumerate(int c __attribute__((unused)))
|
||||
x_enumerate(int c __unused)
|
||||
{
|
||||
do_complete(XCF_COMMAND_FILE, CT_LIST);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_comp_file(int c __attribute__((unused)))
|
||||
x_comp_file(int c __unused)
|
||||
{
|
||||
do_complete(XCF_FILE, CT_COMPLETE);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_list_file(int c __attribute__((unused)))
|
||||
x_list_file(int c __unused)
|
||||
{
|
||||
do_complete(XCF_FILE, CT_LIST);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_comp_list(int c __attribute__((unused)))
|
||||
x_comp_list(int c __unused)
|
||||
{
|
||||
do_complete(XCF_COMMAND_FILE, CT_COMPLIST);
|
||||
return KSTD;
|
||||
}
|
||||
|
||||
static int
|
||||
x_expand(int c __attribute__((unused)))
|
||||
x_expand(int c __unused)
|
||||
{
|
||||
char **words;
|
||||
int nwords = 0;
|
||||
@ -3036,7 +3035,7 @@ x_set_arg(int c)
|
||||
|
||||
/* Comment or uncomment the current line. */
|
||||
static int
|
||||
x_comment(int c __attribute__((unused)))
|
||||
x_comment(int c __unused)
|
||||
{
|
||||
int oldsize = x_size_str(xbuf);
|
||||
int len = xep - xbuf;
|
||||
@ -3056,7 +3055,7 @@ x_comment(int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
static int
|
||||
x_version(int c __attribute__((unused)))
|
||||
x_version(int c __unused)
|
||||
{
|
||||
char *o_xbuf = xbuf, *o_xend = xend;
|
||||
char *o_xbp = xbp, *o_xep = xep, *o_xcp = xcp;
|
||||
@ -3102,7 +3101,7 @@ x_version(int c __attribute__((unused)))
|
||||
* KSTD
|
||||
*/
|
||||
static int
|
||||
x_prev_histword(int c __attribute__((unused)))
|
||||
x_prev_histword(int c __unused)
|
||||
{
|
||||
char *rcp;
|
||||
char *cp;
|
||||
@ -3150,21 +3149,21 @@ x_prev_histword(int c __attribute__((unused)))
|
||||
|
||||
/* Uppercase N(1) words */
|
||||
static int
|
||||
x_fold_upper(int c __attribute__((unused)))
|
||||
x_fold_upper(int c __unused)
|
||||
{
|
||||
return x_fold_case('U');
|
||||
}
|
||||
|
||||
/* Lowercase N(1) words */
|
||||
static int
|
||||
x_fold_lower(int c __attribute__((unused)))
|
||||
x_fold_lower(int c __unused)
|
||||
{
|
||||
return x_fold_case('L');
|
||||
}
|
||||
|
||||
/* Lowercase N(1) words */
|
||||
static int
|
||||
x_fold_capitalize(int c __attribute__((unused)))
|
||||
x_fold_capitalize(int c __unused)
|
||||
{
|
||||
return x_fold_case('C');
|
||||
}
|
||||
@ -5349,7 +5348,7 @@ complete_word(int cmd, int count)
|
||||
}
|
||||
|
||||
static int
|
||||
print_expansions(struct edstate *est, int cmd __attribute__((unused)))
|
||||
print_expansions(struct edstate *est, int cmd __unused)
|
||||
{
|
||||
int nwords;
|
||||
int start, end;
|
||||
|
4
exec.c
4
exec.c
@ -2,11 +2,11 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.20 2006/11/12 14:58:14 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.21 2007/01/12 01:49:27 tg Exp $");
|
||||
|
||||
static int comexec(struct op *, struct tbl *volatile, char **,
|
||||
int volatile);
|
||||
static void scriptexec(struct op *, char **) __attribute__((noreturn));
|
||||
static void scriptexec(struct op *, char **) __dead;
|
||||
static int call_builtin(struct tbl *, char **);
|
||||
static int iosetup(struct ioword *, struct tbl *);
|
||||
static int herein(const char *, int);
|
||||
|
5
expr.c
5
expr.c
@ -2,7 +2,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.6 2006/11/10 07:52:02 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.7 2007/01/12 01:49:27 tg Exp $");
|
||||
|
||||
/* The order of these enums is constrained by the order of opinfo[] */
|
||||
enum token {
|
||||
@ -126,8 +126,7 @@ enum error_type {
|
||||
ET_LVALUE, ET_RDONLY, ET_STR
|
||||
};
|
||||
|
||||
static void evalerr(Expr_state *, enum error_type, const char *)
|
||||
__attribute__((__noreturn__));
|
||||
static __dead void evalerr(Expr_state *, enum error_type, const char *);
|
||||
static struct tbl *evalexpr(Expr_state *, enum prec);
|
||||
static void token(Expr_state *);
|
||||
static struct tbl *do_ppmm(Expr_state *, enum token, struct tbl *, bool);
|
||||
|
10
funcs.c
10
funcs.c
@ -5,7 +5,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.41 2007/01/12 00:25:39 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.42 2007/01/12 01:49:28 tg Exp $");
|
||||
|
||||
int
|
||||
c_cd(char **wp)
|
||||
@ -2042,7 +2042,7 @@ p_time(struct shf *shf, int posix, struct timeval *tv, int width,
|
||||
}
|
||||
|
||||
int
|
||||
c_times(char **wp __attribute__((unused)))
|
||||
c_times(char **wp __unused)
|
||||
{
|
||||
struct rusage usage;
|
||||
|
||||
@ -2172,7 +2172,7 @@ timex_hook(struct op *t, char **volatile *app)
|
||||
|
||||
/* exec with no args - args case is taken care of in comexec() */
|
||||
int
|
||||
c_exec(char **wp __attribute__((unused)))
|
||||
c_exec(char **wp __unused)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -2278,7 +2278,7 @@ c_mknod(char **wp)
|
||||
|
||||
/* dummy function, special case in comexec() */
|
||||
int
|
||||
c_builtin(char **wp __attribute__((unused)))
|
||||
c_builtin(char **wp __unused)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -2803,7 +2803,7 @@ ptest_isa(Test_env *te, Test_meta meta)
|
||||
}
|
||||
|
||||
static const char *
|
||||
ptest_getopnd(Test_env *te, Test_op op, int do_eval __attribute__((unused)))
|
||||
ptest_getopnd(Test_env *te, Test_op op, int do_eval __unused)
|
||||
{
|
||||
if (te->pos.wp >= te->wp_end)
|
||||
return op == TO_FILTT ? "1" : NULL;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.37 2007/01/12 01:30:35 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.38 2007/01/12 01:49:28 tg Exp $");
|
||||
|
||||
Trap sigtraps[NSIG + 1];
|
||||
static struct sigaction Sigact_ign, Sigact_trap;
|
||||
@ -564,8 +564,7 @@ init_histvec(void)
|
||||
* save command in history
|
||||
*/
|
||||
void
|
||||
histsave(int lno __attribute__((unused)), const char *cmd,
|
||||
int dowrite __attribute__((unused)))
|
||||
histsave(int lno __unused, const char *cmd, int dowrite __unused)
|
||||
{
|
||||
char **hp;
|
||||
char *c, *cp;
|
||||
@ -1037,7 +1036,7 @@ alarm_init(void)
|
||||
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
alarm_catcher(int sig __attribute__((unused)))
|
||||
alarm_catcher(int sig __unused)
|
||||
{
|
||||
int errno_ = errno;
|
||||
|
||||
|
4
jobs.c
4
jobs.c
@ -2,7 +2,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.16 2006/11/12 13:20:15 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.17 2007/01/12 01:49:28 tg Exp $");
|
||||
|
||||
/* Order important! */
|
||||
#define PRUNNING 0
|
||||
@ -1012,7 +1012,7 @@ j_waitj(Job *j,
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
j_sigchld(int sig __attribute__((unused)))
|
||||
j_sigchld(int sig __unused)
|
||||
{
|
||||
int errno_ = errno;
|
||||
Job *j;
|
||||
|
57
sh.h
57
sh.h
@ -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.93 2007/01/12 00:25:40 tg Exp $"
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.94 2007/01/12 01:49:28 tg Exp $"
|
||||
#define MKSH_VERSION "R29 2007/01/12"
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
@ -16,19 +16,21 @@
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#if !defined(__RCSID) || !defined(__SCCSID)
|
||||
#if !defined(__GNUC__) || defined(lint)
|
||||
#define __attribute__(x) /* deleted */
|
||||
#endif
|
||||
#undef __IDSTRING
|
||||
#undef __IDSTRING_CONCAT
|
||||
#undef __IDSTRING_EXPAND
|
||||
#undef __RCSID
|
||||
#undef __SCCSID
|
||||
#if HAVE_ATTRIBUTE_USED
|
||||
#define __attribute____used__ __attribute__((used))
|
||||
#else
|
||||
#define __attribute____used__ /* nothing */
|
||||
#endif
|
||||
#define __IDSTRING_CONCAT(l,p) __LINTED__ ## l ## _ ## p
|
||||
#define __IDSTRING_EXPAND(l,p) __IDSTRING_CONCAT(l,p)
|
||||
#define __IDSTRING(prefix, string) \
|
||||
static const char __IDSTRING_EXPAND(__LINE__,prefix) [] \
|
||||
__attribute__((used)) = "@(""#)" #prefix ": " string
|
||||
__attribute____used__ = "@(""#)" #prefix ": " string
|
||||
#define __RCSID(x) __IDSTRING(rcsid,x)
|
||||
#define __SCCSID(x) __IDSTRING(sccsid,x)
|
||||
#endif
|
||||
@ -104,6 +106,21 @@
|
||||
#define ksh_tolower(c) (((c) >= 'A') && ((c) <= 'Z') ? (c) - 'A' + 'a' : (c))
|
||||
#define ksh_toupper(c) (((c) >= 'a') && ((c) <= 'z') ? (c) - 'a' + 'A' : (c))
|
||||
|
||||
#if HAVE_ATTRIBUTE
|
||||
#undef __attribute__
|
||||
#if HAVE_ATTRIBUTE_BOUNDED
|
||||
#define __bound_att__ __attribute__
|
||||
#else
|
||||
#define __bound_att(x) /* nothing */
|
||||
#endif
|
||||
#else
|
||||
#define __attribute__(x) /* nothing */
|
||||
#endif
|
||||
#undef __dead
|
||||
#define __dead __attribute__((noreturn))
|
||||
#undef __unused
|
||||
#define __unused __attribute__((unused))
|
||||
|
||||
/* this macro must not evaluate its arguments several times */
|
||||
#define ksh_isspace(c) __extension__({ \
|
||||
unsigned char ksh_isspace_c = (c); \
|
||||
@ -1182,8 +1199,8 @@ pid_t j_async(void);
|
||||
int j_stopped_running(void);
|
||||
/* lex.c */
|
||||
int yylex(int);
|
||||
void yyerror(const char *, ...)
|
||||
__attribute__((__noreturn__, __format__ (printf, 1, 2)));
|
||||
__dead void yyerror(const char *, ...)
|
||||
__attribute__((format (printf, 1, 2)));
|
||||
Source *pushs(int, Area *);
|
||||
void set_prompt(int, Source *);
|
||||
void pprompt(const char *, int);
|
||||
@ -1192,24 +1209,24 @@ int promptlen(const char *);
|
||||
int include(const char *, int, char **, int);
|
||||
int command(const char *);
|
||||
int shell(Source *volatile, int volatile);
|
||||
void unwind(int) __attribute__((__noreturn__));
|
||||
__dead void unwind(int);
|
||||
void newenv(int);
|
||||
void quitenv(struct shf *);
|
||||
void cleanup_parents_env(void);
|
||||
void cleanup_proc_env(void);
|
||||
void errorf(const char *, ...)
|
||||
__attribute__((__noreturn__, __format__ (printf, 1, 2)));
|
||||
__dead void errorf(const char *, ...)
|
||||
__attribute__((format (printf, 1, 2)));
|
||||
void warningf(bool, const char *, ...)
|
||||
__attribute__((__format__ (printf, 2, 3)));
|
||||
__attribute__((format (printf, 2, 3)));
|
||||
void bi_errorf(const char *, ...)
|
||||
__attribute__((__format__ (printf, 1, 2)));
|
||||
__attribute__((format (printf, 1, 2)));
|
||||
void internal_errorf(int, const char *, ...)
|
||||
__attribute__((__format__ (printf, 2, 3)));
|
||||
__attribute__((format (printf, 2, 3)));
|
||||
void error_prefix(bool);
|
||||
void shellf(const char *, ...)
|
||||
__attribute__((__format__ (printf, 1, 2)));
|
||||
__attribute__((format (printf, 1, 2)));
|
||||
void shprintf(const char *, ...)
|
||||
__attribute__((__format__ (printf, 1, 2)));
|
||||
__attribute__((format (printf, 1, 2)));
|
||||
int can_seek(int);
|
||||
void initio(void);
|
||||
int ksh_dup2(int, int, int);
|
||||
@ -1283,14 +1300,14 @@ int shf_putchar(int, struct shf *);
|
||||
int shf_puts(const char *, struct shf *);
|
||||
int shf_write(const char *, int, struct shf *);
|
||||
int shf_fprintf(struct shf *, const char *, ...)
|
||||
__attribute__((__format__ (printf, 2, 3)));
|
||||
__attribute__((format (printf, 2, 3)));
|
||||
int shf_snprintf(char *, int, const char *, ...)
|
||||
__attribute__((__format__ (printf, 3, 4)))
|
||||
__attribute__((__bounded__ (__string__,1,2)));
|
||||
__attribute__((format (printf, 3, 4)))
|
||||
__bound_att__((bounded (string, 1, 2)));
|
||||
char *shf_smprintf(const char *, ...)
|
||||
__attribute__((__format__ (printf, 1, 2)));
|
||||
__attribute__((format (printf, 1, 2)));
|
||||
int shf_vfprintf(struct shf *, const char *, va_list)
|
||||
__attribute__((__format__ (printf, 2, 0)));
|
||||
__attribute__((format (printf, 2, 0)));
|
||||
/* syn.c */
|
||||
void initkeywords(void);
|
||||
struct op *compile(Source *);
|
||||
|
24
strlfun.c
24
strlfun.c
@ -1,4 +1,4 @@
|
||||
/* $MirOS: src/bin/mksh/strlfun.c,v 1.8 2007/01/09 17:34:21 tg Exp $ */
|
||||
/* $MirOS: src/bin/mksh/strlfun.c,v 1.9 2007/01/12 01:49:29 tg Exp $ */
|
||||
/* $miros: src/lib/libc/string/strlfun.c,v 1.14 2007/01/07 02:11:40 tg Exp $ */
|
||||
|
||||
/*-
|
||||
@ -45,26 +45,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __RCSID
|
||||
#undef __IDSTRING
|
||||
#undef __IDSTRING_CONCAT
|
||||
#undef __IDSTRING_EXPAND
|
||||
#if defined(__ELF__) && defined(__GNUC__)
|
||||
#define __IDSTRING(prefix, string) \
|
||||
__asm__(".section .comment" \
|
||||
"\n .ascii \"@(\"\"#)" #prefix ": \"" \
|
||||
"\n .asciz \"" string "\"" \
|
||||
"\n .previous")
|
||||
#else
|
||||
#define __IDSTRING_CONCAT(l,p) __LINTED__ ## l ## _ ## p
|
||||
#define __IDSTRING_EXPAND(l,p) __IDSTRING_CONCAT(l,p)
|
||||
#define __IDSTRING(prefix, string) \
|
||||
static const char __IDSTRING_EXPAND(__LINE__,prefix) [] \
|
||||
__attribute__((used)) = "@(""#)" #prefix ": " string
|
||||
#endif
|
||||
#define __RCSID(x) __IDSTRING(rcsid,x)
|
||||
#endif
|
||||
|
||||
#ifndef __predict_true
|
||||
#define __predict_true(exp) ((exp) != 0)
|
||||
#endif
|
||||
@ -73,7 +53,7 @@
|
||||
#endif
|
||||
|
||||
#if !defined(_KERNEL) && !defined(_STANDALONE)
|
||||
__RCSID("$MirOS: src/bin/mksh/strlfun.c,v 1.8 2007/01/09 17:34:21 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/strlfun.c,v 1.9 2007/01/12 01:49:29 tg Exp $");
|
||||
#endif
|
||||
|
||||
size_t strlcpy(char *, const char *, size_t);
|
||||
|
53
syn.c
53
syn.c
@ -2,19 +2,19 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.8 2006/08/01 13:43:28 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.9 2007/01/12 01:49:29 tg Exp $");
|
||||
|
||||
struct nesting_state {
|
||||
int start_token; /* token than began nesting (eg, FOR) */
|
||||
int start_line; /* line nesting began on */
|
||||
};
|
||||
|
||||
static void yyparse(void);
|
||||
static void yyparse(void);
|
||||
static struct op *pipeline(int);
|
||||
static struct op *andor(void);
|
||||
static struct op *c_list(int);
|
||||
static struct ioword *synio(int);
|
||||
static void musthave(int, int);
|
||||
static void musthave(int, int);
|
||||
static struct op *nested(int, int, int);
|
||||
static struct op *get_command(int);
|
||||
static struct op *dogroup(void);
|
||||
@ -23,34 +23,30 @@ static struct op *elsepart(void);
|
||||
static struct op *caselist(void);
|
||||
static struct op *casepart(int);
|
||||
static struct op *function_body(char *, int);
|
||||
static char ** wordlist(void);
|
||||
static char **wordlist(void);
|
||||
static struct op *block(int, struct op *, struct op *, char **);
|
||||
static struct op *newtp(int);
|
||||
static void syntaxerr(const char *) __attribute__((__noreturn__));
|
||||
static void nesting_push(struct nesting_state *, int);
|
||||
static void nesting_pop(struct nesting_state *);
|
||||
static int assign_command(char *);
|
||||
static int inalias(struct source *);
|
||||
static int dbtestp_isa(Test_env *, Test_meta);
|
||||
static __dead void syntaxerr(const char *);
|
||||
static void nesting_push(struct nesting_state *, int);
|
||||
static void nesting_pop(struct nesting_state *);
|
||||
static int assign_command(char *);
|
||||
static int inalias(struct source *);
|
||||
static int dbtestp_isa(Test_env *, Test_meta);
|
||||
static const char *dbtestp_getopnd(Test_env *, Test_op, int);
|
||||
static int dbtestp_eval(Test_env *, Test_op, const char *,
|
||||
static int dbtestp_eval(Test_env *, Test_op, const char *,
|
||||
const char *, int);
|
||||
static void dbtestp_error(Test_env *, int, const char *)
|
||||
__attribute__((noreturn));
|
||||
|
||||
static struct op *outtree; /* yyparse output */
|
||||
static __dead void dbtestp_error(Test_env *, int, const char *);
|
||||
|
||||
static struct op *outtree; /* yyparse output */
|
||||
static struct nesting_state nesting; /* \n changed to ; */
|
||||
|
||||
static int reject; /* token(cf) gets symbol again */
|
||||
static int symbol; /* yylex value */
|
||||
static int reject; /* token(cf) gets symbol again */
|
||||
static int symbol; /* yylex value */
|
||||
|
||||
#define REJECT (reject = 1)
|
||||
#define ACCEPT (reject = 0)
|
||||
#define token(cf) \
|
||||
((reject) ? (ACCEPT, symbol) : (symbol = yylex(cf)))
|
||||
#define tpeek(cf) \
|
||||
((reject) ? (symbol) : (REJECT, symbol = yylex(cf)))
|
||||
#define REJECT (reject = 1)
|
||||
#define ACCEPT (reject = 0)
|
||||
#define token(cf) ((reject) ? (ACCEPT, symbol) : (symbol = yylex(cf)))
|
||||
#define tpeek(cf) ((reject) ? (symbol) : (REJECT, symbol = yylex(cf)))
|
||||
|
||||
static void
|
||||
yyparse(void)
|
||||
@ -859,8 +855,7 @@ dbtestp_isa(Test_env *te, Test_meta meta)
|
||||
}
|
||||
|
||||
static const char *
|
||||
dbtestp_getopnd(Test_env *te, Test_op op __attribute__((unused)),
|
||||
int do_eval __attribute__((unused)))
|
||||
dbtestp_getopnd(Test_env *te, Test_op op __unused, int do_eval __unused)
|
||||
{
|
||||
int c = tpeek(ARRAYVAR);
|
||||
|
||||
@ -874,11 +869,9 @@ dbtestp_getopnd(Test_env *te, Test_op op __attribute__((unused)),
|
||||
}
|
||||
|
||||
static int
|
||||
dbtestp_eval(Test_env *te __attribute__((unused)),
|
||||
Test_op op __attribute__((unused)),
|
||||
const char *opnd1 __attribute__((unused)),
|
||||
const char *opnd2 __attribute__((unused)),
|
||||
int do_eval __attribute__((unused)))
|
||||
dbtestp_eval(Test_env *te __unused, Test_op op __unused,
|
||||
const char *opnd1 __unused, const char *opnd2 __unused,
|
||||
int do_eval __unused)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user