diff options
| author | Richard Brooksby | 2012-09-20 01:08:41 +0100 |
|---|---|---|
| committer | Richard Brooksby | 2012-09-20 01:08:41 +0100 |
| commit | 6376c0dfe985a325a05a71c1a9285e50befe67c3 (patch) | |
| tree | 600dd5a437029518d5c019806b9fe989a9d2e7b4 /mps/code | |
| parent | 85f3d6bbb4e329b724ecb2e15e7f688a527d7795 (diff) | |
| download | emacs-6376c0dfe985a325a05a71c1a9285e50befe67c3.tar.gz emacs-6376c0dfe985a325a05a71c1a9285e50befe67c3.zip | |
Fixing up remaining visible warnings in xcode (all in test programs).
Expanding or removing some '@@@@' marks.
Copied from Perforce
Change: 179574
ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
| -rw-r--r-- | mps/code/abqtest.c | 12 | ||||
| -rw-r--r-- | mps/code/amcss.c | 70 | ||||
| -rw-r--r-- | mps/code/amcsshe.c | 4 | ||||
| -rw-r--r-- | mps/code/amsss.c | 34 | ||||
| -rw-r--r-- | mps/code/arena.c | 12 | ||||
| -rw-r--r-- | mps/code/fmthe.c | 14 | ||||
| -rw-r--r-- | mps/code/meter.c | 2 | ||||
| -rw-r--r-- | mps/code/mpmss.c | 2 | ||||
| -rw-r--r-- | mps/code/qs.c | 4 | ||||
| -rw-r--r-- | mps/code/sacss.c | 2 | ||||
| -rw-r--r-- | mps/code/test.c | 2 | ||||
| -rw-r--r-- | mps/code/zmess.c | 2 |
12 files changed, 80 insertions, 80 deletions
diff --git a/mps/code/abqtest.c b/mps/code/abqtest.c index 2249bcf6f4a..27288a40437 100644 --- a/mps/code/abqtest.c +++ b/mps/code/abqtest.c | |||
| @@ -36,9 +36,9 @@ static unsigned long abqRnd(unsigned long n) | |||
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | 38 | ||
| 39 | static int pushee = 1; | 39 | static unsigned pushee = 1; |
| 40 | static int popee = 1; | 40 | static unsigned popee = 1; |
| 41 | static int deleted = 0; | 41 | static unsigned deleted = 0; |
| 42 | 42 | ||
| 43 | 43 | ||
| 44 | typedef struct TestStruct *Test; | 44 | typedef struct TestStruct *Test; |
| @@ -46,7 +46,7 @@ typedef struct TestStruct *Test; | |||
| 46 | typedef struct TestStruct | 46 | typedef struct TestStruct |
| 47 | { | 47 | { |
| 48 | Test next; | 48 | Test next; |
| 49 | int id; | 49 | unsigned id; |
| 50 | CBSBlockStruct cbsBlockStruct; | 50 | CBSBlockStruct cbsBlockStruct; |
| 51 | } TestStruct; | 51 | } TestStruct; |
| 52 | 52 | ||
| @@ -65,7 +65,7 @@ static Test CBSBlockTest(CBSBlock c) | |||
| 65 | static Test testBlocks = NULL; | 65 | static Test testBlocks = NULL; |
| 66 | 66 | ||
| 67 | 67 | ||
| 68 | static CBSBlock CreateCBSBlock(int no) | 68 | static CBSBlock CreateCBSBlock(unsigned no) |
| 69 | { | 69 | { |
| 70 | Test b = malloc(sizeof(TestStruct)); | 70 | Test b = malloc(sizeof(TestStruct)); |
| 71 | cdie(b != NULL, "malloc"); | 71 | cdie(b != NULL, "malloc"); |
| @@ -133,7 +133,7 @@ static void step(void) | |||
| 133 | if (!deleted & (pushee > popee)) { | 133 | if (!deleted & (pushee > popee)) { |
| 134 | Test b; | 134 | Test b; |
| 135 | 135 | ||
| 136 | deleted = abqRnd (pushee - popee) + popee; | 136 | deleted = (unsigned)abqRnd (pushee - popee) + popee; |
| 137 | for (b = testBlocks; b != NULL; b = b->next) | 137 | for (b = testBlocks; b != NULL; b = b->next) |
| 138 | if (b->id == deleted) | 138 | if (b->id == deleted) |
| 139 | break; | 139 | break; |
diff --git a/mps/code/amcss.c b/mps/code/amcss.c index 236713cdf12..1be8d62811f 100644 --- a/mps/code/amcss.c +++ b/mps/code/amcss.c | |||
| @@ -80,44 +80,40 @@ static void report(mps_arena_t arena) | |||
| 80 | 80 | ||
| 81 | cdie(mps_message_get(&message, arena, type), "message get"); | 81 | cdie(mps_message_get(&message, arena, type), "message get"); |
| 82 | 82 | ||
| 83 | switch(type) { | 83 | if (type == mps_message_type_gc_start()) { |
| 84 | /* @@@@ is using these macros in a switch supported? */ | 84 | nCollsStart += 1; |
| 85 | case mps_message_type_gc_start(): { | 85 | printf("\n{\n Collection %d started. Because:\n", nCollsStart); |
| 86 | nCollsStart += 1; | 86 | printf(" %s\n", mps_message_gc_start_why(arena, message)); |
| 87 | printf("\n{\n Collection %d started. Because:\n", nCollsStart); | 87 | printf(" clock: %"PRIuLONGEST"\n", (ulongest_t)mps_message_clock(arena, message)); |
| 88 | printf(" %s\n", mps_message_gc_start_why(arena, message)); | 88 | |
| 89 | printf(" clock: %"PRIuLONGEST"\n", (ulongest_t)mps_message_clock(arena, message)); | 89 | } else if (type == mps_message_type_gc()) { |
| 90 | break; | 90 | size_t live, condemned, not_condemned; |
| 91 | } | 91 | |
| 92 | case mps_message_type_gc(): { | 92 | nCollsDone += 1; |
| 93 | size_t live, condemned, not_condemned; | 93 | live = mps_message_gc_live_size(arena, message); |
| 94 | 94 | condemned = mps_message_gc_condemned_size(arena, message); | |
| 95 | nCollsDone += 1; | 95 | not_condemned = mps_message_gc_not_condemned_size(arena, message); |
| 96 | live = mps_message_gc_live_size(arena, message); | 96 | |
| 97 | condemned = mps_message_gc_condemned_size(arena, message); | 97 | printf("\n Collection %d finished:\n", nCollsDone); |
| 98 | not_condemned = mps_message_gc_not_condemned_size(arena, message); | 98 | printf(" live %"PRIuLONGEST"\n", (ulongest_t)live); |
| 99 | 99 | printf(" condemned %"PRIuLONGEST"\n", (ulongest_t)condemned); | |
| 100 | printf("\n Collection %d finished:\n", nCollsDone); | 100 | printf(" not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned); |
| 101 | printf(" live %"PRIuLONGEST"\n", (ulongest_t)live); | 101 | printf(" clock: %"PRIuLONGEST"\n", (ulongest_t)mps_message_clock(arena, message)); |
| 102 | printf(" condemned %"PRIuLONGEST"\n", (ulongest_t)condemned); | 102 | printf("}\n"); |
| 103 | printf(" not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned); | 103 | |
| 104 | printf(" clock: %"PRIuLONGEST"\n", (ulongest_t)mps_message_clock(arena, message)); | 104 | if(condemned > (gen1SIZE + gen2SIZE + (size_t)128) * 1024) { |
| 105 | printf("}\n"); | 105 | /* When condemned size is larger than could happen in a gen 2 |
| 106 | 106 | * collection (discounting ramps, natch), guess that was a dynamic | |
| 107 | if(condemned > (gen1SIZE + gen2SIZE + (size_t)128) * 1024) { | 107 | * collection, and reset the commit limit, so it doesn't run out. */ |
| 108 | /* When condemned size is larger than could happen in a gen 2 | 108 | die(mps_arena_commit_limit_set(arena, 2 * testArenaSIZE), |
| 109 | * collection (discounting ramps, natch), guess that was a dynamic | 109 | "set limit"); |
| 110 | * collection, and reset the commit limit, so it doesn't run out. */ | ||
| 111 | die(mps_arena_commit_limit_set(arena, 2 * testArenaSIZE), | ||
| 112 | "set limit"); | ||
| 113 | } | ||
| 114 | break; | ||
| 115 | } | ||
| 116 | default: { | ||
| 117 | cdie(0, "unknown message type"); | ||
| 118 | break; | ||
| 119 | } | 110 | } |
| 111 | |||
| 112 | } else { | ||
| 113 | cdie(0, "unknown message type"); | ||
| 114 | break; | ||
| 120 | } | 115 | } |
| 116 | |||
| 121 | mps_message_discard(arena, message); | 117 | mps_message_discard(arena, message); |
| 122 | } | 118 | } |
| 123 | 119 | ||
| @@ -223,7 +219,7 @@ static void *test(void *arg, size_t s) | |||
| 223 | /* test mps_arena_has_addr */ | 219 | /* test mps_arena_has_addr */ |
| 224 | { | 220 | { |
| 225 | size_t hitRatio; | 221 | size_t hitRatio; |
| 226 | int hitsWanted = 4; /* aim for 4 hits (on average) */ | 222 | unsigned hitsWanted = 4; /* aim for 4 hits (on average) */ |
| 227 | /* [Note: The for-loop condition used to be "i < 4 * hitRatio", | 223 | /* [Note: The for-loop condition used to be "i < 4 * hitRatio", |
| 228 | * with "4" an unexplained naked constant. I have now labelled | 224 | * with "4" an unexplained naked constant. I have now labelled |
| 229 | * it "hitsWanted", as I think that is the intent. RHSK] | 225 | * it "hitsWanted", as I think that is the intent. RHSK] |
diff --git a/mps/code/amcsshe.c b/mps/code/amcsshe.c index 1b8d3696b88..770870cfe8b 100644 --- a/mps/code/amcsshe.c +++ b/mps/code/amcsshe.c | |||
| @@ -23,8 +23,8 @@ | |||
| 23 | #define headerFACTOR ((float)(20 + headerSIZE) / 20) | 23 | #define headerFACTOR ((float)(20 + headerSIZE) / 20) |
| 24 | /* headerFACTOR measures how much larger objects are compared to fmtdy. */ | 24 | /* headerFACTOR measures how much larger objects are compared to fmtdy. */ |
| 25 | #define testArenaSIZE ((size_t)(1000*headerFACTOR)*1024) | 25 | #define testArenaSIZE ((size_t)(1000*headerFACTOR)*1024) |
| 26 | #define gen1SIZE ((size_t)150*headerFACTOR) | 26 | #define gen1SIZE ((size_t)(150*headerFACTOR)) |
| 27 | #define gen2SIZE ((size_t)170*headerFACTOR) | 27 | #define gen2SIZE ((size_t)(170*headerFACTOR)) |
| 28 | #define avLEN 3 | 28 | #define avLEN 3 |
| 29 | #define exactRootsCOUNT 200 | 29 | #define exactRootsCOUNT 200 |
| 30 | #define ambigRootsCOUNT 50 | 30 | #define ambigRootsCOUNT 50 |
diff --git a/mps/code/amsss.c b/mps/code/amsss.c index 27d6d69d9a3..7906c8805bf 100644 --- a/mps/code/amsss.c +++ b/mps/code/amsss.c | |||
| @@ -57,30 +57,26 @@ static void report(void) | |||
| 57 | 57 | ||
| 58 | cdie(mps_message_get(&message, arena, type), "message get"); | 58 | cdie(mps_message_get(&message, arena, type), "message get"); |
| 59 | 59 | ||
| 60 | switch(type) { | 60 | if (type == mps_message_type_gc_start()) { |
| 61 | /* @@@@ is using these macros in a switch supported? */ | ||
| 62 | case mps_message_type_gc_start(): | ||
| 63 | printf("\nCollection start %d. Because:\n", ++nStart); | 61 | printf("\nCollection start %d. Because:\n", ++nStart); |
| 64 | printf("%s\n", mps_message_gc_start_why(arena, message)); | 62 | printf("%s\n", mps_message_gc_start_why(arena, message)); |
| 65 | 63 | ||
| 66 | break; | 64 | } else if (type == mps_message_type_gc()) { |
| 67 | case mps_message_type_gc(): | 65 | size_t live, condemned, not_condemned; |
| 68 | { | 66 | |
| 69 | size_t live, condemned, not_condemned; | 67 | live = mps_message_gc_live_size(arena, message); |
| 70 | 68 | condemned = mps_message_gc_condemned_size(arena, message); | |
| 71 | live = mps_message_gc_live_size(arena, message); | 69 | not_condemned = mps_message_gc_not_condemned_size(arena, message); |
| 72 | condemned = mps_message_gc_condemned_size(arena, message); | 70 | |
| 73 | not_condemned = mps_message_gc_not_condemned_size(arena, message); | 71 | printf("\nCollection complete %d:\n", ++nComplete); |
| 74 | 72 | printf("live %"PRIuLONGEST"\n", (ulongest_t)live); | |
| 75 | printf("\nCollection complete %d:\n", ++nComplete); | 73 | printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned); |
| 76 | printf("live %"PRIuLONGEST"\n", (ulongest_t)live); | 74 | printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned); |
| 77 | printf("condemned %"PRIuLONGEST"\n", (ulongest_t)condemned); | 75 | |
| 78 | printf("not_condemned %"PRIuLONGEST"\n", (ulongest_t)not_condemned); | 76 | } else { |
| 79 | } | ||
| 80 | break; | ||
| 81 | default: | ||
| 82 | cdie(0, "unknown message type"); | 77 | cdie(0, "unknown message type"); |
| 83 | } | 78 | } |
| 79 | |||
| 84 | mps_message_discard(arena, message); | 80 | mps_message_discard(arena, message); |
| 85 | } | 81 | } |
| 86 | 82 | ||
diff --git a/mps/code/arena.c b/mps/code/arena.c index e17cc3970ef..2e71a67c17c 100644 --- a/mps/code/arena.c +++ b/mps/code/arena.c | |||
| @@ -675,8 +675,16 @@ Size ArenaAvail(Arena arena) | |||
| 675 | Size sSwap; | 675 | Size sSwap; |
| 676 | 676 | ||
| 677 | sSwap = ArenaReserved(arena); | 677 | sSwap = ArenaReserved(arena); |
| 678 | if (sSwap > arena->commitLimit) sSwap = arena->commitLimit; | 678 | if (sSwap > arena->commitLimit) |
| 679 | /* @@@@ sSwap should take actual paging file size into account */ | 679 | sSwap = arena->commitLimit; |
| 680 | |||
| 681 | /* TODO: sSwap should take into account the amount of backing store | ||
| 682 | available to supply the arena with memory. This would be the amount | ||
| 683 | available in the paging file, which is possibly the amount of free | ||
| 684 | disk space in some circumstances. We'd have to see whether we can get | ||
| 685 | this information from the operating system. It also depends on the | ||
| 686 | arena class, of course. */ | ||
| 687 | |||
| 680 | return sSwap - arena->committed + arena->spareCommitted; | 688 | return sSwap - arena->committed + arena->spareCommitted; |
| 681 | } | 689 | } |
| 682 | 690 | ||
diff --git a/mps/code/fmthe.c b/mps/code/fmthe.c index ab24062d3ee..f5e1528d51e 100644 --- a/mps/code/fmthe.c +++ b/mps/code/fmthe.c | |||
| @@ -33,7 +33,7 @@ static mps_res_t dylan_header_scan(mps_ss_t mps_ss, | |||
| 33 | mps_addr_t p = base; | 33 | mps_addr_t p = base; |
| 34 | 34 | ||
| 35 | while(p < limit) { | 35 | while(p < limit) { |
| 36 | int header = *(int*)((char*)p - headerSIZE); | 36 | mps_word_t header = (mps_word_t)*(int*)((char*)p - headerSIZE); |
| 37 | switch(headerType(header)) { | 37 | switch(headerType(header)) { |
| 38 | case realTYPE: | 38 | case realTYPE: |
| 39 | assert(header == realHeader); | 39 | assert(header == realHeader); |
| @@ -63,8 +63,8 @@ static mps_res_t dylan_header_scan_weak(mps_ss_t mps_ss, | |||
| 63 | mps_res_t res; | 63 | mps_res_t res; |
| 64 | 64 | ||
| 65 | while(base < limit) { | 65 | while(base < limit) { |
| 66 | int header; | 66 | mps_word_t header; |
| 67 | header = *(int*)((char*)base - headerSIZE); | 67 | header = (mps_word_t)*(int*)((char*)base - headerSIZE); |
| 68 | switch(headerType(header)) { | 68 | switch(headerType(header)) { |
| 69 | case realTYPE: | 69 | case realTYPE: |
| 70 | assert(header == realHeader); | 70 | assert(header == realHeader); |
| @@ -90,8 +90,8 @@ static mps_res_t dylan_header_scan_weak(mps_ss_t mps_ss, | |||
| 90 | static mps_addr_t dylan_header_skip(mps_addr_t object) | 90 | static mps_addr_t dylan_header_skip(mps_addr_t object) |
| 91 | { | 91 | { |
| 92 | mps_addr_t *p; /* cursor in object */ | 92 | mps_addr_t *p; /* cursor in object */ |
| 93 | int header; | 93 | mps_word_t header; |
| 94 | header = *(int*)((char*)object - headerSIZE); | 94 | header = (mps_word_t)*(int*)((char*)object - headerSIZE); |
| 95 | switch(headerType(header)) { | 95 | switch(headerType(header)) { |
| 96 | case realTYPE: | 96 | case realTYPE: |
| 97 | assert(header == realHeader); | 97 | assert(header == realHeader); |
| @@ -111,9 +111,9 @@ static mps_addr_t dylan_header_skip(mps_addr_t object) | |||
| 111 | 111 | ||
| 112 | static mps_addr_t dylan_header_isfwd(mps_addr_t object) | 112 | static mps_addr_t dylan_header_isfwd(mps_addr_t object) |
| 113 | { | 113 | { |
| 114 | int header; | 114 | mps_word_t header; |
| 115 | 115 | ||
| 116 | header = *(int*)((char*)object - headerSIZE); | 116 | header = (mps_word_t)*(int*)((char*)object - headerSIZE); |
| 117 | if (headerType(header) != realTYPE) | 117 | if (headerType(header) != realTYPE) |
| 118 | return NULL; | 118 | return NULL; |
| 119 | 119 | ||
diff --git a/mps/code/meter.c b/mps/code/meter.c index 48f7abeb425..04f684c07f3 100644 --- a/mps/code/meter.c +++ b/mps/code/meter.c | |||
| @@ -32,7 +32,6 @@ void MeterInit(Meter meter, char *name, void *owner) | |||
| 32 | sym = EventInternString(name); | 32 | sym = EventInternString(name); |
| 33 | EventLabelAddr((Addr)meter, sym); /* see .trans.label */ | 33 | EventLabelAddr((Addr)meter, sym); /* see .trans.label */ |
| 34 | EVENT2(MeterInit, meter, owner); | 34 | EVENT2(MeterInit, meter, owner); |
| 35 | UNUSED(owner); /* @@@@ hack */ | ||
| 36 | } | 35 | } |
| 37 | 36 | ||
| 38 | 37 | ||
| @@ -100,7 +99,6 @@ void MeterEmit(Meter meter) | |||
| 100 | { | 99 | { |
| 101 | EVENT6(MeterValues, meter, meter->total, meter->meanSquared, | 100 | EVENT6(MeterValues, meter, meter->total, meter->meanSquared, |
| 102 | meter->count, meter->max, meter->min); | 101 | meter->count, meter->max, meter->min); |
| 103 | UNUSED(meter); /* @@@@ hack */ | ||
| 104 | } | 102 | } |
| 105 | 103 | ||
| 106 | 104 | ||
diff --git a/mps/code/mpmss.c b/mps/code/mpmss.c index 506c3c8c816..5c98b1da9ac 100644 --- a/mps/code/mpmss.c +++ b/mps/code/mpmss.c | |||
| @@ -59,7 +59,7 @@ static mps_res_t stress(mps_class_t class, size_t (*size)(int i), | |||
| 59 | for (k=0; k<testLOOPS; ++k) { | 59 | for (k=0; k<testLOOPS; ++k) { |
| 60 | /* shuffle all the objects */ | 60 | /* shuffle all the objects */ |
| 61 | for (i=0; i<testSetSIZE; ++i) { | 61 | for (i=0; i<testSetSIZE; ++i) { |
| 62 | int j = rnd()%(testSetSIZE-i); | 62 | unsigned j = rnd()%(unsigned)(testSetSIZE-i); |
| 63 | void *tp; | 63 | void *tp; |
| 64 | size_t ts; | 64 | size_t ts; |
| 65 | 65 | ||
diff --git a/mps/code/qs.c b/mps/code/qs.c index 2859523e9bc..8d5c011701c 100644 --- a/mps/code/qs.c +++ b/mps/code/qs.c | |||
| @@ -183,9 +183,9 @@ static void swap(void) | |||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | 185 | ||
| 186 | static void makerndlist(int l) | 186 | static void makerndlist(unsigned l) |
| 187 | { | 187 | { |
| 188 | int i; | 188 | unsigned i; |
| 189 | mps_word_t r; | 189 | mps_word_t r; |
| 190 | 190 | ||
| 191 | cdie(l > 0, "list len"); | 191 | cdie(l > 0, "list len"); |
diff --git a/mps/code/sacss.c b/mps/code/sacss.c index d8a376c4614..7fe5c368b3c 100644 --- a/mps/code/sacss.c +++ b/mps/code/sacss.c | |||
| @@ -80,7 +80,7 @@ static mps_res_t stress(mps_class_t class, | |||
| 80 | for (k = 0; k < testLOOPS; ++k) { | 80 | for (k = 0; k < testLOOPS; ++k) { |
| 81 | /* shuffle all the objects */ | 81 | /* shuffle all the objects */ |
| 82 | for (i=0; i<testSetSIZE; ++i) { | 82 | for (i=0; i<testSetSIZE; ++i) { |
| 83 | int j = rnd()%(testSetSIZE-i); | 83 | int j = (int)(rnd()%(unsigned)(testSetSIZE-i)); |
| 84 | void *tp; | 84 | void *tp; |
| 85 | size_t ts; | 85 | size_t ts; |
| 86 | 86 | ||
diff --git a/mps/code/test.c b/mps/code/test.c new file mode 100644 index 00000000000..b4eff710269 --- /dev/null +++ b/mps/code/test.c | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | extern void hello(void); | ||
| 2 | int main(void) { hello(); return 0; } | ||
diff --git a/mps/code/zmess.c b/mps/code/zmess.c index 13d2aea8fe7..6d2840f86a9 100644 --- a/mps/code/zmess.c +++ b/mps/code/zmess.c | |||
| @@ -279,7 +279,7 @@ static void testscriptC(mps_arena_t arena, const char *script) | |||
| 279 | return; | 279 | return; |
| 280 | } | 280 | } |
| 281 | } | 281 | } |
| 282 | Insist(pmNext - am < NELEMS(am)); | 282 | Insist(am <= pmNext && pmNext < am + NELEMS(am)); |
| 283 | script++; | 283 | script++; |
| 284 | } | 284 | } |
| 285 | } | 285 | } |