STINNER Victor <vstin...@python.org> added the comment: > However, it does quiet the -Wcast-qual compiler warning that could be a > helpful addition some time in the future.
Aha, that's intesting. It helps me if I can see that your change fix a compiler warning that I can reproduce. If I build Objects/obmalloc.c with -Wcast-qual using GCC 9.2.1 (on Fedora 31), I get: Objects/obmalloc.c:2455:66: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual] 2455 | fprintf(stderr, " The %d pad bytes at tail=%p are ", SST, (void *)tail); | ^ But I get no warning for pymemallocator_eq(). About the (void *) cast, it was added by Zackery Spytz in bpo-36594: commit 1a2252ed39bc1b71cdaa935d7726d82909af93ab Author: Zackery Spytz <zsp...@gmail.com> Date: Mon May 6 10:56:51 2019 -0600 bpo-36594: Fix incorrect use of %p in format strings (GH-12769) In addition, fix some other minor violations of C99. (...) - fprintf(stderr, " The %d pad bytes at tail=%p are ", SST, tail); + fprintf(stderr, " The %d pad bytes at tail=%p are ", SST, (void *)tail); (...) Extract of the issue: """ gcc warns with -pedantic: ptr.c: In function ‘main’: ptr.c:5:13: warning: format ‘%p’ expects argument of type ‘void *’, but argument 2 has type ‘int *’ [-Wformat=] printf ("%p", &i); """ We should check that GCC doesn't emit warning with -pedantic nor -Wcast-qual, and when both flags are combined :-) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39943> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com