diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2017-06-28 12:12:57 +0200 |
---|---|---|
committer | Johannes Schindelin <johannes.schindelin@gmx.de> | 2017-07-14 22:57:49 +0200 |
commit | d416bdac2fff5eed7cfa70499ff61c8b8a9ca7ce (patch) | |
tree | a80bd2acee5e59c7d97d14c1dae9c757898888b1 | |
parent | dacee10ce244e3da9f2d1f0f43a3224ab9e5d26b (diff) | |
download | busybox-w32-d416bdac2fff5eed7cfa70499ff61c8b8a9ca7ce.tar.gz busybox-w32-d416bdac2fff5eed7cfa70499ff61c8b8a9ca7ce.tar.bz2 busybox-w32-d416bdac2fff5eed7cfa70499ff61c8b8a9ca7ce.zip |
win32/regex: fix compile warnings
There are plenty of warnings that were not detected in Git's source
code, due to some warnings being turned off in Git's build by default
(even with DEVELOPER=1).
The warnings fall into three categories:
- constants being tested via `#if <name>` instead of `#ifdef <name>`
- unused function parameters
- one instance of an unnecessarily-shadowing variable
This patch fixes all of them.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
-rw-r--r-- | win32/regcomp.c | 20 | ||||
-rw-r--r-- | win32/regex.c | 2 | ||||
-rw-r--r-- | win32/regex_internal.c | 2 | ||||
-rw-r--r-- | win32/regex_internal.h | 4 |
4 files changed, 15 insertions, 13 deletions
diff --git a/win32/regcomp.c b/win32/regcomp.c index d8bde06f1..dca7e6ef3 100644 --- a/win32/regcomp.c +++ b/win32/regcomp.c | |||
@@ -18,6 +18,8 @@ | |||
18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | 18 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 | 02110-1301 USA. */ | 19 | 02110-1301 USA. */ |
20 | 20 | ||
21 | #define UNUSED_PARAM __attribute__ ((__unused__)) | ||
22 | |||
21 | static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, | 23 | static reg_errcode_t re_compile_internal (regex_t *preg, const char * pattern, |
22 | size_t length, reg_syntax_t syntax); | 24 | size_t length, reg_syntax_t syntax); |
23 | static void re_compile_fastmap_iter (regex_t *bufp, | 25 | static void re_compile_fastmap_iter (regex_t *bufp, |
@@ -542,7 +544,7 @@ weak_alias (__regcomp, regcomp) | |||
542 | from either regcomp or regexec. We don't use PREG here. */ | 544 | from either regcomp or regexec. We don't use PREG here. */ |
543 | 545 | ||
544 | size_t | 546 | size_t |
545 | regerror(int errcode, const regex_t *__restrict preg, | 547 | regerror(int errcode, UNUSED_PARAM const regex_t *__restrict preg, |
546 | char *__restrict errbuf, size_t errbuf_size) | 548 | char *__restrict errbuf, size_t errbuf_size) |
547 | { | 549 | { |
548 | const char *msg; | 550 | const char *msg; |
@@ -841,7 +843,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len) | |||
841 | { | 843 | { |
842 | unsigned int table_size; | 844 | unsigned int table_size; |
843 | #ifndef _LIBC | 845 | #ifndef _LIBC |
844 | char *codeset_name; | 846 | const char *codeset_name; |
845 | #endif | 847 | #endif |
846 | 848 | ||
847 | memset (dfa, '\0', sizeof (re_dfa_t)); | 849 | memset (dfa, '\0', sizeof (re_dfa_t)); |
@@ -1035,9 +1037,8 @@ create_initial_state (re_dfa_t *dfa) | |||
1035 | int dest_idx = dfa->edests[node_idx].elems[0]; | 1037 | int dest_idx = dfa->edests[node_idx].elems[0]; |
1036 | if (!re_node_set_contains (&init_nodes, dest_idx)) | 1038 | if (!re_node_set_contains (&init_nodes, dest_idx)) |
1037 | { | 1039 | { |
1038 | reg_errcode_t err = re_node_set_merge (&init_nodes, | 1040 | err = re_node_set_merge (&init_nodes, |
1039 | dfa->eclosures | 1041 | dfa->eclosures + dest_idx); |
1040 | + dest_idx); | ||
1041 | if (err != REG_NOERROR) | 1042 | if (err != REG_NOERROR) |
1042 | return err; | 1043 | return err; |
1043 | i = 0; | 1044 | i = 0; |
@@ -1388,7 +1389,7 @@ calc_first (void *extra, bin_tree_t *node) | |||
1388 | 1389 | ||
1389 | /* Pass 2: compute NEXT on the tree. Preorder visit. */ | 1390 | /* Pass 2: compute NEXT on the tree. Preorder visit. */ |
1390 | static reg_errcode_t | 1391 | static reg_errcode_t |
1391 | calc_next (void *extra, bin_tree_t *node) | 1392 | calc_next (UNUSED_PARAM void *extra, bin_tree_t *node) |
1392 | { | 1393 | { |
1393 | switch (node->token.type) | 1394 | switch (node->token.type) |
1394 | { | 1395 | { |
@@ -3336,8 +3337,9 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token, | |||
3336 | 3337 | ||
3337 | static reg_errcode_t | 3338 | static reg_errcode_t |
3338 | parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp, | 3339 | parse_bracket_element (bracket_elem_t *elem, re_string_t *regexp, |
3339 | re_token_t *token, int token_len, re_dfa_t *dfa, | 3340 | re_token_t *token, int token_len, |
3340 | reg_syntax_t syntax, int accept_hyphen) | 3341 | UNUSED_PARAM re_dfa_t *dfa, reg_syntax_t syntax, |
3342 | int accept_hyphen) | ||
3341 | { | 3343 | { |
3342 | #ifdef RE_ENABLE_I18N | 3344 | #ifdef RE_ENABLE_I18N |
3343 | int cur_char_size; | 3345 | int cur_char_size; |
@@ -3831,7 +3833,7 @@ free_token (re_token_t *node) | |||
3831 | and its children. */ | 3833 | and its children. */ |
3832 | 3834 | ||
3833 | static reg_errcode_t | 3835 | static reg_errcode_t |
3834 | free_tree (void *extra, bin_tree_t *node) | 3836 | free_tree (UNUSED_PARAM void *extra, bin_tree_t *node) |
3835 | { | 3837 | { |
3836 | free_token (&node->token); | 3838 | free_token (&node->token); |
3837 | return REG_NOERROR; | 3839 | return REG_NOERROR; |
diff --git a/win32/regex.c b/win32/regex.c index 95e5d757a..e40a2ea01 100644 --- a/win32/regex.c +++ b/win32/regex.c | |||
@@ -81,7 +81,7 @@ | |||
81 | #include "regexec.c" | 81 | #include "regexec.c" |
82 | 82 | ||
83 | /* Binary backward compatibility. */ | 83 | /* Binary backward compatibility. */ |
84 | #if _LIBC | 84 | #ifdef _LIBC |
85 | # include <shlib-compat.h> | 85 | # include <shlib-compat.h> |
86 | # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3) | 86 | # if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3) |
87 | link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.") | 87 | link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.") |
diff --git a/win32/regex_internal.c b/win32/regex_internal.c index d4121f2f4..c33561743 100644 --- a/win32/regex_internal.c +++ b/win32/regex_internal.c | |||
@@ -685,7 +685,7 @@ re_string_reconstruct (re_string_t *pstr, int idx, int eflags) | |||
685 | pstr->valid_len - offset); | 685 | pstr->valid_len - offset); |
686 | pstr->valid_len -= offset; | 686 | pstr->valid_len -= offset; |
687 | pstr->valid_raw_len -= offset; | 687 | pstr->valid_raw_len -= offset; |
688 | #if DEBUG | 688 | #ifdef DEBUG |
689 | assert (pstr->valid_len > 0); | 689 | assert (pstr->valid_len > 0); |
690 | #endif | 690 | #endif |
691 | } | 691 | } |
diff --git a/win32/regex_internal.h b/win32/regex_internal.h index 4184d7f5a..1495059ab 100644 --- a/win32/regex_internal.h +++ b/win32/regex_internal.h | |||
@@ -115,7 +115,7 @@ is_blank (int c) | |||
115 | #define MB_CUR_MAX 1 | 115 | #define MB_CUR_MAX 1 |
116 | #endif | 116 | #endif |
117 | 117 | ||
118 | #if (defined MBS_SUPPORT) || _LIBC | 118 | #if (defined MBS_SUPPORT) || defined _LIBC |
119 | # define RE_ENABLE_I18N | 119 | # define RE_ENABLE_I18N |
120 | #endif | 120 | #endif |
121 | 121 | ||
@@ -454,7 +454,7 @@ static unsigned int re_string_context_at (const re_string_t *input, int idx, | |||
454 | 454 | ||
455 | #ifndef _LIBC | 455 | #ifndef _LIBC |
456 | # if HAVE_ALLOCA | 456 | # if HAVE_ALLOCA |
457 | # if (_MSC_VER) | 457 | # ifdef (_MSC_VER) |
458 | # include <malloc.h> | 458 | # include <malloc.h> |
459 | # define __libc_use_alloca(n) 0 | 459 | # define __libc_use_alloca(n) 0 |
460 | # else | 460 | # else |