From e7a333f18e96fc88d98e574be5c8e355efa96c36 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 23 May 2026 18:48:45 -0700 Subject: [PATCH] EVENT_INIT via a compound literal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This pacifies GCC 16.1.1 x86-64 -Warray-bounds when compiling with -fsanitize=address. It’s also cleaner on more-typical platforms. * src/termhooks.h (EVENT_INIT): Define via a compound literal rather than via a memset plus an assignment. This evaluates the argument lvalue only once, and is more likely to catch type errors. --- src/termhooks.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/termhooks.h b/src/termhooks.h index 38c9df9cad2..ebac777ab4c 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -411,8 +411,7 @@ struct input_event Lisp_Object device; }; -#define EVENT_INIT(event) (memset (&(event), 0, sizeof (struct input_event)), \ - (event).device = Qt) +#define EVENT_INIT(event) ((event) = (struct input_event) {.device = Qt}) /* Bits in the modifiers member of the input_event structure. Note that reorder_modifiers assumes that the bits are in canonical