summaryrefslogtreecommitdiff
path: root/src/keyboard.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c91
1 files changed, 47 insertions, 44 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index ffb90c56f4a..f36243dd442 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -88,11 +88,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include TERM_HEADER
#endif /* HAVE_WINDOW_SYSTEM */
-/* Work around GCC bug 54561. */
-#if GNUC_PREREQ (4, 3, 0)
-# pragma GCC diagnostic ignored "-Wclobbered"
-#endif
-
#ifdef WINDOWSNT
char const DEV_TTY[] = "CONOUT$";
#else
@@ -2522,7 +2517,7 @@ read_char (int commandflag, Lisp_Object map,
Lisp_Object prev_event,
bool *used_mouse_menu, struct timespec *end_time)
{
- volatile Lisp_Object c;
+ Lisp_Object c;
sys_jmp_buf local_getcjmp;
sys_jmp_buf save_jump;
Lisp_Object tem, save;
@@ -2668,8 +2663,7 @@ read_char (int commandflag, Lisp_Object map,
swallow_events (false); /* May clear input_pending. */
/* Redisplay if no pending input. */
- while (!(input_pending
- && (input_was_pending || !redisplay_dont_pause)))
+ while (!(input_pending && input_was_pending))
{
input_was_pending = input_pending;
if (help_echo_showing_p && !BASE_EQ (selected_window, minibuf_window))
@@ -2757,8 +2751,10 @@ read_char (int commandflag, Lisp_Object map,
it *must not* be in effect when we call redisplay. */
specpdl_ref jmpcount = SPECPDL_INDEX ();
+ Lisp_Object volatile c_volatile = c;
if (sys_setjmp (local_getcjmp))
{
+ c = c_volatile;
/* Handle quits while reading the keyboard. */
/* We must have saved the outer value of getcjmp here,
so restore it now. */
@@ -2803,6 +2799,12 @@ read_char (int commandflag, Lisp_Object map,
goto non_reread;
}
+#if GCC_LINT && __GNUC__ && !__clang__
+ /* This useless assignment pacifies GCC 14.2.1 x86-64
+ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21161>. */
+ c = c_volatile;
+#endif
+
/* Start idle timers if no time limit is supplied. We don't do it
if a time limit is supplied to avoid an infinite recursion in the
situation where an idle timer calls `sit-for'. */
@@ -2964,6 +2966,8 @@ read_char (int commandflag, Lisp_Object map,
}
reread = true;
}
+
+ c_volatile = c;
}
/* Read something from current KBOARD's side queue, if possible. */
@@ -2975,6 +2979,7 @@ read_char (int commandflag, Lisp_Object map,
if (!CONSP (KVAR (current_kboard, kbd_queue)))
emacs_abort ();
c = XCAR (KVAR (current_kboard, kbd_queue));
+ c_volatile = c;
kset_kbd_queue (current_kboard,
XCDR (KVAR (current_kboard, kbd_queue)));
if (NILP (KVAR (current_kboard, kbd_queue)))
@@ -3030,6 +3035,8 @@ read_char (int commandflag, Lisp_Object map,
c = XCDR (c);
recorded = true;
}
+
+ c_volatile = c;
}
non_reread:
@@ -3113,7 +3120,7 @@ read_char (int commandflag, Lisp_Object map,
d = Faref (KVAR (current_kboard, Vkeyboard_translate_table), c);
/* nil in keyboard-translate-table means no translation. */
if (!NILP (d))
- c = d;
+ c_volatile = c = d;
}
}
@@ -3153,6 +3160,7 @@ read_char (int commandflag, Lisp_Object map,
Vunread_command_events = Fcons (c, Vunread_command_events);
}
c = posn;
+ c_volatile = c;
}
}
@@ -3278,6 +3286,7 @@ read_char (int commandflag, Lisp_Object map,
}
/* It returned one event or more. */
c = XCAR (tem);
+ c_volatile = c;
Vunread_post_input_method_events
= nconc2 (XCDR (tem), Vunread_post_input_method_events);
}
@@ -3352,6 +3361,7 @@ read_char (int commandflag, Lisp_Object map,
do
{
c = read_char (0, Qnil, Qnil, 0, NULL);
+ c_volatile = c;
if (EVENT_HAS_PARAMETERS (c)
&& EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_click))
XSETCAR (help_form_saved_window_configs, Qnil);
@@ -3365,7 +3375,7 @@ read_char (int commandflag, Lisp_Object map,
{
cancel_echoing ();
do
- c = read_char (0, Qnil, Qnil, 0, NULL);
+ c_volatile = c = read_char (0, Qnil, Qnil, 0, NULL);
while (BUFFERP (c));
}
}
@@ -4646,20 +4656,21 @@ timer_resume_idle (void)
...). Each element has the form (FUN . ARGS). */
Lisp_Object pending_funcalls;
-/* Return true if TIMER is a valid timer, placing its value into *RESULT. */
-static bool
-decode_timer (Lisp_Object timer, struct timespec *result)
+/* Return the value of TIMER if it is a valid timer, an invalid struct
+ timespec otherwise. */
+static struct timespec
+decode_timer (Lisp_Object timer)
{
Lisp_Object *vec;
if (! (VECTORP (timer) && ASIZE (timer) == 10))
- return false;
+ return invalid_timespec ();
vec = XVECTOR (timer)->contents;
if (! NILP (vec[0]))
- return false;
+ return invalid_timespec ();
if (! FIXNUMP (vec[2]))
- return false;
- return list4_to_timespec (vec[1], vec[2], vec[3], vec[8], result);
+ return invalid_timespec ();
+ return list4_to_timespec (vec[1], vec[2], vec[3], vec[8]);
}
@@ -4678,15 +4689,6 @@ decode_timer (Lisp_Object timer, struct timespec *result)
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))
{
@@ -4695,18 +4697,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 ();
- while (CONSP (timers) || CONSP (idle_timers))
+ 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));
+
+ do
{
- Lisp_Object timer = Qnil, idle_timer = Qnil;
- struct timespec timer_time, idle_timer_time;
+ 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 ();
@@ -4720,7 +4722,8 @@ timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers)
if (CONSP (timers))
{
timer = XCAR (timers);
- if (! decode_timer (timer, &timer_time))
+ struct timespec timer_time = decode_timer (timer);
+ if (! timespec_valid_p (timer_time))
{
timers = XCDR (timers);
continue;
@@ -4737,7 +4740,8 @@ timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers)
if (CONSP (idle_timers))
{
idle_timer = XCAR (idle_timers);
- if (! decode_timer (idle_timer, &idle_timer_time))
+ struct timespec idle_timer_time = decode_timer (idle_timer);
+ if (! timespec_valid_p (idle_timer_time))
{
idle_timers = XCDR (idle_timers);
continue;
@@ -4808,8 +4812,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,
@@ -4818,10 +4821,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 ();
}
@@ -5411,7 +5414,7 @@ static const char *const lispy_kana_keys[] =
/* You'll notice that this table is arranged to be conveniently
indexed by X Windows keysym values. */
-#ifdef HAVE_NS
+#if defined HAVE_NS || !defined HAVE_WINDOW_SYSTEM
/* FIXME: Why are we using X11 keysym values for NS? */
static
#endif
@@ -7712,7 +7715,7 @@ This function potentially generates an artificial switch-frame event. */)
if (!EQ (CAR_SAFE (event), Qfocus_in) ||
!CONSP (XCDR (event)) ||
!FRAMEP ((frame = XCAR (XCDR (event)))))
- error ("invalid focus-in event");
+ error ("Invalid focus-in event");
/* Conceptually, the concept of window manager focus on a particular
frame and the Emacs selected frame shouldn't be related, but for