]> granicus.if.org Git - python/commitdiff
suppress compiler warnings in _ctypes_test (#902)
authorBenjamin Peterson <benjamin@python.org>
Fri, 31 Mar 2017 11:05:25 +0000 (04:05 -0700)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 31 Mar 2017 11:05:25 +0000 (12:05 +0100)
Changed test code to suppress a compiler warning, while taking care to avoid the code being optimized out by the compiler.

Modules/_ctypes/_ctypes_test.c

index 9410c7fba84a6f156a0f66a73bbdb19eb0c30ae7..fe0015c80136f35e9b5013a2cef2c9fb080b2db4 100644 (file)
@@ -52,9 +52,9 @@ _testfunc_cbk_large_struct(Test in, void (*func)(Test))
 EXPORT(void)
 _testfunc_large_struct_update_value(Test in)
 {
-    in.first = 0x0badf00d;
-    in.second = 0x0badf00d;
-    in.third = 0x0badf00d;
+    ((volatile Test *)&in)->first = 0x0badf00d;
+    ((volatile Test *)&in)->second = 0x0badf00d;
+    ((volatile Test *)&in)->third = 0x0badf00d;
 }
 
 EXPORT(void)testfunc_array(int values[4])