diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/parser.c | 5 | ||||
-rw-r--r-- | src/system.h | 6 |
3 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index d52c521..7fba27f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ * Test __GLIBC__ instead of _GNU_SOURCE. * Restored warning when getcwd fails. * Set default exvwarning2 arg0 for errors during early initialisation. + * Use uninitialized_var to silence bogus warnings. 2008-05-02 Herbert Xu <herbert@gondor.apana.org.au> diff --git a/src/parser.c b/src/parser.c index 32ed044..e891d31 100644 --- a/src/parser.c +++ b/src/parser.c @@ -851,7 +851,8 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) int parenlevel; /* levels of parens in arithmetic */ int dqvarnest; /* levels of variables expansion within double quotes */ int oldstyle; - char const *prevsyntax; /* syntax before arithmetic */ + /* syntax before arithmetic */ + char const *uninitialized_var(prevsyntax); startlinno = plinno; dblquote = 0; @@ -1285,7 +1286,7 @@ parsebackq: { union node *n; char *str; size_t savelen; - int saveprompt; + int uninitialized_var(saveprompt); str = NULL; savelen = out - (char *)stackblock(); diff --git a/src/system.h b/src/system.h index b8853e6..17a9533 100644 --- a/src/system.h +++ b/src/system.h @@ -97,3 +97,9 @@ static inline int killpg(pid_t pid, int signal) #define _SC_CLK_TCK 2 long sysconf(int) __attribute__((__noreturn__)); #endif + +/* + * A trick to suppress uninitialized variable warning without generating any + * code + */ +#define uninitialized_var(x) x = x |