diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | awkgram.c | 14 | ||||
-rw-r--r-- | awkgram.y | 14 |
3 files changed, 32 insertions, 6 deletions
@@ -1,3 +1,13 @@ +2015-04-05 Arnold D. Robbins <arnold@skeeve.com> + + * awkgram.y (install_builtins): If do_traditional is true, do not + install gawk extensions flagged with GAWKX. Similarly, if do_posix + is true, do not install functions flagged with NOT_POSIX. + This fixes a problem with spurious lint complaints about shadowing + a global variable that is not valid in traditional or posix mode. + Thanks to Andrew Schorr for finding the problem and supplying + initial code; I did it slightly differently. + 2015-04-02 Andrew J. Schorr <aschorr@telemetry-investments.com> * NEWS: Rename div to intdiv. @@ -8234,12 +8234,20 @@ void install_builtins(void) { int i, j; + int flags_that_must_be_clear = DEBUG_USE; + + if (do_traditional) + flags_that_must_be_clear |= GAWKX; + + if (do_posix) + flags_that_must_be_clear |= NOT_POSIX; + j = sizeof(tokentab) / sizeof(tokentab[0]); for (i = 0; i < j; i++) { - if ( (tokentab[i].class == LEX_BUILTIN - || tokentab[i].class == LEX_LENGTH) - && (tokentab[i].flags & DEBUG_USE) == 0) { + if ( (tokentab[i].class == LEX_BUILTIN + || tokentab[i].class == LEX_LENGTH) + && (tokentab[i].flags & flags_that_must_be_clear) == 0) { (void) install_symbol(tokentab[i].operator, Node_builtin_func); } } @@ -5896,12 +5896,20 @@ void install_builtins(void) { int i, j; + int flags_that_must_be_clear = DEBUG_USE; + + if (do_traditional) + flags_that_must_be_clear |= GAWKX; + + if (do_posix) + flags_that_must_be_clear |= NOT_POSIX; + j = sizeof(tokentab) / sizeof(tokentab[0]); for (i = 0; i < j; i++) { - if ( (tokentab[i].class == LEX_BUILTIN - || tokentab[i].class == LEX_LENGTH) - && (tokentab[i].flags & DEBUG_USE) == 0) { + if ( (tokentab[i].class == LEX_BUILTIN + || tokentab[i].class == LEX_LENGTH) + && (tokentab[i].flags & flags_that_must_be_clear) == 0) { (void) install_symbol(tokentab[i].operator, Node_builtin_func); } } |