You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2022/01/07 13:55:27 UTC

svn commit: r1896803 - /apr/apr/trunk/test/testatomic.c

Author: ylavic
Date: Fri Jan  7 13:55:26 2022
New Revision: 1896803

URL: http://svn.apache.org/viewvc?rev=1896803&view=rev
Log:
testatomic: Fix gcc-11 warnings.

Not sure why it wants the "a" local variable to point to something since
we only use its pointer, but that's how it is..  While at it let's initialize
"b" too.


Modified:
    apr/apr/trunk/test/testatomic.c

Modified: apr/apr/trunk/test/testatomic.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testatomic.c?rev=1896803&r1=1896802&r2=1896803&view=diff
==============================================================================
--- apr/apr/trunk/test/testatomic.c (original)
+++ apr/apr/trunk/test/testatomic.c Fri Jan  7 13:55:26 2022
@@ -90,7 +90,7 @@ static void test_xchgptr(abts_case *tc,
 
     old_ptr = apr_atomic_xchgptr(&target_ptr, &a);
     ABTS_PTR_EQUAL(tc, ref, old_ptr);
-    ABTS_PTR_EQUAL(tc, &a, (void *) target_ptr);
+    ABTS_PTR_EQUAL(tc, (void *)&a, target_ptr);
 }
 
 static void test_cas_equal(abts_case *tc, void *data)
@@ -125,35 +125,35 @@ static void test_cas_notequal(abts_case
 
 static void test_casptr_equal(abts_case *tc, void *data)
 {
-    int a;
+    int a = 0;
     void *target_ptr = NULL;
     void *old_ptr;
 
     old_ptr = apr_atomic_casptr(&target_ptr, &a, NULL);
     ABTS_PTR_EQUAL(tc, NULL, old_ptr);
-    ABTS_PTR_EQUAL(tc, &a, (void *) target_ptr);
+    ABTS_PTR_EQUAL(tc, (void *)&a, target_ptr);
 }
 
 static void test_casptr_equal_nonnull(abts_case *tc, void *data)
 {
-    int a, b;
+    int a = 0, b = 0;
     void *target_ptr = &a;
     void *old_ptr;
 
     old_ptr = apr_atomic_casptr(&target_ptr, &b, &a);
-    ABTS_PTR_EQUAL(tc, &a, old_ptr);
-    ABTS_PTR_EQUAL(tc, &b, (void *) target_ptr);
+    ABTS_PTR_EQUAL(tc, (void *)&a, old_ptr);
+    ABTS_PTR_EQUAL(tc, (void *)&b, target_ptr);
 }
 
 static void test_casptr_notequal(abts_case *tc, void *data)
 {
-    int a, b;
+    int a = 0, b = 0;
     void *target_ptr = &a;
     void *old_ptr;
 
     old_ptr = apr_atomic_casptr(&target_ptr, &a, &b);
-    ABTS_PTR_EQUAL(tc, &a, old_ptr);
-    ABTS_PTR_EQUAL(tc, &a, (void *) target_ptr);
+    ABTS_PTR_EQUAL(tc, (void *)&a, old_ptr);
+    ABTS_PTR_EQUAL(tc, (void *)&a, target_ptr);
 }
 
 static void test_add32(abts_case *tc, void *data)