summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-09-17 00:22:26 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-09-17 00:22:26 +0000
commitd3612178b71b5c7d66252933c3e5a5980887c4ca (patch)
treeed281183851ef7f437520fe212efc54dea2faa80 /shell
parent2570b43e829ccfc0f199fe61aafc24b1bd3fc7b1 (diff)
downloadbusybox-w32-d3612178b71b5c7d66252933c3e5a5980887c4ca.tar.gz
busybox-w32-d3612178b71b5c7d66252933c3e5a5980887c4ca.tar.bz2
busybox-w32-d3612178b71b5c7d66252933c3e5a5980887c4ca.zip
Patch by Junio C Hamano to workaround a gcc compiler bug.
The construct certain vintages of GCC (the one I have trouble with is 3.2.3) have trouble with looks like the following: static struct st a; static struct st *p = &a; struct st { int foo; }; static void init(void) { a.foo = 0; } The problem disappears if we move the struct declaration up to let the compiler know the shape of the struct before the first definition uses it, like this: struct st { int foo; }; /* this has been moved up */ static struct st a; static struct st *p = &a; static void init(void) { a.foo = 0; }
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 0cdfd2b1c..8adf581b6 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -550,6 +550,29 @@ static int parselleft; /* copy of parsefile->lleft */
550 550
551/* next character in input buffer */ 551/* next character in input buffer */
552static char *parsenextc; /* copy of parsefile->nextc */ 552static char *parsenextc; /* copy of parsefile->nextc */
553
554struct strpush {
555 struct strpush *prev; /* preceding string on stack */
556 char *prevstring;
557 int prevnleft;
558#ifdef CONFIG_ASH_ALIAS
559 struct alias *ap; /* if push was associated with an alias */
560#endif
561 char *string; /* remember the string since it may change */
562};
563
564struct parsefile {
565 struct parsefile *prev; /* preceding file on stack */
566 int linno; /* current line */
567 int fd; /* file descriptor (or -1 if string) */
568 int nleft; /* number of chars left in this line */
569 int lleft; /* number of chars left in this buffer */
570 char *nextc; /* next char in buffer */
571 char *buf; /* input buffer */
572 struct strpush *strpush; /* for pushing strings at this level */
573 struct strpush basestrpush; /* so pushing one is fast */
574};
575
553static struct parsefile basepf; /* top level input file */ 576static struct parsefile basepf; /* top level input file */
554static char basebuf[IBUFSIZ]; /* buffer for top level input file */ 577static char basebuf[IBUFSIZ]; /* buffer for top level input file */
555static struct parsefile *parsefile = &basepf; /* current input file */ 578static struct parsefile *parsefile = &basepf; /* current input file */
@@ -1573,28 +1596,6 @@ static inline int varequal(const char *a, const char *b) {
1573 1596
1574static int loopnest; /* current loop nesting level */ 1597static int loopnest; /* current loop nesting level */
1575 1598
1576struct strpush {
1577 struct strpush *prev; /* preceding string on stack */
1578 char *prevstring;
1579 int prevnleft;
1580#ifdef CONFIG_ASH_ALIAS
1581 struct alias *ap; /* if push was associated with an alias */
1582#endif
1583 char *string; /* remember the string since it may change */
1584};
1585
1586struct parsefile {
1587 struct parsefile *prev; /* preceding file on stack */
1588 int linno; /* current line */
1589 int fd; /* file descriptor (or -1 if string) */
1590 int nleft; /* number of chars left in this line */
1591 int lleft; /* number of chars left in this buffer */
1592 char *nextc; /* next char in buffer */
1593 char *buf; /* input buffer */
1594 struct strpush *strpush; /* for pushing strings at this level */
1595 struct strpush basestrpush; /* so pushing one is fast */
1596};
1597
1598/* 1599/*
1599 * The parsefile structure pointed to by the global variable parsefile 1600 * The parsefile structure pointed to by the global variable parsefile
1600 * contains information about the current file being read. 1601 * contains information about the current file being read.