Fix two compiler warnings from clang when only one code unit width is

supported.
This commit is contained in:
Philip.Hazel 2016-06-22 10:41:05 +00:00
parent 149456dce0
commit 5f5e7f6fb2
2 changed files with 9 additions and 4 deletions

View File

@ -154,6 +154,9 @@ the same line" - but it was already over the end.
39. Allow \C in lookbehinds and DFA matching in UTF-32 mode (by converting it 39. Allow \C in lookbehinds and DFA matching in UTF-32 mode (by converting it
to the same code as '.' when PCRE2_DOTALL is set). to the same code as '.' when PCRE2_DOTALL is set).
40. Fix two clang compiler warnings in pcre2test when only one code unit width
is supported.
Version 10.21 12-January-2016 Version 10.21 12-January-2016
----------------------------- -----------------------------

View File

@ -3754,6 +3754,10 @@ show_memory_info(void)
uint32_t name_count, name_entry_size; uint32_t name_count, name_entry_size;
size_t size, cblock_size; size_t size, cblock_size;
/* One of the test_mode values will always be true, but to stop a compiler
warning we must initialize cblock_size. */
cblock_size = 0;
#ifdef SUPPORT_PCRE2_8 #ifdef SUPPORT_PCRE2_8
if (test_mode == 8) cblock_size = sizeof(pcre2_real_code_8); if (test_mode == 8) cblock_size = sizeof(pcre2_real_code_8);
#endif #endif
@ -4856,9 +4860,7 @@ if ((pat_patctl.control & (CTL_PUSH|CTL_PUSHCOPY)) != 0)
/* Convert the input in non-8-bit modes. */ /* Convert the input in non-8-bit modes. */
#ifdef SUPPORT_PCRE2_8 errorcode = 0;
if (test_mode == PCRE8_MODE) errorcode = 0;
#endif
#ifdef SUPPORT_PCRE2_16 #ifdef SUPPORT_PCRE2_16
if (test_mode == PCRE16_MODE) errorcode = to16(pbuffer8, utf, &patlen); if (test_mode == PCRE16_MODE) errorcode = to16(pbuffer8, utf, &patlen);
@ -7383,7 +7385,7 @@ if (arg_error != NULL)
default: default:
printf("Unexpected return (%d) from pcre2_get_error_message()", len); printf("Unexpected return (%d) from pcre2_get_error_message()", len);
break; break;
} }
} }
else else
{ {