diff options
| author | Paul Eggert | 2014-01-02 22:47:27 -0800 |
|---|---|---|
| committer | Paul Eggert | 2014-01-02 22:47:27 -0800 |
| commit | 56a0e35287e6931759c40c581cc715d9cbb78409 (patch) | |
| tree | ff589caa626405dcef2c759c7964ca4165fdb73b /src | |
| parent | ed0ca4a51a373fc23037436ccc467a982b9fcae8 (diff) | |
| download | emacs-56a0e35287e6931759c40c581cc715d9cbb78409.tar.gz emacs-56a0e35287e6931759c40c581cc715d9cbb78409.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 14 | ||||
| -rw-r--r-- | src/data.c | 11 | ||||
| -rw-r--r-- | src/fileio.c | 4 | ||||
| -rw-r--r-- | src/fns.c | 4 | ||||
| -rw-r--r-- | src/frame.c | 3 | ||||
| -rw-r--r-- | src/lisp.h | 2 | ||||
| -rw-r--r-- | src/lread.c | 5 |
7 files changed, 33 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1f68372f31a..0a4bd05bc06 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2014-01-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Port to C89. | ||
| 4 | * data.c (arithcompare_driver): | ||
| 5 | * fileio.c (Fcar_less_than_car): | ||
| 6 | * fns.c (internal_equal): | ||
| 7 | * frame.c (delete_frame): | ||
| 8 | * lisp.h (enum More_Lisp_Bits): | ||
| 9 | * lread.c (read1): | ||
| 10 | Avoid C99 constructs that don't work in C89. | ||
| 11 | * data.c (ULL_MAX, count_trailing_zeros_ll): New macros, | ||
| 12 | to port to C89, which doesn't have 'long long'. | ||
| 13 | (count_trailing_zero_bits): Use them. | ||
| 14 | |||
| 1 | 2014-01-03 Chong Yidong <cyd@gnu.org> | 15 | 2014-01-03 Chong Yidong <cyd@gnu.org> |
| 2 | 16 | ||
| 3 | * doc.c (Fdocumentation): Remove dynamic-docstring-function. | 17 | * doc.c (Fdocumentation): Remove dynamic-docstring-function. |
diff --git a/src/data.c b/src/data.c index 10126775e79..1741f908396 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2320,7 +2320,8 @@ static Lisp_Object | |||
| 2320 | arithcompare_driver (ptrdiff_t nargs, Lisp_Object *args, | 2320 | arithcompare_driver (ptrdiff_t nargs, Lisp_Object *args, |
| 2321 | enum Arith_Comparison comparison) | 2321 | enum Arith_Comparison comparison) |
| 2322 | { | 2322 | { |
| 2323 | for (ptrdiff_t argnum = 1; argnum < nargs; ++argnum) | 2323 | ptrdiff_t argnum; |
| 2324 | for (argnum = 1; argnum < nargs; ++argnum) | ||
| 2324 | { | 2325 | { |
| 2325 | if (EQ (Qnil, arithcompare (args[argnum-1], args[argnum], comparison))) | 2326 | if (EQ (Qnil, arithcompare (args[argnum-1], args[argnum], comparison))) |
| 2326 | return Qnil; | 2327 | return Qnil; |
| @@ -2979,10 +2980,12 @@ bool_vector_spare_mask (EMACS_INT nr_bits) | |||
| 2979 | 2980 | ||
| 2980 | #if HAVE_UNSIGNED_LONG_LONG_INT | 2981 | #if HAVE_UNSIGNED_LONG_LONG_INT |
| 2981 | enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long long) }; | 2982 | enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long long) }; |
| 2983 | # define ULL_MAX ULLONG_MAX | ||
| 2982 | #else | 2984 | #else |
| 2983 | enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long) }; | 2985 | enum { BITS_PER_ULL = CHAR_BIT * sizeof (unsigned long) }; |
| 2984 | # define ULLONG_MAX ULONG_MAX | 2986 | # define ULL_MAX ULONG_MAX |
| 2985 | # define count_one_bits_ll count_one_bits_l | 2987 | # define count_one_bits_ll count_one_bits_l |
| 2988 | # define count_trailing_zeros_ll count_trailing_zeros_l | ||
| 2986 | #endif | 2989 | #endif |
| 2987 | 2990 | ||
| 2988 | /* Shift VAL right by the width of an unsigned long long. | 2991 | /* Shift VAL right by the width of an unsigned long long. |
| @@ -3140,7 +3143,7 @@ count_trailing_zero_bits (bits_word val) | |||
| 3140 | return count_trailing_zeros (val); | 3143 | return count_trailing_zeros (val); |
| 3141 | if (BITS_WORD_MAX == ULONG_MAX) | 3144 | if (BITS_WORD_MAX == ULONG_MAX) |
| 3142 | return count_trailing_zeros_l (val); | 3145 | return count_trailing_zeros_l (val); |
| 3143 | if (BITS_WORD_MAX == ULLONG_MAX) | 3146 | if (BITS_WORD_MAX == ULL_MAX) |
| 3144 | return count_trailing_zeros_ll (val); | 3147 | return count_trailing_zeros_ll (val); |
| 3145 | 3148 | ||
| 3146 | /* The rest of this code is for the unlikely platform where bits_word differs | 3149 | /* 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) | |||
| 3157 | count < BITS_PER_BITS_WORD - BITS_PER_ULL; | 3160 | count < BITS_PER_BITS_WORD - BITS_PER_ULL; |
| 3158 | count += BITS_PER_ULL) | 3161 | count += BITS_PER_ULL) |
| 3159 | { | 3162 | { |
| 3160 | if (val & ULLONG_MAX) | 3163 | if (val & ULL_MAX) |
| 3161 | return count + count_trailing_zeros_ll (val); | 3164 | return count + count_trailing_zeros_ll (val); |
| 3162 | val = shift_right_ull (val); | 3165 | val = shift_right_ull (val); |
| 3163 | } | 3166 | } |
diff --git a/src/fileio.c b/src/fileio.c index 5d8f3cb64f5..d03a2bcf02f 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -5053,7 +5053,9 @@ DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0, | |||
| 5053 | doc: /* Return t if (car A) is numerically less than (car B). */) | 5053 | doc: /* Return t if (car A) is numerically less than (car B). */) |
| 5054 | (Lisp_Object a, Lisp_Object b) | 5054 | (Lisp_Object a, Lisp_Object b) |
| 5055 | { | 5055 | { |
| 5056 | Lisp_Object args[2] = { Fcar (a), Fcar (b), }; | 5056 | Lisp_Object args[2]; |
| 5057 | args[0] = Fcar (a); | ||
| 5058 | args[1] = Fcar (b); | ||
| 5057 | return Flss (2, args); | 5059 | return Flss (2, args); |
| 5058 | } | 5060 | } |
| 5059 | 5061 | ||
| @@ -1996,7 +1996,9 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props, | |||
| 1996 | error ("Stack overflow in equal"); | 1996 | error ("Stack overflow in equal"); |
| 1997 | if (NILP (ht)) | 1997 | if (NILP (ht)) |
| 1998 | { | 1998 | { |
| 1999 | Lisp_Object args[2] = { QCtest, Qeq }; | 1999 | Lisp_Object args[2]; |
| 2000 | args[0] = QCtest; | ||
| 2001 | args[1] = Qeq; | ||
| 2000 | ht = Fmake_hash_table (2, args); | 2002 | ht = Fmake_hash_table (2, args); |
| 2001 | } | 2003 | } |
| 2002 | switch (XTYPE (o1)) | 2004 | switch (XTYPE (o1)) |
diff --git a/src/frame.c b/src/frame.c index 6024c0c5be5..76883820672 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1372,10 +1372,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force) | |||
| 1372 | 1372 | ||
| 1373 | 1373 | ||
| 1374 | { | 1374 | { |
| 1375 | struct terminal *terminal; | ||
| 1375 | block_input (); | 1376 | block_input (); |
| 1376 | if (FRAME_TERMINAL (f)->delete_frame_hook) | 1377 | if (FRAME_TERMINAL (f)->delete_frame_hook) |
| 1377 | (*FRAME_TERMINAL (f)->delete_frame_hook) (f); | 1378 | (*FRAME_TERMINAL (f)->delete_frame_hook) (f); |
| 1378 | struct terminal *terminal = FRAME_TERMINAL (f); | 1379 | terminal = FRAME_TERMINAL (f); |
| 1379 | f->output_data.nothing = 0; | 1380 | f->output_data.nothing = 0; |
| 1380 | f->terminal = 0; /* Now the frame is dead. */ | 1381 | f->terminal = 0; /* Now the frame is dead. */ |
| 1381 | unblock_input (); | 1382 | unblock_input (); |
diff --git a/src/lisp.h b/src/lisp.h index 043e5b13f6b..a7e80a41c28 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -633,7 +633,7 @@ enum More_Lisp_Bits | |||
| 633 | 633 | ||
| 634 | /* Used to extract pseudovector subtype information. */ | 634 | /* Used to extract pseudovector subtype information. */ |
| 635 | PSEUDOVECTOR_AREA_BITS = PSEUDOVECTOR_SIZE_BITS + PSEUDOVECTOR_REST_BITS, | 635 | PSEUDOVECTOR_AREA_BITS = PSEUDOVECTOR_SIZE_BITS + PSEUDOVECTOR_REST_BITS, |
| 636 | PVEC_TYPE_MASK = 0x3f << PSEUDOVECTOR_AREA_BITS, | 636 | PVEC_TYPE_MASK = 0x3f << PSEUDOVECTOR_AREA_BITS |
| 637 | }; | 637 | }; |
| 638 | 638 | ||
| 639 | /* These functions extract various sorts of values from a Lisp_Object. | 639 | /* These functions extract various sorts of values from a Lisp_Object. |
diff --git a/src/lread.c b/src/lread.c index d8d826e8e1d..dcc883b2445 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2654,9 +2654,10 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2654 | /* Accept compiled functions at read-time so that we don't have to | 2654 | /* Accept compiled functions at read-time so that we don't have to |
| 2655 | build them using function calls. */ | 2655 | build them using function calls. */ |
| 2656 | Lisp_Object tmp; | 2656 | Lisp_Object tmp; |
| 2657 | struct Lisp_Vector *vec; | ||
| 2657 | tmp = read_vector (readcharfun, 1); | 2658 | tmp = read_vector (readcharfun, 1); |
| 2658 | struct Lisp_Vector* vec = XVECTOR (tmp); | 2659 | vec = XVECTOR (tmp); |
| 2659 | if (vec->header.size==0) | 2660 | if (vec->header.size == 0) |
| 2660 | invalid_syntax ("Empty byte-code object"); | 2661 | invalid_syntax ("Empty byte-code object"); |
| 2661 | make_byte_code (vec); | 2662 | make_byte_code (vec); |
| 2662 | return tmp; | 2663 | return tmp; |