]> granicus.if.org Git - gc/commitdiff
huge_test: turn GC_WORD_MAX into a signed constant
authorIvan Maidanski <ivmai@mail.ru>
Thu, 10 Jul 2014 21:03:54 +0000 (01:03 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 11 May 2015 15:57:24 +0000 (18:57 +0300)
* tests/huge_test.c (GC_IGNORE_WARN): Refine comment.
* tests/huge_test.c (GC_WORD_MAX): Replace with GC_SWORD_MAX; change
type to GC_signed_word.

tests/huge_test.c

index d1d71630b0fa91b313a6d1091e5691cae41f099c..c2450202ce5fcad36053e168e3c88fb6a70e5b6f 100644 (file)
@@ -5,8 +5,8 @@
 
 #ifndef GC_IGNORE_WARN
   /* Ignore misleading "Out of Memory!" warning (which is printed on    */
-  /* every GC_MALLOC(LONG_MAX) call) by defining this macro before      */
-  /* "gc.h" inclusion.                                                  */
+  /* every GC_MALLOC call below) by defining this macro before "gc.h"   */
+  /* inclusion.                                                         */
 # define GC_IGNORE_WARN
 #endif
 
@@ -19,7 +19,7 @@
  * expected manner.
  */
 
-#define GC_WORD_MAX (((GC_word)-1) >> 1)
+#define GC_SWORD_MAX ((GC_signed_word)(((GC_word)-1) >> 1))
 
 int main(void)
 {
@@ -31,22 +31,22 @@ int main(void)
         /* That's OK.  We test this corner case mostly to make sure that  */
         /* it fails predictably.                                          */
     GC_expand_hp(1024*1024*5);
-    r = GC_MALLOC(GC_WORD_MAX - 1024);
+    r = GC_MALLOC(GC_SWORD_MAX - 1024);
     if (NULL != r) {
         fprintf(stderr,
-                "Size GC_WORD_MAX-1024 allocation unexpectedly succeeded\n");
+                "Size SWORD_MAX-1024 allocation unexpectedly succeeded\n");
         exit(1);
     }
-    r = GC_MALLOC(GC_WORD_MAX);
+    r = GC_MALLOC(GC_SWORD_MAX);
     if (NULL != r) {
         fprintf(stderr,
-                "Size GC_WORD_MAX allocation unexpectedly succeeded\n");
+                "Size SWORD_MAX allocation unexpectedly succeeded\n");
         exit(1);
     }
-    r = GC_MALLOC(GC_WORD_MAX + 1024);
+    r = GC_MALLOC((GC_word)GC_SWORD_MAX + 1024);
     if (NULL != r) {
         fprintf(stderr,
-                "Size GC_WORD_MAX+1024 allocation unexpectedly succeeded\n");
+                "Size SWORD_MAX+1024 allocation unexpectedly succeeded\n");
         exit(1);
     }
     return 0;