From: Ivan Maidanski Date: Thu, 10 Jul 2014 21:03:54 +0000 (+0400) Subject: huge_test: turn GC_WORD_MAX into a signed constant X-Git-Tag: gc7_6_0~199^2~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=657034eaef6797b5aeb8a1beb311a84c65e6f314;p=gc huge_test: turn GC_WORD_MAX into a signed constant * 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. --- diff --git a/tests/huge_test.c b/tests/huge_test.c index d1d71630..c2450202 100644 --- a/tests/huge_test.c +++ b/tests/huge_test.c @@ -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;