emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108714: Fix bug when time_t is un


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108714: Fix bug when time_t is unsigned and as wide as intmax_t.
Date: Fri, 02 Nov 2012 01:45:49 -0000
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108714
fixes bug: http://debbugs.gnu.org/9000
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sat 2012-06-23 21:11:19 -0700
message:
  Fix bug when time_t is unsigned and as wide as intmax_t.
  
  * 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>.
modified:
  src/ChangeLog
  src/dispnew.c
  src/keyboard.c
  src/lisp.h
  src/process.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-06-23 19:40:50 +0000
+++ b/src/ChangeLog     2012-06-24 04:11:19 +0000
@@ -1,3 +1,15 @@
+2012-06-24  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        * dispnew.c (sit_for, Fsleep_for):

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2012-06-23 19:40:50 +0000
+++ b/src/dispnew.c     2012-06-24 04:11:19 +0000
@@ -5957,9 +5957,7 @@
   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);
     }
 
@@ -6007,8 +6005,7 @@
       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);
        }
     }

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2012-06-23 19:40:50 +0000
+++ b/src/keyboard.c    2012-06-24 04:11:19 +0000
@@ -3857,11 +3857,9 @@
            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);
            }

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-06-22 21:17:42 +0000
+++ b/src/lisp.h        2012-06-24 04:11:19 +0000
@@ -3249,6 +3249,14 @@
                                         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

=== modified file 'src/process.c'
--- a/src/process.c     2012-06-23 19:40:50 +0000
+++ b/src/process.c     2012-06-24 04:11:19 +0000
@@ -3996,9 +3996,7 @@
          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);
            }
        }


reply via email to

[Prev in Thread] Current Thread [Next in Thread]