* lisp.h (WAIT_READING_MAX): New macro.
* dispnew.c (Fsleep_for, sit_for):
* keyboard.c (kbd_buffer_get_event):
* process.c (Faccept_process_output):
Use it to avoid bogus compiler warnings with obsolescent GCC versions.
This improves on the previous patch, which introduced a bug
when time_t is unsigned and as wide as intmax_t.
See <http://bugs.gnu.org/9000#51>.
+2012-06-24 Paul Eggert <eggert@cs.ucla.edu>
+
+ Fix bug when time_t is unsigned and as wide as intmax_t (Bug#9000).
+ * lisp.h (WAIT_READING_MAX): New macro.
+ * dispnew.c (Fsleep_for, sit_for):
+ * keyboard.c (kbd_buffer_get_event):
+ * process.c (Faccept_process_output):
+ Use it to avoid bogus compiler warnings with obsolescent GCC versions.
+ This improves on the previous patch, which introduced a bug
+ when time_t is unsigned and as wide as intmax_t.
+ See <http://bugs.gnu.org/9000#51>.
+
2012-06-23 Eli Zaretskii <eliz@gnu.org>
* dispnew.c (sit_for, Fsleep_for):
if (0 < duration)
{
EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (duration);
- intmax_t secs = EMACS_SECS (t);
-
- wait_reading_process_output (min (secs, INTMAX_MAX),
+ wait_reading_process_output (min (EMACS_SECS (t), WAIT_READING_MAX),
EMACS_NSECS (t), 0, 0, Qnil, NULL, 0);
}
else
{
EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (seconds);
- sec = EMACS_SECS (t);
- sec = min (sec, INTMAX_MAX);
+ sec = min (EMACS_SECS (t), WAIT_READING_MAX);
nsec = EMACS_NSECS (t);
}
}
return Qnil; /* finished waiting */
else
{
- intmax_t secs;
-
EMACS_SUB_TIME (duration, *end_time, duration);
- secs = EMACS_SECS (duration);
- wait_reading_process_output (min (secs, INTMAX_MAX),
+ wait_reading_process_output (min (EMACS_SECS (duration),
+ WAIT_READING_MAX),
EMACS_NSECS (duration),
-1, 1, Qnil, NULL, 0);
}
Lisp_Object,
struct Lisp_Process *,
int);
+/* Max value for the first argument of wait_reading_process_output. */
+#if __GNUC__ == 3 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5)
+/* Work around a bug in GCC 3.4.2, known to be fixed in GCC 4.6.3.
+ The bug merely causes a bogus warning, but the warning is annoying. */
+# define WAIT_READING_MAX min (TYPE_MAXIMUM (time_t), INTMAX_MAX)
+#else
+# define WAIT_READING_MAX INTMAX_MAX
+#endif
extern void add_keyboard_wait_descriptor (int);
extern void delete_keyboard_wait_descriptor (int);
#ifdef HAVE_GPM
if (0 < XFLOAT_DATA (seconds))
{
EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (XFLOAT_DATA (seconds));
-
- secs = EMACS_SECS (t);
- secs = min (secs, INTMAX_MAX);
+ secs = min (EMACS_SECS (t), WAIT_READING_MAX);
nsecs = EMACS_NSECS (t);
}
}