From: Paul Eggert Date: Sun, 14 Jul 2024 19:53:28 +0000 (+0100) Subject: Pacify 32-bit GCC 14.1.1 in timer_check_2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=360cfc1701fcbe6d0e2d10d42820a3bd81a1c07c;p=emacs.git Pacify 32-bit GCC 14.1.1 in timer_check_2 * src/keyboard.c (timer_check_2): Refactor to make flow control more obvious, to pacify -Wanalyzer-use-of-uninitialized-value with gcc 14.1.1 20240607 (Red Hat 14.1.1-5) on i686. (cherry picked from commit 31517e81d0d8562e222d4b0de399915df956099f) --- diff --git a/src/keyboard.c b/src/keyboard.c index 8f65378a850..2b5b6eb3b8a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4679,15 +4679,6 @@ decode_timer (Lisp_Object timer) static struct timespec timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers) { - struct timespec nexttime; - struct timespec now; - struct timespec idleness_now; - Lisp_Object chosen_timer; - - nexttime = invalid_timespec (); - - chosen_timer = Qnil; - /* First run the code that was delayed. */ while (CONSP (pending_funcalls)) { @@ -4696,17 +4687,18 @@ timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers) safe_calln (Qapply, XCAR (funcall), XCDR (funcall)); } - if (CONSP (timers) || CONSP (idle_timers)) - { - now = current_timespec (); - idleness_now = (timespec_valid_p (timer_idleness_start_time) - ? timespec_sub (now, timer_idleness_start_time) - : make_timespec (0, 0)); - } + if (! (CONSP (timers) || CONSP (idle_timers))) + return invalid_timespec (); + + struct timespec + now = current_timespec (), + idleness_now = (timespec_valid_p (timer_idleness_start_time) + ? timespec_sub (now, timer_idleness_start_time) + : make_timespec (0, 0)); - while (CONSP (timers) || CONSP (idle_timers)) + do { - Lisp_Object timer = Qnil, idle_timer = Qnil; + Lisp_Object chosen_timer, timer = Qnil, idle_timer = Qnil; struct timespec difference; struct timespec timer_difference = invalid_timespec (); struct timespec idle_timer_difference = invalid_timespec (); @@ -4810,8 +4802,7 @@ timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers) return 0 to indicate that. */ } - nexttime = make_timespec (0, 0); - break; + return make_timespec (0, 0); } else /* When we encounter a timer that is still waiting, @@ -4820,10 +4811,10 @@ timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers) return difference; } } + while (CONSP (timers) || CONSP (idle_timers)); /* No timers are pending in the future. */ - /* Return 0 if we generated an event, and -1 if not. */ - return nexttime; + return invalid_timespec (); }