2009-10-01 Ivan Maidanski <ivmai@mail.ru>
authorivmai <ivmai>
Thu, 1 Oct 2009 19:23:14 +0000 (19:23 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:49 +0000 (21:06 +0400)
* tests/huge_test.c: Define GC_IGNORE_WARN (if not defined) to
suppress misleading GC "Out of Memory!" warning printed on every
GC_MALLOC(LONG_MAX) call.
* tests/huge_test.c: Include "gc.h" instead of <gc.h>.
* tests/huge_test.c (main): Replace K&R-style function definition
with the ANSI C one.
* tests/huge_test.c: Expand all tabs to spaces.

ChangeLog
tests/huge_test.c

index 46f2c88..a04ceb1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2009-10-01  Ivan Maidanski <ivmai@mail.ru>
 
+       * tests/huge_test.c: Define GC_IGNORE_WARN (if not defined) to
+       suppress misleading GC "Out of Memory!" warning printed on every
+       GC_MALLOC(LONG_MAX) call.
+       * tests/huge_test.c: Include "gc.h" instead of <gc.h>.
+       * tests/huge_test.c (main): Replace K&R-style function definition
+       with the ANSI C one.
+       * tests/huge_test.c: Expand all tabs to spaces.
+
+2009-10-01  Ivan Maidanski <ivmai@mail.ru>
+
        * dyn_load.c (GC_register_dynamic_libraries): Always use
        lpMaximumApplicationAddress value for WinCE (even for old
        versions).
index 248b1d7..5ecc831 100644 (file)
@@ -1,7 +1,16 @@
+
 #include <stdlib.h>
 #include <limits.h>
 #include <stdio.h>
-#include <gc.h>
+
+#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.                                                  */
+# define GC_IGNORE_WARN
+#endif
+
+#include "gc.h"
 
 /*
  * Check that very large allocation requests fail.  "Success" would usually
  * expected manner.
  */
 
-
-main()
+int main(void)
 {
     GC_INIT();
 
     GC_set_max_heap_size(100*1024*1024);
-       /* Otherwise heap expansion aborts when deallocating large block. */
+        /* Otherwise heap expansion aborts when deallocating large block. */
         /* That's OK.  We test this corner case mostly to make sure that  */
-        /* it fails predictably.                                         */
+        /* it fails predictably.                                          */
     GC_expand_hp(1024*1024*5);
     if (sizeof(long) == sizeof(void *)) {
         void *r = GC_MALLOC(LONG_MAX-1024);
-       if (0 != r) {
-           fprintf(stderr,
-                   "Size LONG_MAX-1024 allocation unexpectedly succeeded\n");
-           exit(1);
-       }
+        if (0 != r) {
+            fprintf(stderr,
+                    "Size LONG_MAX-1024 allocation unexpectedly succeeded\n");
+            exit(1);
+        }
         r = GC_MALLOC(LONG_MAX);
-       if (0 != r) {
-           fprintf(stderr,
-                   "Size LONG_MAX allocation unexpectedly succeeded\n");
-           exit(1);
-       }
+        if (0 != r) {
+            fprintf(stderr,
+                    "Size LONG_MAX allocation unexpectedly succeeded\n");
+            exit(1);
+        }
         r = GC_MALLOC((size_t)LONG_MAX + 1024);
-       if (0 != r) {
-           fprintf(stderr,
-                   "Size LONG_MAX+1024 allocation unexpectedly succeeded\n");
-           exit(1);
-       }
+        if (0 != r) {
+            fprintf(stderr,
+                    "Size LONG_MAX+1024 allocation unexpectedly succeeded\n");
+            exit(1);
+        }
     }
     return 0;
 }
-