Fix some compile warnings

This commit is contained in:
ridiculousfish
2019-01-10 20:59:47 -08:00
parent 92d3f5f548
commit a333c2f01d
2 changed files with 11 additions and 10 deletions

View File

@@ -2166,9 +2166,10 @@ __attribute__((noinline)) void debug_thread_error(void) {
}
void set_main_thread() {
// Just call is_main_thread() once to force increment of thread_id
// We store the result as `volatile` to guarantee the function call is not optimized away
volatile bool _x = is_main_thread();
// Just call is_main_thread() once to force increment of thread_id.
bool x = is_main_thread();
assert(x && "set_main_thread should be main thread");
(void)x;
}
void configure_thread_assertions_for_testing() { thread_asserts_cfg_for_testing = true; }

View File

@@ -4420,15 +4420,15 @@ static void test_pcre2_escape() {
// all the following are intended to be ultimately matched literally - even if they don't look
// like that's the intent - so we escape them.
const wchar_t * tests[][2] = {
L".ext", L"\\.ext",
L"{word}", L"\\{word\\}",
L"hola-mundo", L"hola\\-mundo",
L"$17.42 is your total?", L"\\$17\\.42 is your total\\?",
L"not really escaped\\?", L"not really escaped\\\\\\?",
const wchar_t * const tests[][2] = {
{L".ext", L"\\.ext"},
{L"{word}", L"\\{word\\}"},
{L"hola-mundo", L"hola\\-mundo"},
{L"$17.42 is your total?", L"\\$17\\.42 is your total\\?"},
{L"not really escaped\\?", L"not really escaped\\\\\\?"},
};
for (auto &test : tests) {
for (const auto &test : tests) {
auto escaped = escape_string(test[0], 0, STRING_STYLE_REGEX);
if (escaped != test[1]) {
err(L"pcre2_escape error: pcre2_escape(%ls) -> %ls, expected %ls", test[0], escaped.c_str(), test[1]);