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

Commite6ba705

Browse files
committed
Fix C99isms introduced when backpatching atomics / spinlock tests.
1 parent825d89d commite6ba705

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
@@ -863,20 +863,22 @@ test_spinlock(void)
863863
*/
864864
#ifndefHAVE_SPINLOCKS
865865
{
866+
uint32i;
867+
866868
/*
867869
* Initialize enough spinlocks to advance counter close to
868870
* wraparound. It's too expensive to perform acquire/release for each,
869871
* as those may be syscalls when the spinlock emulation is used (and
870872
* even just atomic TAS would be expensive).
871873
*/
872-
for (uint32i=0;i<INT32_MAX-100000;i++)
874+
for (i=0;i<INT32_MAX-100000;i++)
873875
{
874876
slock_tlock;
875877

876878
SpinLockInit(&lock);
877879
}
878880

879-
for (uint32i=0;i<200000;i++)
881+
for (i=0;i<200000;i++)
880882
{
881883
slock_tlock;
882884

@@ -912,25 +914,26 @@ test_atomic_spin_nest(void)
912914
#defineNUM_TEST_ATOMICS (NUM_SPINLOCK_SEMAPHORES + NUM_ATOMICS_SEMAPHORES + 27)
913915
pg_atomic_uint32atomics32[NUM_TEST_ATOMICS];
914916
pg_atomic_uint64atomics64[NUM_TEST_ATOMICS];
917+
inti;
915918

916919
SpinLockInit(&lock);
917920

918-
for (inti=0;i<NUM_TEST_ATOMICS;i++)
921+
for (i=0;i<NUM_TEST_ATOMICS;i++)
919922
{
920923
pg_atomic_init_u32(&atomics32[i],0);
921924
pg_atomic_init_u64(&atomics64[i],0);
922925
}
923926

924927
/* just so it's not all zeroes */
925-
for (inti=0;i<NUM_TEST_ATOMICS;i++)
928+
for (i=0;i<NUM_TEST_ATOMICS;i++)
926929
{
927930
EXPECT_EQ_U32(pg_atomic_fetch_add_u32(&atomics32[i],i),0);
928931
EXPECT_EQ_U64(pg_atomic_fetch_add_u64(&atomics64[i],i),0);
929932
}
930933

931934
/* test whether we can do atomic op with lock held */
932935
SpinLockAcquire(&lock);
933-
for (inti=0;i<NUM_TEST_ATOMICS;i++)
936+
for (i=0;i<NUM_TEST_ATOMICS;i++)
934937
{
935938
EXPECT_EQ_U32(pg_atomic_fetch_sub_u32(&atomics32[i],i),i);
936939
EXPECT_EQ_U32(pg_atomic_read_u32(&atomics32[i]),0);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp