From: Paul Eggert Date: Wed, 20 Apr 2022 02:02:05 +0000 (-0700) Subject: Pacify gcc -std=c99 with printf %p X-Git-Tag: emacs-29.0.90~1931^2~397 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=67940394c03450e767724a461c061921e2329bab;p=emacs.git Pacify gcc -std=c99 with printf %p * 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. --- 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);