diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-10-02 12:36:36 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2012-10-02 12:36:36 +0000 |
commit | 46ef45dc7a53ace0b5d2516a67aa1608d55acc89 (patch) | |
tree | a0bad600161f56bf2ca9c2e4f67055a987d3d3b6 /Build/source/texk/web2c | |
parent | 91c8ee1b966c9d886ea889e355d38e887de2711e (diff) |
chktex, pdfTeX: Avoid (most) MinGW compiler warnings from regex code
libpng: Drop distributed aclocal.m4
git-svn-id: svn://tug.org/texlive/trunk@27865 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/ChangeLog | 11 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/regex/regcomp.c | 29 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/regex/regex_internal.c | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/regex/regexec.c | 104 |
4 files changed, 62 insertions, 86 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index f9cc6792e1c..b522f7648bf 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,14 @@ +2012-10-02 Peter Breitenlohner <peb@mppmu.mpg.de> + + Avoid (most) MinGW compiler warnings from regex code. + * regcomp.c, regexec.c: ANSI C function definitions. + * regcomp.c (init_dfa): Declare codeset_name as const. + * regex_internal.c (re_string_reconstruct, re_dfa_add_node): + Avoid unused variables (for !RE_ENABLE_I18N). + * regexec.c (regexec, re_search_stub, prune_impossible_nodes): + Avoid unused variables (for !_LIBC or !RE_ENABLE_I18N). + (re_search_2_stub): Avoid cast const => non-const. + 2012-09-03 Peter Breitenlohner <peb@mppmu.mpg.de> * utils.c [WIN32] (printID): Convert file names '\\' -> '/'. diff --git a/Build/source/texk/web2c/pdftexdir/regex/regcomp.c b/Build/source/texk/web2c/pdftexdir/regex/regcomp.c index 78a1218cf86..7b50c10b0a6 100644 --- a/Build/source/texk/web2c/pdftexdir/regex/regcomp.c +++ b/Build/source/texk/web2c/pdftexdir/regex/regcomp.c @@ -211,10 +211,8 @@ const size_t __re_error_msgid_idx[] attribute_hidden = are set in BUFP on entry. */ const char * -re_compile_pattern (pattern, length, bufp) - const char *pattern; - size_t length; - struct re_pattern_buffer *bufp; +re_compile_pattern (const char *pattern, size_t length, + struct re_pattern_buffer *bufp) { reg_errcode_t ret; @@ -252,8 +250,7 @@ reg_syntax_t re_syntax_options; defined in regex.h. We return the old syntax. */ reg_syntax_t -re_set_syntax (syntax) - reg_syntax_t syntax; +re_set_syntax (reg_syntax_t syntax) { reg_syntax_t ret = re_syntax_options; @@ -265,8 +262,7 @@ weak_alias (__re_set_syntax, re_set_syntax) #endif int -re_compile_fastmap (bufp) - struct re_pattern_buffer *bufp; +re_compile_fastmap (struct re_pattern_buffer *bufp) { re_dfa_t *dfa = (re_dfa_t *) bufp->buffer; char *fastmap = bufp->fastmap; @@ -444,10 +440,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state, the return codes and their meanings.) */ int -regcomp (preg, pattern, cflags) - regex_t *__restrict preg; - const char *__restrict pattern; - int cflags; +regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags) { reg_errcode_t ret; reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED @@ -506,11 +499,8 @@ weak_alias (__regcomp, regcomp) from either regcomp or regexec. We don't use PREG here. */ size_t -regerror (errcode, preg, errbuf, errbuf_size) - int errcode; - const regex_t *__restrict preg; - char *__restrict errbuf; - size_t errbuf_size; +regerror (int errcode, const regex_t *__restrict preg, + char *__restrict errbuf, size_t errbuf_size) { const char *msg; size_t msg_size; @@ -614,8 +604,7 @@ free_dfa_content (re_dfa_t *dfa) /* Free dynamically allocated space used by PREG. */ void -regfree (preg) - regex_t *preg; +regfree (regex_t *preg) { re_dfa_t *dfa = (re_dfa_t *) preg->buffer; if (BE (dfa != NULL, 1)) @@ -810,7 +799,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) { unsigned int table_size; #ifndef _LIBC - char *codeset_name; + const char *codeset_name; #endif memset (dfa, '\0', sizeof (re_dfa_t)); diff --git a/Build/source/texk/web2c/pdftexdir/regex/regex_internal.c b/Build/source/texk/web2c/pdftexdir/regex/regex_internal.c index 66154e0ceac..64c6373d265 100644 --- a/Build/source/texk/web2c/pdftexdir/regex/regex_internal.c +++ b/Build/source/texk/web2c/pdftexdir/regex/regex_internal.c @@ -674,10 +674,10 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) } else { +#ifdef RE_ENABLE_I18N /* No, skip all characters until IDX. */ int prev_valid_len = pstr->valid_len; -#ifdef RE_ENABLE_I18N if (BE (pstr->offsets_needed, 0)) { pstr->len = pstr->raw_len - idx + offset; @@ -1396,7 +1396,9 @@ static int internal_function re_dfa_add_node (re_dfa_t *dfa, re_token_t token) { +#ifdef RE_ENABLE_I18N int type = token.type; +#endif if (BE (dfa->nodes_len >= dfa->nodes_alloc, 0)) { size_t new_nodes_alloc = dfa->nodes_alloc * 2; diff --git a/Build/source/texk/web2c/pdftexdir/regex/regexec.c b/Build/source/texk/web2c/pdftexdir/regex/regexec.c index bdfa3550a7d..a37da21f306 100644 --- a/Build/source/texk/web2c/pdftexdir/regex/regexec.c +++ b/Build/source/texk/web2c/pdftexdir/regex/regexec.c @@ -218,16 +218,14 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx) We return 0 if we find a match and REG_NOMATCH if not. */ int -regexec (preg, string, nmatch, pmatch, eflags) - const regex_t *__restrict preg; - const char *__restrict string; - size_t nmatch; - regmatch_t pmatch[]; - int eflags; +regexec (const regex_t *__restrict preg, const char *__restrict string, + size_t nmatch, regmatch_t pmatch[], int eflags) { reg_errcode_t err; int start, length; +#ifdef _LIBC re_dfa_t *dfa = (re_dfa_t *) preg->buffer; +#endif if (eflags & ~(REG_NOTBOL | REG_NOTEOL | REG_STARTEND)) return REG_BADPAT; @@ -304,11 +302,8 @@ compat_symbol (libc, __compat_regexec, regexec, GLIBC_2_0); match was found and -2 indicates an internal error. */ int -re_match (bufp, string, length, start, regs) - struct re_pattern_buffer *bufp; - const char *string; - int length, start; - struct re_registers *regs; +re_match (struct re_pattern_buffer *bufp, const char *string, int length, int start, + struct re_registers *regs) { return re_search_stub (bufp, string, length, start, 0, length, regs, 1); } @@ -317,11 +312,8 @@ weak_alias (__re_match, re_match) #endif int -re_search (bufp, string, length, start, range, regs) - struct re_pattern_buffer *bufp; - const char *string; - int length, start, range; - struct re_registers *regs; +re_search (struct re_pattern_buffer *bufp, const char *string, int length, int start, + int range, struct re_registers *regs) { return re_search_stub (bufp, string, length, start, range, length, regs, 0); } @@ -330,11 +322,9 @@ weak_alias (__re_search, re_search) #endif int -re_match_2 (bufp, string1, length1, string2, length2, start, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int length1, length2, start, stop; - struct re_registers *regs; +re_match_2 (struct re_pattern_buffer *bufp, const char *string1, int length1, + const char *string2, int length2, int start, + struct re_registers *regs, int stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, start, 0, regs, stop, 1); @@ -344,11 +334,9 @@ weak_alias (__re_match_2, re_match_2) #endif int -re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int length1, length2, start, range, stop; - struct re_registers *regs; +re_search_2 (struct re_pattern_buffer *bufp, const char *string1, int length1, + const char *string2, int length2, int start, int range, + struct re_registers *regs, int stop) { return re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, stop, 0); @@ -357,18 +345,15 @@ re_search_2 (bufp, string1, length1, string2, length2, start, range, regs, stop) weak_alias (__re_search_2, re_search_2) #endif -static int -re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, - stop, ret_len) - struct re_pattern_buffer *bufp; - const char *string1, *string2; - int length1, length2, start, range, stop, ret_len; - struct re_registers *regs; +static int internal_function +re_search_2_stub (struct re_pattern_buffer *bufp, const char *string1, int length1, + const char *string2, int length2, int start, int range, + struct re_registers *regs, int stop, int ret_len) { const char *str; int rval; int len = length1 + length2; - int free_str = 0; + char *s = NULL; if (BE (length1 < 0 || length2 < 0 || stop < 0, 0)) return -2; @@ -377,7 +362,7 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, if (length2 > 0) if (length1 > 0) { - char *s = re_malloc (char, len); + s = re_malloc (char, len); if (BE (s == NULL, 0)) return -2; @@ -388,7 +373,6 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, memcpy (s + length1, string2, length2); #endif str = s; - free_str = 1; } else str = string2; @@ -397,8 +381,8 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, rval = re_search_stub (bufp, str, len, start, range, stop, regs, ret_len); - if (free_str) - re_free ((char *) str); + if (s) + re_free (s); return rval; } @@ -407,18 +391,17 @@ re_search_2_stub (bufp, string1, length1, string2, length2, start, range, regs, If RET_LEN is nonzero the length of the match is returned (re_match style); otherwise the position of the match is returned. */ -static int -re_search_stub (bufp, string, length, start, range, stop, regs, ret_len) - struct re_pattern_buffer *bufp; - const char *string; - int length, start, range, stop, ret_len; - struct re_registers *regs; +static int internal_function +re_search_stub (struct re_pattern_buffer *bufp, const char *string, int length, + int start, int range, int stop, struct re_registers *regs, int ret_len) { reg_errcode_t result; regmatch_t *pmatch; int nregs, rval; int eflags = 0; +#ifdef _LIBC re_dfa_t *dfa = (re_dfa_t *) bufp->buffer; +#endif /* Check for out-of-range. */ if (BE (start < 0 || start > length, 0)) @@ -496,11 +479,8 @@ re_search_stub (bufp, string, length, start, range, stop, regs, ret_len) return rval; } -static unsigned -re_copy_regs (regs, pmatch, nregs, regs_allocated) - struct re_registers *regs; - regmatch_t *pmatch; - int nregs, regs_allocated; +static unsigned internal_function +re_copy_regs (struct re_registers *regs, regmatch_t *pmatch, int nregs, int regs_allocated) { int rval = REGS_REALLOCATE; int i; @@ -566,11 +546,8 @@ re_copy_regs (regs, pmatch, nregs, regs_allocated) freeing the old data. */ void -re_set_registers (bufp, regs, num_regs, starts, ends) - struct re_pattern_buffer *bufp; - struct re_registers *regs; - unsigned num_regs; - regoff_t *starts, *ends; +re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs, + unsigned num_regs, regoff_t *starts, regoff_t *ends) { if (num_regs) { @@ -616,14 +593,10 @@ re_exec (s) Note: We assume front end functions already check ranges. (START + RANGE >= 0 && START + RANGE <= LENGTH) */ -static reg_errcode_t -re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, - eflags) - const regex_t *preg; - const char *string; - int length, start, range, stop, eflags; - size_t nmatch; - regmatch_t pmatch[]; +static reg_errcode_t internal_function +re_search_internal (const regex_t *preg, const char *string, int length, int start, + int range, int stop, size_t nmatch, regmatch_t pmatch[], + int eflags) { reg_errcode_t err; const re_dfa_t *dfa = (const re_dfa_t *) preg->buffer; @@ -935,9 +908,8 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, return err; } -static reg_errcode_t -prune_impossible_nodes (mctx) - re_match_context_t *mctx; +static reg_errcode_t internal_function +prune_impossible_nodes (re_match_context_t *mctx) { const re_dfa_t *const dfa = mctx->dfa; int halt_node, match_last; @@ -3032,7 +3004,9 @@ check_arrival_add_next_nodes (re_match_context_t *mctx, int str_idx, const re_dfa_t *const dfa = mctx->dfa; int result; int cur_idx; +#ifdef RE_ENABLE_I18N reg_errcode_t err = REG_NOERROR; +#endif re_node_set union_set; re_node_set_init_empty (&union_set); for (cur_idx = 0; cur_idx < cur_nodes->nelem; ++cur_idx) |