emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r115856: Port to C89.


From: Paul Eggert
Subject: [Emacs-diffs] trunk r115856: Port to C89.
Date: Fri, 03 Jan 2014 06:47:36 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115856
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2014-01-02 22:47:27 -0800
message:
  Port to C89.
  
  * data.c (arithcompare_driver):
  * fileio.c (Fcar_less_than_car):
  * fns.c (internal_equal):
  * frame.c (delete_frame):
  * lisp.h (enum More_Lisp_Bits):
  * lread.c (read1):
  Avoid C99 constructs that don't work in C89.
  * data.c (ULL_MAX, count_trailing_zeros_ll): New macros,
  to port to C89, which doesn't have 'long long'.
  (count_trailing_zero_bits): Use them.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/data.c                     data.c-20091113204419-o5vbwnq5f7feedwu-251
  src/fileio.c                   fileio.c-20091113204419-o5vbwnq5f7feedwu-210
  src/fns.c                      fns.c-20091113204419-o5vbwnq5f7feedwu-203
  src/frame.c                    frame.c-20091113204419-o5vbwnq5f7feedwu-243
  src/lisp.h                     lisp.h-20091113204419-o5vbwnq5f7feedwu-253
  src/lread.c                    lread.c-20091113204419-o5vbwnq5f7feedwu-266
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-01-03 05:37:58 +0000
+++ b/src/ChangeLog     2014-01-03 06:47:27 +0000
@@ -1,3 +1,17 @@
+2014-01-03  Paul Eggert  <address@hidden>
+
+       Port to C89.
+       * data.c (arithcompare_driver):
+       * fileio.c (Fcar_less_than_car):
+       * fns.c (internal_equal):
+       * frame.c (delete_frame):
+       * lisp.h (enum More_Lisp_Bits):
+       * lread.c (read1):
+       Avoid C99 constructs that don't work in C89.
+       * data.c (ULL_MAX, count_trailing_zeros_ll): New macros,
+       to port to C89, which doesn't have 'long long'.
+       (count_trailing_zero_bits): Use them.
+
 2014-01-03  Chong Yidong  <address@hidden>
 
        * doc.c (Fdocumentation): Remove dynamic-docstring-function.

=== modified file 'src/data.c'
--- a/src/data.c        2014-01-01 07:43:34 +0000
+++ b/src/data.c        2014-01-03 06:47:27 +0000
@@ -2320,7 +2320,8 @@
 arithcompare_driver (ptrdiff_t nargs, Lisp_Object *args,
                      enum Arith_Comparison comparison)
 {
-  for (ptrdiff_t argnum = 1; argnum < nargs; ++argnum)
+  ptrdiff_t argnum;
+  for (argnum = 1; argnum < nargs; ++argnum)
     {
       if (EQ (Qnil, arithcompare (args[argnum-1], args[argnum], comparison)))
         return Qnil;
@@ -2979,10 +2980,12 @@
 
 #if HAVE_UNSIGNED_LONG_LONG_INT
 enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long long) };
+# define ULL_MAX ULLONG_MAX
 #else
 enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long) };
-# define ULLONG_MAX ULONG_MAX
+# define ULL_MAX ULONG_MAX
 # define count_one_bits_ll count_one_bits_l
+# define count_trailing_zeros_ll count_trailing_zeros_l
 #endif
 
 /* Shift VAL right by the width of an unsigned long long.
@@ -3140,7 +3143,7 @@
     return count_trailing_zeros (val);
   if (BITS_WORD_MAX == ULONG_MAX)
     return count_trailing_zeros_l (val);
-  if (BITS_WORD_MAX == ULLONG_MAX)
+  if (BITS_WORD_MAX == ULL_MAX)
     return count_trailing_zeros_ll (val);
 
   /* The rest of this code is for the unlikely platform where bits_word differs
@@ -3157,7 +3160,7 @@
           count < BITS_PER_BITS_WORD - BITS_PER_ULL;
           count += BITS_PER_ULL)
        {
-         if (val & ULLONG_MAX)
+         if (val & ULL_MAX)
            return count + count_trailing_zeros_ll (val);
          val = shift_right_ull (val);
        }

=== modified file 'src/fileio.c'
--- a/src/fileio.c      2014-01-01 17:44:48 +0000
+++ b/src/fileio.c      2014-01-03 06:47:27 +0000
@@ -5053,7 +5053,9 @@
        doc: /* Return t if (car A) is numerically less than (car B).  */)
   (Lisp_Object a, Lisp_Object b)
 {
-  Lisp_Object args[2] = { Fcar (a), Fcar (b), };
+  Lisp_Object args[2];
+  args[0] = Fcar (a);
+  args[1] = Fcar (b);
   return Flss (2, args);
 }
 

=== modified file 'src/fns.c'
--- a/src/fns.c 2014-01-01 07:43:34 +0000
+++ b/src/fns.c 2014-01-03 06:47:27 +0000
@@ -1996,7 +1996,9 @@
        error ("Stack overflow in equal");
       if (NILP (ht))
        {
-         Lisp_Object args[2] = { QCtest, Qeq };
+         Lisp_Object args[2];
+         args[0] = QCtest;
+         args[1] = Qeq;
          ht = Fmake_hash_table (2, args);
        }
       switch (XTYPE (o1))

=== modified file 'src/frame.c'
--- a/src/frame.c       2014-01-02 15:58:48 +0000
+++ b/src/frame.c       2014-01-03 06:47:27 +0000
@@ -1372,10 +1372,11 @@
 
 
   {
+    struct terminal *terminal;
     block_input ();
     if (FRAME_TERMINAL (f)->delete_frame_hook)
       (*FRAME_TERMINAL (f)->delete_frame_hook) (f);
-    struct terminal *terminal = FRAME_TERMINAL (f);
+    terminal = FRAME_TERMINAL (f);
     f->output_data.nothing = 0;
     f->terminal = 0;             /* Now the frame is dead.  */
     unblock_input ();

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2014-01-01 19:27:41 +0000
+++ b/src/lisp.h        2014-01-03 06:47:27 +0000
@@ -633,7 +633,7 @@
 
     /* Used to extract pseudovector subtype information.  */
     PSEUDOVECTOR_AREA_BITS = PSEUDOVECTOR_SIZE_BITS + PSEUDOVECTOR_REST_BITS,
-    PVEC_TYPE_MASK = 0x3f << PSEUDOVECTOR_AREA_BITS,
+    PVEC_TYPE_MASK = 0x3f << PSEUDOVECTOR_AREA_BITS
   };
 
 /* These functions extract various sorts of values from a Lisp_Object.

=== modified file 'src/lread.c'
--- a/src/lread.c       2014-01-01 23:13:59 +0000
+++ b/src/lread.c       2014-01-03 06:47:27 +0000
@@ -2654,9 +2654,10 @@
          /* Accept compiled functions at read-time so that we don't have to
             build them using function calls.  */
          Lisp_Object tmp;
+         struct Lisp_Vector *vec;
          tmp = read_vector (readcharfun, 1);
-         struct Lisp_Vector* vec = XVECTOR (tmp);
-         if (vec->header.size==0)
+         vec = XVECTOR (tmp);
+         if (vec->header.size == 0)
            invalid_syntax ("Empty byte-code object");
          make_byte_code (vec);
          return tmp;


reply via email to

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