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.
This commit is contained in:
Paul Eggert 2014-01-02 22:47:27 -08:00
parent ed0ca4a51a
commit 56a0e35287
7 changed files with 33 additions and 10 deletions

View 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.

View 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);
}

View 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);
}

View file

@ -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))

View 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 ();

View 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
};
/* These functions extract various sorts of values from a Lisp_Object.

View 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;