test-pthread: prevent compiler warnings

.../repos/libports/src/test/pthread/main.cc:539:76: warning: ‘++’ expression of ‘volatile’-qualified type is deprecated [-Wvolatile]
.../repos/libports/src/test/pthread/main.cc:1104:32: warning: ‘test’ may be used uninitialized [-Wmaybe-uninitialized]
This commit is contained in:
Christian Helmuth 2024-09-04 15:16:29 +02:00
parent ce4f0cdd18
commit 505cd5e338

View File

@ -536,7 +536,7 @@ struct Test_mutex_stress
} }
/* stay in mutex for some time */ /* stay in mutex for some time */
for (unsigned volatile d = 0; d < 30000; ++d) ; for (unsigned volatile d = 0; d < 30000; ) d = d + 3;
if (MUTEX_TYPE == PTHREAD_MUTEX_RECURSIVE) { if (MUTEX_TYPE == PTHREAD_MUTEX_RECURSIVE) {
_unlock(); _unlock();
@ -1099,7 +1099,7 @@ static bool key_destructor_func_called = false;
static void test_tls_data() static void test_tls_data()
{ {
int test; int test = 0;
if (pthread_setspecific(key, &test) != 0) { if (pthread_setspecific(key, &test) != 0) {
Genode::error("pthread_setspecific() failed"); Genode::error("pthread_setspecific() failed");