Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5e4beae

Browse files
committed
Fix C99isms introduced when backpatching atomics / spinlock tests.
1 parentc2a84be commit5e4beae

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎src/test/regress/regress.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,20 +1112,22 @@ test_spinlock(void)
11121112
*/
11131113
#ifndefHAVE_SPINLOCKS
11141114
{
1115+
uint32i;
1116+
11151117
/*
11161118
* Initialize enough spinlocks to advance counter close to
11171119
* wraparound. It's too expensive to perform acquire/release for each,
11181120
* as those may be syscalls when the spinlock emulation is used (and
11191121
* even just atomic TAS would be expensive).
11201122
*/
1121-
for (uint32i=0;i<INT32_MAX-100000;i++)
1123+
for (i=0;i<INT32_MAX-100000;i++)
11221124
{
11231125
slock_tlock;
11241126

11251127
SpinLockInit(&lock);
11261128
}
11271129

1128-
for (uint32i=0;i<200000;i++)
1130+
for (i=0;i<200000;i++)
11291131
{
11301132
slock_tlock;
11311133

@@ -1161,25 +1163,26 @@ test_atomic_spin_nest(void)
11611163
#defineNUM_TEST_ATOMICS (NUM_SPINLOCK_SEMAPHORES + NUM_ATOMICS_SEMAPHORES + 27)
11621164
pg_atomic_uint32atomics32[NUM_TEST_ATOMICS];
11631165
pg_atomic_uint64atomics64[NUM_TEST_ATOMICS];
1166+
inti;
11641167

11651168
SpinLockInit(&lock);
11661169

1167-
for (inti=0;i<NUM_TEST_ATOMICS;i++)
1170+
for (i=0;i<NUM_TEST_ATOMICS;i++)
11681171
{
11691172
pg_atomic_init_u32(&atomics32[i],0);
11701173
pg_atomic_init_u64(&atomics64[i],0);
11711174
}
11721175

11731176
/* just so it's not all zeroes */
1174-
for (inti=0;i<NUM_TEST_ATOMICS;i++)
1177+
for (i=0;i<NUM_TEST_ATOMICS;i++)
11751178
{
11761179
EXPECT_EQ_U32(pg_atomic_fetch_add_u32(&atomics32[i],i),0);
11771180
EXPECT_EQ_U64(pg_atomic_fetch_add_u64(&atomics64[i],i),0);
11781181
}
11791182

11801183
/* test whether we can do atomic op with lock held */
11811184
SpinLockAcquire(&lock);
1182-
for (inti=0;i<NUM_TEST_ATOMICS;i++)
1185+
for (i=0;i<NUM_TEST_ATOMICS;i++)
11831186
{
11841187
EXPECT_EQ_U32(pg_atomic_fetch_sub_u32(&atomics32[i],i),i);
11851188
EXPECT_EQ_U32(pg_atomic_read_u32(&atomics32[i]),0);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp