[Freeciv-Dev] (PR#12511) can't cast typed pointer as void* in freelog?
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12511 >
When compiling with 'strict' c99 I get some errors in freelog statements
when matching a typed pointer with a %p (void pointer) printf symbol.
I'm not sure how serious this is. I've read that when using varargs
functions you have to be very careful about your parameter types. I
suspect that NOT using a cast here could cause problems under some
"potential" c99-compliant compilers. I also suspect no such compilers
exist.
So, this patch may be applied or not. It is helpful in reducing
warnings allowing c99-pedantic compilation to continue (see PR#12478).
Also this doesn't include any client changes. The client doesn't get
very far with c99-pedantic compilation.
-jason
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.212
diff -u -r1.212 map.c
--- common/map.c 14 Mar 2005 20:26:25 -0000 1.212
+++ common/map.c 15 Mar 2005 00:41:30 -0000
@@ -493,7 +493,7 @@
void map_allocate(void)
{
freelog(LOG_DEBUG, "map_allocate (was %p) (%d,%d)",
- map.tiles, map.xsize, map.ysize);
+ (void *)map.tiles, map.xsize, map.ysize);
assert(map.tiles == NULL);
map.tiles = fc_malloc(MAP_INDEX_SIZE * sizeof(*map.tiles));
Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.59
diff -u -r1.59 cm.c
--- common/aicore/cm.c 10 Mar 2005 20:39:27 -0000 1.59
+++ common/aicore/cm.c 15 Mar 2005 00:41:30 -0000
@@ -2092,7 +2092,7 @@
{
int y, worker = cm_count_worker(pcity, result);
- freelog(LOG_NORMAL, "print_result(result=%p)", result);
+ freelog(LOG_NORMAL, "print_result(result=%p)", (void *)result);
freelog(LOG_NORMAL,
"print_result: found_a_valid=%d disorder=%d happy=%d",
result->found_a_valid, result->disorder, result->happy);
Index: common/aicore/path_finding.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/path_finding.c,v
retrieving revision 1.28
diff -u -r1.28 path_finding.c
--- common/aicore/path_finding.c 22 Jan 2005 19:45:44 -0000 1.28
+++ common/aicore/path_finding.c 15 Mar 2005 00:41:31 -0000
@@ -706,8 +706,8 @@
int i;
if (path) {
- freelog(log_level, "PF: path (at %p) consists of %d positions:", path,
- path->length);
+ freelog(log_level, "PF: path (at %p) consists of %d positions:",
+ (void *)path, path->length);
} else {
freelog(log_level, "PF: path is NULL");
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#12511) can't cast typed pointer as void* in freelog?,
Jason Short <=
|
|