diff options
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | awkgram.c | 36 | ||||
-rw-r--r-- | awkgram.y | 36 | ||||
-rw-r--r-- | dfa.c | 6 | ||||
-rw-r--r-- | ext.c | 10 | ||||
-rw-r--r-- | regex_internal.c | 7 |
6 files changed, 69 insertions, 38 deletions
@@ -1,3 +1,15 @@ +2012-02-15 Arnold D. Robbins <arnold@skeeve.com> + + Fix warnings from GCC 4.6.2 -Wall option. + + * awkgram.y (newline_eof): New function to replace body of + NEWLINE_EOF macro. + (yylex): Replace body of NEWLINE_EOF macro. + * dfa.c (parse_bracket_exp): Init variables to zero. + * ext.c (dummy, junk): Remove. + * regex_internal.c (re_string_reconstruct): Remove buf array. It was + set but not used. + 2012-02-10 Arnold D. Robbins <arnold@skeeve.com> * dfa.c: Sync with GNU grep. @@ -5470,6 +5470,32 @@ allow_newline(void) } } +/* newline_eof --- return newline or EOF as needed and adjust variables */ + +/* + * This routine used to be a macro, however GCC 4.6.2 warned about + * the result of a computation not being used. Converting to a function + * removes the warnings. + */ + +static int newline_eof() +{ + /* NB: a newline at end does not start a source line. */ + if (lasttok != NEWLINE) { + pushback(); + if (do_lint && ! eof_warned) { + lintwarn(_("source file does not end in newline")); + eof_warned = TRUE; + } + sourceline++; + return NEWLINE; + } + + sourceline--; + eof_warned = FALSE; + return LEX_EOF; +} + /* yylex --- Read the input and turn it into tokens. */ static int @@ -5487,15 +5513,7 @@ yylex(void) #define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline) - /* NB: a newline at end does not start a source line. */ - -#define NEWLINE_EOF \ - (lasttok != NEWLINE ? \ - (pushback(), do_lint && ! eof_warned && \ - (lintwarn(_("source file does not end in newline")), \ - eof_warned = TRUE), sourceline++, NEWLINE) : \ - (sourceline--, eof_warned = FALSE, LEX_EOF)) - +#define NEWLINE_EOF newline_eof() yylval = (INSTRUCTION *) NULL; if (lasttok == SUBSCRIPT) { @@ -2780,6 +2780,32 @@ allow_newline(void) } } +/* newline_eof --- return newline or EOF as needed and adjust variables */ + +/* + * This routine used to be a macro, however GCC 4.6.2 warned about + * the result of a computation not being used. Converting to a function + * removes the warnings. + */ + +static int newline_eof() +{ + /* NB: a newline at end does not start a source line. */ + if (lasttok != NEWLINE) { + pushback(); + if (do_lint && ! eof_warned) { + lintwarn(_("source file does not end in newline")); + eof_warned = TRUE; + } + sourceline++; + return NEWLINE; + } + + sourceline--; + eof_warned = FALSE; + return LEX_EOF; +} + /* yylex --- Read the input and turn it into tokens. */ static int @@ -2797,15 +2823,7 @@ yylex(void) #define GET_INSTRUCTION(op) bcalloc(op, 1, sourceline) - /* NB: a newline at end does not start a source line. */ - -#define NEWLINE_EOF \ - (lasttok != NEWLINE ? \ - (pushback(), do_lint && ! eof_warned && \ - (lintwarn(_("source file does not end in newline")), \ - eof_warned = TRUE), sourceline++, NEWLINE) : \ - (sourceline--, eof_warned = FALSE, LEX_EOF)) - +#define NEWLINE_EOF newline_eof() yylval = (INSTRUCTION *) NULL; if (lasttok == SUBSCRIPT) { @@ -876,7 +876,7 @@ static token parse_bracket_exp (void) { int invert; - int c, c1, c2; + int c = 0, c1 = 0, c2 = 0; charclass ccl; /* Used to warn about [:space:]. @@ -886,8 +886,8 @@ parse_bracket_exp (void) Bit 3 = includes ranges, char/equiv classes or collation elements. */ int colon_warning_state; - wint_t wc; - wint_t wc2; + wint_t wc = 0; + wint_t wc2 = 0; wint_t wc1 = 0; /* Work area to build a mb_char_classes. */ @@ -33,10 +33,6 @@ #include <dlfcn.h> -#ifdef __GNUC__ -static unsigned long long dummy; /* fake out gcc for dynamic loading? */ -#endif - /* do_ext --- load an extension */ NODE * @@ -54,12 +50,6 @@ do_ext(int nargs) static short warned = FALSE; #endif -#ifdef __GNUC__ - AWKNUM junk; - - junk = (AWKNUM) dummy; -#endif - if (do_sandbox) fatal(_("extensions are not allowed in sandbox mode")); diff --git a/regex_internal.c b/regex_internal.c index 0c4f8f80..d76cae2e 100644 --- a/regex_internal.c +++ b/regex_internal.c @@ -738,15 +738,8 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) mbstate_t cur_state; wchar_t wc2; int mlen = raw + pstr->len - p; - unsigned char buf[6]; size_t mbclen; - if (BE (pstr->trans != NULL, 0)) - { - int i = mlen < 6 ? mlen : 6; - while (--i >= 0) - buf[i] = pstr->trans[p[i]]; - } /* XXX Don't use mbrtowc, we know which conversion to use (UTF-8 -> UCS4). */ memset (&cur_state, 0, sizeof (cur_state)); |