]> granicus.if.org Git - gc/commitdiff
Specify GC_malloc result is unused in some tests
authorIvan Maidanski <ivmai@mail.ru>
Fri, 19 Oct 2012 03:27:29 +0000 (07:27 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Fri, 19 Oct 2012 10:27:57 +0000 (14:27 +0400)
* tests/middle.c (main): Explicitly cast result of GC_malloc[_atomic]
to void (to outline that the result is unused intentionally).
* tests/test.c (run_one_test): Likewise.

tests/middle.c
tests/test.c

index ff0a2355d1597fee9fbff6b3b6558821a4053f26..55686f759ccc334194fafd9484a96eb16a885274 100644 (file)
@@ -13,12 +13,12 @@ int main (void)
   GC_INIT();
 
   for (i = 0; i < 20000; ++i) {
-    GC_malloc_atomic (4096);
-    GC_malloc (4096);
+    (void)GC_malloc_atomic(4096);
+    (void)GC_malloc(4096);
   }
   for (i = 0; i < 20000; ++i) {
-    GC_malloc_atomic (2048);
-    GC_malloc (2048);
+    (void)GC_malloc_atomic(2048);
+    (void)GC_malloc(2048);
   }
   printf("Final heap size is %lu\n", (unsigned long)GC_get_heap_size());
   return 0;
index e4d6af4026358eebf88c680065fd3085d8f2c982..0cb1d56943fc5cf6e050269be6f018f99495750b 100644 (file)
@@ -1201,7 +1201,7 @@ void run_one_test(void)
         {
           size_t i;
 
-          GC_malloc(17);
+          (void)GC_malloc(17);
           for (i = sizeof(GC_word); i < 512; i *= 2) {
             GC_word result = (GC_word) GC_memalign(i, 17);
             if (result % i != 0 || result == 0 || *(int *)result != 0) FAIL;
@@ -1234,9 +1234,9 @@ void run_one_test(void)
         {
            size_t i;
            for (i = 0; i < 10000; ++i) {
-             GC_MALLOC(0);
+             (void)GC_MALLOC(0);
              GC_FREE(GC_MALLOC(0));
-             GC_MALLOC_ATOMIC(0);
+             (void)GC_MALLOC_ATOMIC(0);
              GC_FREE(GC_MALLOC_ATOMIC(0));
            }
          }