Address Windows Spectre mitigation warnings
This commit is contained in:
@@ -331,18 +331,35 @@ TestFuncResult test_str8_split(void) {
|
||||
wapp_str8_substr(&str, 16, 19),
|
||||
};
|
||||
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
bool running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
bool running2 = true;
|
||||
|
||||
result = list1->node_count == count1 && list1->total_size == str.size - 3;
|
||||
result = result && list2->node_count == count2 && list2->total_size == str.size - 4;
|
||||
for (u64 i = 0; i < count1; ++i) {
|
||||
Str8Node *node = wapp_str8_list_get(list1, i);
|
||||
result = result && wapp_str8_equal(node->string, &(splits1[i]));
|
||||
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
while (running1) {
|
||||
Str8Node *node = wapp_str8_list_get(list1, index1);
|
||||
result = result && wapp_str8_equal(node->string, &(splits1[index1]));
|
||||
|
||||
++index1;
|
||||
running1 = index1 < count1;
|
||||
}
|
||||
for (u64 i = 0; i < count2; ++i) {
|
||||
Str8Node *node = wapp_str8_list_get(list2, i);
|
||||
result = result && wapp_str8_equal(node->string, &(splits2[i]));
|
||||
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
while (running2) {
|
||||
Str8Node *node = wapp_str8_list_get(list2, index2);
|
||||
result = result && wapp_str8_equal(node->string, &(splits2[index2]));
|
||||
|
||||
++index2;
|
||||
running2 = index2 < count2;
|
||||
}
|
||||
|
||||
wapp_mem_arena_allocator_destroy(&arena);
|
||||
@@ -364,12 +381,20 @@ TestFuncResult test_str8_split_with_max(void) {
|
||||
wapp_str8_substr(&str, 12, 19),
|
||||
};
|
||||
|
||||
u64 count = ARRLEN(splits);
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
bool running = true;
|
||||
|
||||
result = list->node_count == count && list->total_size == str.size - 2;
|
||||
for (u64 i = 0; i < count; ++i) {
|
||||
Str8Node *node = wapp_str8_list_get(list, i);
|
||||
result = result && wapp_str8_equal(node->string, &(splits[i]));
|
||||
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
while (running) {
|
||||
Str8Node *node = wapp_str8_list_get(list, index);
|
||||
result = result && wapp_str8_equal(node->string, &(splits[index]));
|
||||
|
||||
++index;
|
||||
running = index < count;
|
||||
}
|
||||
|
||||
wapp_mem_arena_allocator_destroy(&arena);
|
||||
@@ -398,18 +423,35 @@ TestFuncResult test_str8_rsplit(void) {
|
||||
wapp_str8_substr(&str, 16, 19),
|
||||
};
|
||||
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
bool running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
bool running2 = true;
|
||||
|
||||
result = list1->node_count == count1 && list1->total_size == str.size - 3;
|
||||
result = result && list2->node_count == count2 && list2->total_size == str.size - 4;
|
||||
for (u64 i = 0; i < count1; ++i) {
|
||||
Str8Node *node = wapp_str8_list_get(list1, i);
|
||||
result = result && wapp_str8_equal(node->string, &(splits1[i]));
|
||||
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
while (running1) {
|
||||
Str8Node *node = wapp_str8_list_get(list1, index1);
|
||||
result = result && wapp_str8_equal(node->string, &(splits1[index1]));
|
||||
|
||||
++index1;
|
||||
running1 = index1 < count1;
|
||||
}
|
||||
for (u64 i = 0; i < count2; ++i) {
|
||||
Str8Node *node = wapp_str8_list_get(list2, i);
|
||||
result = result && wapp_str8_equal(node->string, &(splits2[i]));
|
||||
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
while (running2) {
|
||||
Str8Node *node = wapp_str8_list_get(list2, index2);
|
||||
result = result && wapp_str8_equal(node->string, &(splits2[index2]));
|
||||
|
||||
++index2;
|
||||
running2 = index2 < count2;
|
||||
}
|
||||
|
||||
wapp_mem_arena_allocator_destroy(&arena);
|
||||
@@ -431,12 +473,20 @@ TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
wapp_str8_substr(&str, 17, 19),
|
||||
};
|
||||
|
||||
u64 count = ARRLEN(splits);
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
bool running = true;
|
||||
|
||||
result = list->node_count == count && list->total_size == str.size - 2;
|
||||
for (u64 i = 0; i < count; ++i) {
|
||||
Str8Node *node = wapp_str8_list_get(list, i);
|
||||
result = result && wapp_str8_equal(node->string, &(splits[i]));
|
||||
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
while (running) {
|
||||
Str8Node *node = wapp_str8_list_get(list, index);
|
||||
result = result && wapp_str8_equal(node->string, &(splits[index]));
|
||||
|
||||
++index;
|
||||
running = index < count;
|
||||
}
|
||||
|
||||
wapp_mem_arena_allocator_destroy(&arena);
|
||||
|
Reference in New Issue
Block a user