From b66680ad32e280b3c4286a9abfef8df5ff566ed0 Mon Sep 17 00:00:00 2001 From: Mattias EngdegÄrd Date: Fri, 17 Oct 2025 13:03:13 +0200 Subject: Disable -Wclobbered around exec_byte_code (bug#79610) * src/bytecode.c (exec_byte_code): The old hack for working around spurious -Wclobbered warnings from GCC no longer suffices; disable the warning locally. This also makes the code slightly smaller and faster. --- src/bytecode.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/bytecode.c b/src/bytecode.c index ad3844d0213..64d9e5d27c6 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -463,6 +463,14 @@ valid_sp (struct bc_thread_state *bc, Lisp_Object *sp) #define BC_REG_PC #endif +/* It seems difficult to avoid spurious -Wclobbered diagnostics from GCC + in exec_byte_code, so turn the warning off around that function. + See . */ +#if __GNUC__ && !__clang__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclobbered" +#endif + /* Execute the byte-code in FUN. ARGS_TEMPLATE is the function arity encoded as an integer (the one in FUN is ignored), and ARGS, of size NARGS, should be a vector of the actual arguments. The @@ -540,11 +548,6 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, for (ptrdiff_t i = nargs - rest; i < nonrest; i++) PUSH (Qnil); -#if GCC_LINT && __GNUC__ && !__clang__ - Lisp_Object *volatile saved_vectorp; - unsigned char const *volatile saved_bytestr_data; -#endif - while (true) { ptrdiff_t op; @@ -987,12 +990,6 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, Lisp_Object fun = fp->fun; Lisp_Object bytestr = AREF (fun, CLOSURE_CODE); Lisp_Object vector = AREF (fun, CLOSURE_CONSTANTS); -#if GCC_LINT && __GNUC__ && !__clang__ - /* These useless assignments pacify GCC 14.2.1 x86-64 - . */ - bytestr_data = saved_bytestr_data; - vectorp = saved_vectorp; -#endif bytestr_data = SDATA (bytestr); vectorp = XVECTOR (vector)->contents; if (BYTE_CODE_SAFE) @@ -1006,10 +1003,6 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, goto op_branch; } -#if GCC_LINT && __GNUC__ && !__clang__ - saved_vectorp = vectorp; - saved_bytestr_data = bytestr_data; -#endif NEXT; } @@ -1807,6 +1800,11 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, return result; } +#if __GNUC__ && !__clang__ +#pragma GCC diagnostic pop +#endif + + /* `args_template' has the same meaning as in exec_byte_code() above. */ Lisp_Object get_byte_code_arity (Lisp_Object args_template) -- cgit v1.2.1