aboutsummaryrefslogtreecommitdiffstats
path: root/mps/code
diff options
context:
space:
mode:
authorRichard Brooksby2012-03-26 14:21:40 +0100
committerRichard Brooksby2012-03-26 14:21:40 +0100
commit9f897ba822dc017b6858eef2a1c3ce10d13b577a (patch)
tree251d017e7d0a1a3f788f93f17fcf8aa1271a25e3 /mps/code
parentad02c05c67c729204a2ed454b0ac8fc16746fd51 (diff)
downloademacs-9f897ba822dc017b6858eef2a1c3ce10d13b577a.tar.gz
emacs-9f897ba822dc017b6858eef2a1c3ce10d13b577a.zip
Fixing printf(var) to printf("%s", var) to suppress warnings (and improve code).
Copied from Perforce Change: 177792 ServerID: perforce.ravenbrook.com
Diffstat (limited to 'mps/code')
-rw-r--r--mps/code/locbwcss.c30
-rw-r--r--mps/code/locusss.c40
-rw-r--r--mps/code/segsmss.c14
-rw-r--r--mps/code/steptest.c4
4 files changed, 44 insertions, 44 deletions
diff --git a/mps/code/locbwcss.c b/mps/code/locbwcss.c
index 5ce042c1692..3d85576b4fc 100644
--- a/mps/code/locbwcss.c
+++ b/mps/code/locbwcss.c
@@ -31,7 +31,7 @@
31 ((size_t)((char *)(l) - (char *)(b))) 31 ((size_t)((char *)(l) - (char *)(b)))
32 32
33 33
34/* PoolStat -- maintain data about contiguous allocations */ 34/* PoolStat -- maintain data about contiguous allocations */
35 35
36typedef struct PoolStatStruct *PoolStat; 36typedef struct PoolStatStruct *PoolStat;
37 37
@@ -100,7 +100,7 @@ static void poolStatInit(PoolStat stat, mps_pool_t pool, size_t objSize)
100 s3 = allocObject(pool, objSize / 2); 100 s3 = allocObject(pool, objSize / 2);
101 recordNewObjectStat(stat, s3); 101 recordNewObjectStat(stat, s3);
102 102
103 mps_free(pool, s2, objSize / 2); 103 mps_free(pool, s2, objSize / 2);
104 recordFreedObjectStat(stat); 104 recordFreedObjectStat(stat);
105 105
106} 106}
@@ -120,7 +120,7 @@ static void allocMultiple(PoolStat stat)
120 120
121 /* free one of the objects, to make the test more interesting */ 121 /* free one of the objects, to make the test more interesting */
122 i = rnd() % allocsPerIteration; 122 i = rnd() % allocsPerIteration;
123 mps_free(stat->pool, objects[i], stat->objSize); 123 mps_free(stat->pool, objects[i], stat->objSize);
124 recordFreedObjectStat(stat); 124 recordFreedObjectStat(stat);
125 125
126} 126}
@@ -131,11 +131,11 @@ static void allocMultiple(PoolStat stat)
131static void reportResults(PoolStat stat, char *name) 131static void reportResults(PoolStat stat, char *name)
132{ 132{
133 printf("\nResults for "); 133 printf("\nResults for ");
134 printf(name); 134 fputs(name, stdout);
135 printf("\n"); 135 printf("\n");
136 printf(" Allocated %lu objects\n", (unsigned long)stat->aCount); 136 printf(" Allocated %lu objects\n", (unsigned long)stat->aCount);
137 printf(" Freed %lu objects\n", (unsigned long)stat->fCount); 137 printf(" Freed %lu objects\n", (unsigned long)stat->fCount);
138 printf(" There were %lu non-contiguous allocations\n", 138 printf(" There were %lu non-contiguous allocations\n",
139 (unsigned long)stat->ncCount); 139 (unsigned long)stat->ncCount);
140 printf(" Address range from %p to %p\n", 140 printf(" Address range from %p to %p\n",
141 (void *)stat->min, (void *)stat->max); 141 (void *)stat->min, (void *)stat->max);
@@ -152,13 +152,13 @@ static void testInArena(mps_arena_t arena)
152 PoolStat histat = &histruct; 152 PoolStat histat = &histruct;
153 int i; 153 int i;
154 154
155 die(mps_pool_create(&hipool, arena, mps_class_mvff(), 155 die(mps_pool_create(&hipool, arena, mps_class_mvff(),
156 chunkSize, chunkSize, 1024, 156 chunkSize, chunkSize, 1024,
157 TRUE, TRUE, TRUE), 157 TRUE, TRUE, TRUE),
158 "Create HI MFFV"); 158 "Create HI MFFV");
159 159
160 die(mps_pool_create(&lopool, arena, mps_class_mvff(), 160 die(mps_pool_create(&lopool, arena, mps_class_mvff(),
161 chunkSize, chunkSize, 1024, 161 chunkSize, chunkSize, 1024,
162 FALSE, FALSE, TRUE), 162 FALSE, FALSE, TRUE),
163 "Create LO MFFV"); 163 "Create LO MFFV");
164 164
@@ -174,7 +174,7 @@ static void testInArena(mps_arena_t arena)
174 /* report results */ 174 /* report results */
175 reportResults(lostat, "the low MVFF pool"); 175 reportResults(lostat, "the low MVFF pool");
176 reportResults(histat, "the high MVFF pool"); 176 reportResults(histat, "the high MVFF pool");
177 177
178 if (lostat->max > histat->min) { 178 if (lostat->max > histat->min) {
179 printf("\nFOUND PROBLEM - low range overlaps high\n"); 179 printf("\nFOUND PROBLEM - low range overlaps high\n");
180 } else if (lostat->ncCount != 0 || histat->ncCount != 0) { 180 } else if (lostat->ncCount != 0 || histat->ncCount != 0) {
@@ -210,18 +210,18 @@ int main(int argc, char **argv)
210 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>. 210 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
211 * All rights reserved. This is an open source license. Contact 211 * All rights reserved. This is an open source license. Contact
212 * Ravenbrook for commercial licensing options. 212 * Ravenbrook for commercial licensing options.
213 * 213 *
214 * Redistribution and use in source and binary forms, with or without 214 * Redistribution and use in source and binary forms, with or without
215 * modification, are permitted provided that the following conditions are 215 * modification, are permitted provided that the following conditions are
216 * met: 216 * met:
217 * 217 *
218 * 1. Redistributions of source code must retain the above copyright 218 * 1. Redistributions of source code must retain the above copyright
219 * notice, this list of conditions and the following disclaimer. 219 * notice, this list of conditions and the following disclaimer.
220 * 220 *
221 * 2. Redistributions in binary form must reproduce the above copyright 221 * 2. Redistributions in binary form must reproduce the above copyright
222 * notice, this list of conditions and the following disclaimer in the 222 * notice, this list of conditions and the following disclaimer in the
223 * documentation and/or other materials provided with the distribution. 223 * documentation and/or other materials provided with the distribution.
224 * 224 *
225 * 3. Redistributions in any form must be accompanied by information on how 225 * 3. Redistributions in any form must be accompanied by information on how
226 * to obtain complete source code for this software and any accompanying 226 * to obtain complete source code for this software and any accompanying
227 * software that uses this software. The source code must either be 227 * software that uses this software. The source code must either be
@@ -232,7 +232,7 @@ int main(int argc, char **argv)
232 * include source code for modules or files that typically accompany the 232 * include source code for modules or files that typically accompany the
233 * major components of the operating system on which the executable file 233 * major components of the operating system on which the executable file
234 * runs. 234 * runs.
235 * 235 *
236 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 236 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
237 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 237 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
238 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 238 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
diff --git a/mps/code/locusss.c b/mps/code/locusss.c
index 1b8708bd31a..bd1ab6584a6 100644
--- a/mps/code/locusss.c
+++ b/mps/code/locusss.c
@@ -32,7 +32,7 @@
32 ((size_t)((char *)(l) - (char *)(b))) 32 ((size_t)((char *)(l) - (char *)(b)))
33 33
34 34
35/* PoolStat -- maintain data about contiguous allocations */ 35/* PoolStat -- maintain data about contiguous allocations */
36 36
37typedef struct PoolStatStruct *PoolStat; 37typedef struct PoolStatStruct *PoolStat;
38 38
@@ -100,7 +100,7 @@ static void poolStatInit(PoolStat stat, mps_pool_t pool, size_t objSize)
100 s3 = allocObject(pool, objSize / 2); 100 s3 = allocObject(pool, objSize / 2);
101 recordNewObjectStat(stat, s3); 101 recordNewObjectStat(stat, s3);
102 102
103 mps_free(pool, s2, objSize / 2); 103 mps_free(pool, s2, objSize / 2);
104 recordFreedObjectStat(stat); 104 recordFreedObjectStat(stat);
105 105
106} 106}
@@ -123,7 +123,7 @@ static mps_res_t allocMultiple(PoolStat stat)
123 123
124 /* free one of the objects, to make the test more interesting */ 124 /* free one of the objects, to make the test more interesting */
125 i = rnd() % contigAllocs; 125 i = rnd() % contigAllocs;
126 mps_free(stat->pool, objects[i], stat->objSize); 126 mps_free(stat->pool, objects[i], stat->objSize);
127 recordFreedObjectStat(stat); 127 recordFreedObjectStat(stat);
128 128
129 return MPS_RES_OK; 129 return MPS_RES_OK;
@@ -135,19 +135,19 @@ static mps_res_t allocMultiple(PoolStat stat)
135static void reportResults(PoolStat stat, char *name) 135static void reportResults(PoolStat stat, char *name)
136{ 136{
137 printf("\nResults for "); 137 printf("\nResults for ");
138 printf(name); 138 printf("%s", name);
139 printf("\n"); 139 printf("\n");
140 printf(" Allocated %lu objects\n", (unsigned long)stat->aCount); 140 printf(" Allocated %lu objects\n", (unsigned long)stat->aCount);
141 printf(" Freed %lu objects\n", (unsigned long)stat->fCount); 141 printf(" Freed %lu objects\n", (unsigned long)stat->fCount);
142 printf(" There were %lu non-contiguous allocations\n", 142 printf(" There were %lu non-contiguous allocations\n",
143 (unsigned long)stat->ncCount); 143 (unsigned long)stat->ncCount);
144 printf(" Address range from %p to %p\n", stat->min, stat->max); 144 printf(" Address range from %p to %p\n", stat->min, stat->max);
145 printf("\n"); 145 printf("\n");
146} 146}
147 147
148 148
149static void testInArena(mps_arena_t arena, 149static void testInArena(mps_arena_t arena,
150 mps_bool_t failcase, 150 mps_bool_t failcase,
151 mps_bool_t usefulFailcase) 151 mps_bool_t usefulFailcase)
152{ 152{
153 mps_pool_t lopool, hipool, temppool; 153 mps_pool_t lopool, hipool, temppool;
@@ -159,17 +159,17 @@ static void testInArena(mps_arena_t arena,
159 PoolStat tempstat = &tempstruct; 159 PoolStat tempstat = &tempstruct;
160 int i; 160 int i;
161 161
162 die(mps_pool_create(&hipool, arena, mps_class_mvff(), 162 die(mps_pool_create(&hipool, arena, mps_class_mvff(),
163 chunkSize, chunkSize, 1024, 163 chunkSize, chunkSize, 1024,
164 TRUE, TRUE, TRUE), 164 TRUE, TRUE, TRUE),
165 "Create HI MFFV"); 165 "Create HI MFFV");
166 166
167 die(mps_pool_create(&lopool, arena, mps_class_mvff(), 167 die(mps_pool_create(&lopool, arena, mps_class_mvff(),
168 chunkSize, chunkSize, 1024, 168 chunkSize, chunkSize, 1024,
169 FALSE, FALSE, TRUE), 169 FALSE, FALSE, TRUE),
170 "Create LO MFFV"); 170 "Create LO MFFV");
171 171
172 die(mps_pool_create(&temppool, arena, mps_class_mv(), 172 die(mps_pool_create(&temppool, arena, mps_class_mv(),
173 chunkSize, chunkSize, chunkSize), 173 chunkSize, chunkSize, chunkSize),
174 "Create TEMP"); 174 "Create TEMP");
175 175
@@ -203,15 +203,15 @@ static void testInArena(mps_arena_t arena,
203 reportResults(lostat, "the low MVFF pool"); 203 reportResults(lostat, "the low MVFF pool");
204 reportResults(histat, "the high MVFF pool"); 204 reportResults(histat, "the high MVFF pool");
205 reportResults(tempstat, "the temp pool"); 205 reportResults(tempstat, "the temp pool");
206 206
207 mps_pool_destroy(hipool); 207 mps_pool_destroy(hipool);
208 mps_pool_destroy(lopool); 208 mps_pool_destroy(lopool);
209 mps_pool_destroy(temppool); 209 mps_pool_destroy(temppool);
210 210
211} 211}
212 212
213static void runArenaTest(size_t size, 213static void runArenaTest(size_t size,
214 mps_bool_t failcase, 214 mps_bool_t failcase,
215 mps_bool_t usefulFailcase) 215 mps_bool_t usefulFailcase)
216{ 216{
217 mps_arena_t arena; 217 mps_arena_t arena;
@@ -252,18 +252,18 @@ int main(int argc, char **argv)
252 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>. 252 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
253 * All rights reserved. This is an open source license. Contact 253 * All rights reserved. This is an open source license. Contact
254 * Ravenbrook for commercial licensing options. 254 * Ravenbrook for commercial licensing options.
255 * 255 *
256 * Redistribution and use in source and binary forms, with or without 256 * Redistribution and use in source and binary forms, with or without
257 * modification, are permitted provided that the following conditions are 257 * modification, are permitted provided that the following conditions are
258 * met: 258 * met:
259 * 259 *
260 * 1. Redistributions of source code must retain the above copyright 260 * 1. Redistributions of source code must retain the above copyright
261 * notice, this list of conditions and the following disclaimer. 261 * notice, this list of conditions and the following disclaimer.
262 * 262 *
263 * 2. Redistributions in binary form must reproduce the above copyright 263 * 2. Redistributions in binary form must reproduce the above copyright
264 * notice, this list of conditions and the following disclaimer in the 264 * notice, this list of conditions and the following disclaimer in the
265 * documentation and/or other materials provided with the distribution. 265 * documentation and/or other materials provided with the distribution.
266 * 266 *
267 * 3. Redistributions in any form must be accompanied by information on how 267 * 3. Redistributions in any form must be accompanied by information on how
268 * to obtain complete source code for this software and any accompanying 268 * to obtain complete source code for this software and any accompanying
269 * software that uses this software. The source code must either be 269 * software that uses this software. The source code must either be
@@ -274,7 +274,7 @@ int main(int argc, char **argv)
274 * include source code for modules or files that typically accompany the 274 * include source code for modules or files that typically accompany the
275 * major components of the operating system on which the executable file 275 * major components of the operating system on which the executable file
276 * runs. 276 * runs.
277 * 277 *
278 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 278 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
279 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 279 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
280 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 280 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
diff --git a/mps/code/segsmss.c b/mps/code/segsmss.c
index a02475fe5d7..83d919b9995 100644
--- a/mps/code/segsmss.c
+++ b/mps/code/segsmss.c
@@ -790,7 +790,7 @@ static void *test(void *arg, size_t s)
790 &ambigRoots[0], ambigRootsCOUNT), 790 &ambigRoots[0], ambigRootsCOUNT),
791 "root_create_table(ambig)"); 791 "root_create_table(ambig)");
792 792
793 printf(indent); 793 fputs(indent, stdout);
794 794
795 /* create an ap, and leave it busy */ 795 /* create an ap, and leave it busy */
796 die(mps_reserve(&busy_init, busy_ap, 64), "mps_reserve busy"); 796 die(mps_reserve(&busy_init, busy_ap, 64), "mps_reserve busy");
@@ -801,7 +801,7 @@ static void *test(void *arg, size_t s)
801 lastStep = totalSize; 801 lastStep = totalSize;
802 printf("\nSize %lu bytes, %lu objects.\n", 802 printf("\nSize %lu bytes, %lu objects.\n",
803 (unsigned long)totalSize, objs); 803 (unsigned long)totalSize, objs);
804 printf(indent); 804 printf("%s", indent);
805 fflush(stdout); 805 fflush(stdout);
806 for(i = 0; i < exactRootsCOUNT; ++i) 806 for(i = 0; i < exactRootsCOUNT; ++i)
807 cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]), 807 cdie(exactRoots[i] == objNULL || dylan_check(exactRoots[i]),
@@ -875,18 +875,18 @@ int main(int argc, char **argv)
875 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>. 875 * Copyright (C) 2001-2002 Ravenbrook Limited <http://www.ravenbrook.com/>.
876 * All rights reserved. This is an open source license. Contact 876 * All rights reserved. This is an open source license. Contact
877 * Ravenbrook for commercial licensing options. 877 * Ravenbrook for commercial licensing options.
878 * 878 *
879 * Redistribution and use in source and binary forms, with or without 879 * Redistribution and use in source and binary forms, with or without
880 * modification, are permitted provided that the following conditions are 880 * modification, are permitted provided that the following conditions are
881 * met: 881 * met:
882 * 882 *
883 * 1. Redistributions of source code must retain the above copyright 883 * 1. Redistributions of source code must retain the above copyright
884 * notice, this list of conditions and the following disclaimer. 884 * notice, this list of conditions and the following disclaimer.
885 * 885 *
886 * 2. Redistributions in binary form must reproduce the above copyright 886 * 2. Redistributions in binary form must reproduce the above copyright
887 * notice, this list of conditions and the following disclaimer in the 887 * notice, this list of conditions and the following disclaimer in the
888 * documentation and/or other materials provided with the distribution. 888 * documentation and/or other materials provided with the distribution.
889 * 889 *
890 * 3. Redistributions in any form must be accompanied by information on how 890 * 3. Redistributions in any form must be accompanied by information on how
891 * to obtain complete source code for this software and any accompanying 891 * to obtain complete source code for this software and any accompanying
892 * software that uses this software. The source code must either be 892 * software that uses this software. The source code must either be
@@ -897,7 +897,7 @@ int main(int argc, char **argv)
897 * include source code for modules or files that typically accompany the 897 * include source code for modules or files that typically accompany the
898 * major components of the operating system on which the executable file 898 * major components of the operating system on which the executable file
899 * runs. 899 * runs.
900 * 900 *
901 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 901 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
902 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 902 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
903 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 903 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
diff --git a/mps/code/steptest.c b/mps/code/steptest.c
index d9e6bf6fd9b..a017da67e87 100644
--- a/mps/code/steptest.c
+++ b/mps/code/steptest.c
@@ -208,7 +208,7 @@ static void print_time(char *before, double t, char *after)
208 char *x = prefixes+2; /* start at micro */ 208 char *x = prefixes+2; /* start at micro */
209 double ot = t; 209 double ot = t;
210 if (before) 210 if (before)
211 printf(before); 211 printf("%s", before);
212 if (t > MAXPRINTABLE) { 212 if (t > MAXPRINTABLE) {
213 while (x[-1] && t > MAXPRINTABLE) { 213 while (x[-1] && t > MAXPRINTABLE) {
214 t /= 1000.0; 214 t /= 1000.0;
@@ -230,7 +230,7 @@ static void print_time(char *before, double t, char *after)
230 printf("%g s", ot/1000000.0); 230 printf("%g s", ot/1000000.0);
231 } 231 }
232 if (after) 232 if (after)
233 printf(after); 233 printf("%s", after);
234} 234}
235 235
236/* Make a single Dylan object */ 236/* Make a single Dylan object */