]> git.eshelyaron.com Git - emacs.git/commitdiff
Port to C89.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 3 Jan 2014 06:47:27 +0000 (22:47 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 3 Jan 2014 06:47:27 +0000 (22:47 -0800)
* 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.

src/ChangeLog
src/data.c
src/fileio.c
src/fns.c
src/frame.c
src/lisp.h
src/lread.c

index 1f68372f31a1d836b62aecdc87702732a0a51610..0a4bd05bc06a933982591326dbbfa9ac07d16e60 100644 (file)
@@ -1,3 +1,17 @@
+2014-01-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <cyd@gnu.org>
 
        * doc.c (Fdocumentation): Remove dynamic-docstring-function.
index 10126775e79a16db34b3901ba742360d2975dec9..1741f9083966ae425342439e5cb99a9013ef6bef 100644 (file)
@@ -2320,7 +2320,8 @@ static Lisp_Object
 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 @@ bool_vector_spare_mask (EMACS_INT nr_bits)
 
 #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 @@ count_trailing_zero_bits (bits_word val)
     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_trailing_zero_bits (bits_word val)
           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);
        }
index 5d8f3cb64f57265cb9c9bf56364da904559af14f..d03a2bcf02f9c1a793d2b6a089097c20c23f4977 100644 (file)
@@ -5053,7 +5053,9 @@ DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
        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);
 }
 
index 4c082aa84e2baceaf778281825869d11b5103052..bc5331358a47242a91313e7815db0d059741aa4e 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -1996,7 +1996,9 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props,
        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))
index 6024c0c5be5e6949bf755ea89552ad2dc907bd7c..76883820672223331d96872ca50fd8949ff8c76f 100644 (file)
@@ -1372,10 +1372,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
 
 
   {
+    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 ();
index 043e5b13f6b3cb5d87d0be9af806a806d7dac65a..a7e80a41c28321cd436f231e6796ef7d13012a02 100644 (file)
@@ -633,7 +633,7 @@ enum More_Lisp_Bits
 
     /* 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
   };
 \f
 /* These functions extract various sorts of values from a Lisp_Object.
index d8d826e8e1d7642d76002ec0e63318ff783127d8..dcc883b2445d12fa224c4e1e52941268c4cc8bc4 100644 (file)
@@ -2654,9 +2654,10 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
          /* 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;