From 67940394c03450e767724a461c061921e2329bab Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 19 Apr 2022 19:02:05 -0700 Subject: [PATCH] Pacify gcc -std=c99 with printf %p MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * src/print.c (print_vectorlike): Assign pointer-to-function to void * before printing it with %p, as the C standard doesn’t bless printing function pointers with %p. --- src/print.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/print.c b/src/print.c index baf515047b4..54d8bdfa3d8 100644 --- a/src/print.c +++ b/src/print.c @@ -1701,10 +1701,10 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, case PVEC_USER_PTR: { + void *finalizer = XUSER_PTR (obj)->finalizer; print_c_string ("#p, - XUSER_PTR (obj)->finalizer); + XUSER_PTR (obj)->p, finalizer); strout (buf, i, i, printcharfun); printchar ('>', printcharfun); } @@ -1875,7 +1875,8 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, print_string (XTHREAD (obj)->name, printcharfun); else { - int len = sprintf (buf, "%p", XTHREAD (obj)); + void *p = XTHREAD (obj); + int len = sprintf (buf, "%p", p); strout (buf, len, len, printcharfun); } printchar ('>', printcharfun); @@ -1887,7 +1888,8 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, print_string (XMUTEX (obj)->name, printcharfun); else { - int len = sprintf (buf, "%p", XMUTEX (obj)); + void *p = XMUTEX (obj); + int len = sprintf (buf, "%p", p); strout (buf, len, len, printcharfun); } printchar ('>', printcharfun); @@ -1899,7 +1901,8 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag, print_string (XCONDVAR (obj)->name, printcharfun); else { - int len = sprintf (buf, "%p", XCONDVAR (obj)); + void *p = XCONDVAR (obj); + int len = sprintf (buf, "%p", p); strout (buf, len, len, printcharfun); } printchar ('>', printcharfun); -- 2.39.2