@@ -1112,20 +1112,22 @@ test_spinlock(void)
1112
1112
*/
1113
1113
#ifndef HAVE_SPINLOCKS
1114
1114
{
1115
+ uint32 i ;
1116
+
1115
1117
/*
1116
1118
* Initialize enough spinlocks to advance counter close to
1117
1119
* wraparound. It's too expensive to perform acquire/release for each,
1118
1120
* as those may be syscalls when the spinlock emulation is used (and
1119
1121
* even just atomic TAS would be expensive).
1120
1122
*/
1121
- for (uint32 i = 0 ;i < INT32_MAX - 100000 ;i ++ )
1123
+ for (i = 0 ;i < INT32_MAX - 100000 ;i ++ )
1122
1124
{
1123
1125
slock_t lock ;
1124
1126
1125
1127
SpinLockInit (& lock );
1126
1128
}
1127
1129
1128
- for (uint32 i = 0 ;i < 200000 ;i ++ )
1130
+ for (i = 0 ;i < 200000 ;i ++ )
1129
1131
{
1130
1132
slock_t lock ;
1131
1133
@@ -1161,25 +1163,26 @@ test_atomic_spin_nest(void)
1161
1163
#define NUM_TEST_ATOMICS (NUM_SPINLOCK_SEMAPHORES + NUM_ATOMICS_SEMAPHORES + 27)
1162
1164
pg_atomic_uint32 atomics32 [NUM_TEST_ATOMICS ];
1163
1165
pg_atomic_uint64 atomics64 [NUM_TEST_ATOMICS ];
1166
+ int i ;
1164
1167
1165
1168
SpinLockInit (& lock );
1166
1169
1167
- for (int i = 0 ;i < NUM_TEST_ATOMICS ;i ++ )
1170
+ for (i = 0 ;i < NUM_TEST_ATOMICS ;i ++ )
1168
1171
{
1169
1172
pg_atomic_init_u32 (& atomics32 [i ],0 );
1170
1173
pg_atomic_init_u64 (& atomics64 [i ],0 );
1171
1174
}
1172
1175
1173
1176
/* just so it's not all zeroes */
1174
- for (int i = 0 ;i < NUM_TEST_ATOMICS ;i ++ )
1177
+ for (i = 0 ;i < NUM_TEST_ATOMICS ;i ++ )
1175
1178
{
1176
1179
EXPECT_EQ_U32 (pg_atomic_fetch_add_u32 (& atomics32 [i ],i ),0 );
1177
1180
EXPECT_EQ_U64 (pg_atomic_fetch_add_u64 (& atomics64 [i ],i ),0 );
1178
1181
}
1179
1182
1180
1183
/* test whether we can do atomic op with lock held */
1181
1184
SpinLockAcquire (& lock );
1182
- for (int i = 0 ;i < NUM_TEST_ATOMICS ;i ++ )
1185
+ for (i = 0 ;i < NUM_TEST_ATOMICS ;i ++ )
1183
1186
{
1184
1187
EXPECT_EQ_U32 (pg_atomic_fetch_sub_u32 (& atomics32 [i ],i ),i );
1185
1188
EXPECT_EQ_U32 (pg_atomic_read_u32 (& atomics32 [i ]),0 );