test-csum: Avoid "cast increases required alignment of target type" warning.
authorBen Pfaff <blp@nicira.com>
Tue, 24 May 2011 18:04:22 +0000 (11:04 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 26 May 2011 16:03:05 +0000 (09:03 -0700)
Casting a character pointer to uint16_t * or uint32_t * provokes this
warning on sparc.  There is no actual problem, because all of the accesses
to data occurs through calls to the get_unaligned_*() functions, so this
commit suppresses the warning by using "void *" as an intermediate type.

tests/test-csum.c

index 81f54b809200d71b8d7e8b8901a5355c5fb91db6..86de43095e9cb6605a664ce179b77e85dc4b92f1 100644 (file)
@@ -140,8 +140,9 @@ main(void)
     int i;
 
     for (tc = test_cases; tc < &test_cases[ARRAY_SIZE(test_cases)]; tc++) {
-        const ovs_be16 *data16 = (OVS_FORCE const ovs_be16 *) tc->data;
-        const ovs_be32 *data32 = (OVS_FORCE const ovs_be32 *) tc->data;
+        const void *data = tc->data;
+        const ovs_be16 *data16 = (OVS_FORCE const ovs_be16 *) data;
+        const ovs_be32 *data32 = (OVS_FORCE const ovs_be32 *) data;
         uint32_t partial;
 
         /* Test csum(). */