summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorZackery Spytz <zspytz@gmail.com>2019-05-06 16:56:51 (GMT)
committerBrett Cannon <54418+brettcannon@users.noreply.github.com>2019-05-06 16:56:50 (GMT)
commit1a2252ed39bc1b71cdaa935d7726d82909af93ab (patch)
tree7a816ef20b914628f61cce377a9b245933ff6ec9 /Modules
parentae2c32f32b61f3b141ba4b0b1ad71781d2f9a1a1 (diff)
downloadcpython-1a2252ed39bc1b71cdaa935d7726d82909af93ab.zip
cpython-1a2252ed39bc1b71cdaa935d7726d82909af93ab.tar.gz
cpython-1a2252ed39bc1b71cdaa935d7726d82909af93ab.tar.bz2
bpo-36594: Fix incorrect use of %p in format strings (GH-12769)
In addition, fix some other minor violations of C99.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes_test.c8
-rw-r--r--Modules/_ctypes/callproc.c4
-rw-r--r--Modules/_xxsubinterpretersmodule.c2
-rw-r--r--Modules/hashtable.c2
4 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index f842058..bae4976 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -87,7 +87,7 @@ EXPORT(void)testfunc_array(int values[4])
EXPORT(long double)testfunc_Ddd(double a, double b)
{
long double result = (long double)(a * b);
- printf("testfunc_Ddd(%p, %p)\n", &a, &b);
+ printf("testfunc_Ddd(%p, %p)\n", (void *)&a, (void *)&b);
printf("testfunc_Ddd(%g, %g)\n", a, b);
return result;
}
@@ -95,7 +95,7 @@ EXPORT(long double)testfunc_Ddd(double a, double b)
EXPORT(long double)testfunc_DDD(long double a, long double b)
{
long double result = a * b;
- printf("testfunc_DDD(%p, %p)\n", &a, &b);
+ printf("testfunc_DDD(%p, %p)\n", (void *)&a, (void *)&b);
printf("testfunc_DDD(%Lg, %Lg)\n", a, b);
return result;
}
@@ -103,7 +103,7 @@ EXPORT(long double)testfunc_DDD(long double a, long double b)
EXPORT(int)testfunc_iii(int a, int b)
{
int result = a * b;
- printf("testfunc_iii(%p, %p)\n", &a, &b);
+ printf("testfunc_iii(%p, %p)\n", (void *)&a, (void *)&b);
return result;
}
@@ -361,7 +361,7 @@ static void _xxx_init(void *(*Xalloc)(int), void (*Xfree)(void *))
{
void *ptr;
- printf("_xxx_init got %p %p\n", Xalloc, Xfree);
+ printf("_xxx_init got %p %p\n", (void *)Xalloc, (void *)Xfree);
printf("calling\n");
ptr = Xalloc(32);
Xfree(ptr);
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c
index 1ad842e..a8ba84b 100644
--- a/Modules/_ctypes/callproc.c
+++ b/Modules/_ctypes/callproc.c
@@ -531,11 +531,11 @@ PyCArg_repr(PyCArgObject *self)
default:
if (is_literal_char((unsigned char)self->tag)) {
sprintf(buffer, "<cparam '%c' at %p>",
- (unsigned char)self->tag, self);
+ (unsigned char)self->tag, (void *)self);
}
else {
sprintf(buffer, "<cparam 0x%02x at %p>",
- (unsigned char)self->tag, self);
+ (unsigned char)self->tag, (void *)self);
}
break;
}
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index 1cf43b7..0d8e5f3 100644
--- a/Modules/_xxsubinterpretersmodule.c
+++ b/Modules/_xxsubinterpretersmodule.c
@@ -1250,7 +1250,7 @@ _channel_finish_closing(struct _channel *chan) {
// Do the things that would have been done in _channels_close().
ref->chan = NULL;
_channel_free(chan);
-};
+}
/* "high"-level channel-related functions */
diff --git a/Modules/hashtable.c b/Modules/hashtable.c
index e6f8daf..4a36a1e 100644
--- a/Modules/hashtable.c
+++ b/Modules/hashtable.c
@@ -240,7 +240,7 @@ _Py_hashtable_print_stats(_Py_hashtable_t *ht)
}
printf("hash table %p: entries=%"
PY_FORMAT_SIZE_T "u/%" PY_FORMAT_SIZE_T "u (%.0f%%), ",
- ht, ht->entries, ht->num_buckets, load * 100.0);
+ (void *)ht, ht->entries, ht->num_buckets, load * 100.0);
if (nchains)
printf("avg_chain_len=%.1f, ", (double)total_chain_len / nchains);
printf("max_chain_len=%" PY_FORMAT_SIZE_T "u, %" PY_FORMAT_SIZE_T "u KiB\n",