aboutsummaryrefslogtreecommitdiffstats
path: root/src/lisp.h
diff options
context:
space:
mode:
authorPaul Eggert2013-12-14 13:36:44 -0800
committerPaul Eggert2013-12-14 13:36:44 -0800
commit96c0686368d8b7d481cb40239db896ff37df416a (patch)
tree84d8ee02271476dd4aaaee52c5302f2c576089ef /src/lisp.h
parent5ae811ddef14ea1989088c259a9ed2d14d5332b4 (diff)
downloademacs-96c0686368d8b7d481cb40239db896ff37df416a.tar.gz
emacs-96c0686368d8b7d481cb40239db896ff37df416a.zip
Use bool for boolean, focusing on headers.
* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK): Use bool for boolean. * lib-src/emacsclient.c, lib-src/etags.c, lib-src/hexl.c (FALSE, TRUE): Remove. All uses replaced with uncapitalized version. * lib-src/emacsclient.c (message): * lib-src/etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names): * lib-src/hexl.c (un_flag, iso_flag, endian): * lib-src/pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next) (pop_trash): Use bool for boolean. * lib-src/etags.c (bool): Remove. * lib-src/etags.c (globals, members, declarations, no_line_directive) (no_duplicates): Use 'int' for boolean values that getopt requires to be 'int'. Formerly, these were 'bool' and 'bool' was 'int', but we can no longer rely on this implementation. * lib-src/pop.h (struct _popserver): Use bool_bf for boolean bit-fields. * lwlib/xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields. * src/atimer.h, src/lisp.h, src/syssignal.h, src/syswait.h, src/unexelf.c: No need to include <stdbool.h>, since conf_post.h does it now. * src/buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION) (BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P) (SET_PER_BUFFER_VALUE_P): * src/ccl.c, src/ccl.h (setup_ccl_program): * src/ccl.h (CHECK_CCL_PROGRAM): * src/character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR) (CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY) (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE) (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE) (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE) (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH) (DEC_BOTH, BUF_INC_POS, BUF_DEC_POS): * src/charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID) (CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET) (CHARSET_FAST_MAP_SET): * src/coding.c (decode_coding_ccl, encode_coding_ccl): * src/coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC) (CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2) (JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE) (ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8) (decode_coding_c_string): * src/composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE): * src/conf_post.h (has_attribute): * src/dispextern.h (trace_redisplay_p): (INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE) (SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH) (SET_GLYPH_FROM_CHAR_GLYPH): (WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P) (FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P) (PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p) (cursor_in_mouse_face_p): * src/dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows) (blank_row, prepare_desired_row) (build_frame_matrix_from_leaf_window, make_current) (mirror_make_current, mirrored_line_dance, mirror_line_dance) (update_window, scrolling_window, update_frame_line): * src/disptab.h (GLYPH_FOLLOW_ALIASES): * src/editfns.c (Fformat): * src/font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC) (FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE) (FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC) (FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC) (FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY) (CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG) (FONT_DEFERRED_LOG): * src/frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P): (FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME) (FRAME_MOUSE_UPDATE): * src/fringe.c (Fdefine_fringe_bitmap): * src/image.c (x_create_bitmap_from_data, x_create_bitmap_mask) (x_create_bitmap_from_xpm_data, xpm_load_image): * src/intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT) (set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE) (MERGE_INTERVAL_CACHE): * src/keymap.h (KEYMAPP): * src/lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE) (STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP) (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER) (CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER) (DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT) (DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT) (RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE) (SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp): * src/syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX) (UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD) (SETUP_BUFFER_SYNTAX_TABLE): * src/systime.h (timespec_valid_p): * src/term.c (save_and_enable_current_matrix): * src/window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P): * src/xdisp.c (in_display_vector_p, display_tool_bar_line) (redisplay_internal, try_window_reusing_current_matrix) (sync_frame_with_window_matrix_rows, try_window_id) (display_menu_bar, display_tty_menu_item, display_mode_line) (coords_in_mouse_face_p, cursor_in_mouse_face_p): * src/xmenu.c (xmenu_show): * src/xterm.c (use_xim, x_term_init): * src/xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET) (struct x_bitmap_record): Use bool for booleans. * src/ccl.c (struct buffer_text): * src/ccl.h (struct ccl_program): * src/charset.h (struct charset): * src/cm.h (struct cm): * src/coding.h (struct iso_2022_spec, struct coding_system): * src/dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row) (struct glyph_string, struct face, struct face_cache) (struct bidi_string_data, struct bidi_it) (struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo) (struct image): * src/editfns.c (Fformat): * src/frame.h (struct frame): * src/fringe.c (struct fringe_bitmap): * src/intervals.h (struct interval): * src/keyboard.h (struct kboard): * src/lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker) (struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free) (struct Lisp_Buffer_Local_Value, union specbinding): * src/macfont.m (struct macfont_info): * src/process.h (struct Lisp_Process): * src/termchar.h (struct tty_display_info): * src/window.h (struct window): * src/xterm.h (struct x_output): Use bool_bf for boolean bit-fields. * src/ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0. All callers changed. * src/ccl.h (struct ccl_program): Remove unused members private_state, src_multibyte, dst_multibyte, cr_consumed, suppress_error, eight_bit_control. (struct ccl_spec): Remove unused members cr_carryover, eight_bit_carryover. * src/conf_post.h: Include <stdbool.h>. (bool_bf): New type. * src/dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY): * src/interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE) Surround statement macro with proper 'do { ... } while (false)' brackets. (SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool. (PRODUCE_GLYPHS): Simplify use of boolean. * src/fileio.c (Fcopy_file): If I is an integer, prefer 'if (I != 0)' to 'if (I)'. * src/lisp.h (UNGCPRO): Return void, not int. (FOR_EACH_TAIL): Use void expression, not int expression. * src/region-cache.c: Reindent. * src/region-cache.h: Copy comments from region-cache.c, to fix incorrect remarks about booleans.
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h190
1 files changed, 102 insertions, 88 deletions
diff --git a/src/lisp.h b/src/lisp.h
index c4b36557eac..1e68b152dfc 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -23,7 +23,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
23#include <setjmp.h> 23#include <setjmp.h>
24#include <stdalign.h> 24#include <stdalign.h>
25#include <stdarg.h> 25#include <stdarg.h>
26#include <stdbool.h>
27#include <stddef.h> 26#include <stddef.h>
28#include <float.h> 27#include <float.h>
29#include <inttypes.h> 28#include <inttypes.h>
@@ -170,7 +169,7 @@ typedef EMACS_UINT uprintmax_t;
170 for COND to call external functions or access volatile storage. */ 169 for COND to call external functions or access volatile storage. */
171 170
172#ifndef ENABLE_CHECKING 171#ifndef ENABLE_CHECKING
173# define eassert(cond) ((void) (0 && (cond))) /* Check that COND compiles. */ 172# define eassert(cond) ((void) (false && (cond))) /* Check COND compiles. */
174# define eassume(cond) assume (cond) 173# define eassume(cond) assume (cond)
175#else /* ENABLE_CHECKING */ 174#else /* ENABLE_CHECKING */
176 175
@@ -251,20 +250,20 @@ enum Lisp_Bits
251 On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is: 250 On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is:
252 a. unnecessary, because the top bits of an EMACS_INT are unused, and 251 a. unnecessary, because the top bits of an EMACS_INT are unused, and
253 b. slower, because it typically requires extra masking. 252 b. slower, because it typically requires extra masking.
254 So, default USE_LSB_TAG to 1 only on hosts where it might be useful. */ 253 So, default USE_LSB_TAG to true only on hosts where it might be useful. */
255# if VAL_MAX < UINTPTR_MAX 254# if VAL_MAX < UINTPTR_MAX
256# define USE_LSB_TAG 1 255# define USE_LSB_TAG true
257# endif 256# endif
258# endif 257# endif
259# endif 258# endif
260#endif 259#endif
261#ifdef USE_LSB_TAG 260#ifdef USE_LSB_TAG
262# undef USE_LSB_TAG 261# undef USE_LSB_TAG
263enum enum_USE_LSB_TAG { USE_LSB_TAG = 1 }; 262enum enum_USE_LSB_TAG { USE_LSB_TAG = true };
264# define USE_LSB_TAG 1 263# define USE_LSB_TAG true
265#else 264#else
266enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; 265enum enum_USE_LSB_TAG { USE_LSB_TAG = false };
267# define USE_LSB_TAG 0 266# define USE_LSB_TAG false
268#endif 267#endif
269 268
270#ifndef alignas 269#ifndef alignas
@@ -356,7 +355,7 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 };
356 355
357/* When compiling via gcc -O0, define the key operations as macros, as 356/* When compiling via gcc -O0, define the key operations as macros, as
358 Emacs is too slow otherwise. To disable this optimization, compile 357 Emacs is too slow otherwise. To disable this optimization, compile
359 with -DINLINING=0. */ 358 with -DINLINING=false. */
360#if (defined __NO_INLINE__ \ 359#if (defined __NO_INLINE__ \
361 && ! defined __OPTIMIZE__ && ! defined __OPTIMIZE_SIZE__ \ 360 && ! defined __OPTIMIZE__ && ! defined __OPTIMIZE_SIZE__ \
362 && ! (defined INLINING && ! INLINING)) 361 && ! (defined INLINING && ! INLINING))
@@ -550,14 +549,14 @@ typedef struct { EMACS_INT i; } Lisp_Object;
550#define LISP_INITIALLY_ZERO {0} 549#define LISP_INITIALLY_ZERO {0}
551 550
552#undef CHECK_LISP_OBJECT_TYPE 551#undef CHECK_LISP_OBJECT_TYPE
553enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 1 }; 552enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = true };
554#else /* CHECK_LISP_OBJECT_TYPE */ 553#else /* CHECK_LISP_OBJECT_TYPE */
555 554
556/* If a struct type is not wanted, define Lisp_Object as just a number. */ 555/* If a struct type is not wanted, define Lisp_Object as just a number. */
557 556
558typedef EMACS_INT Lisp_Object; 557typedef EMACS_INT Lisp_Object;
559#define LISP_INITIALLY_ZERO 0 558#define LISP_INITIALLY_ZERO 0
560enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 0 }; 559enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = false };
561#endif /* CHECK_LISP_OBJECT_TYPE */ 560#endif /* CHECK_LISP_OBJECT_TYPE */
562 561
563/* Convert a Lisp_Object to the corresponding EMACS_INT and vice versa. 562/* Convert a Lisp_Object to the corresponding EMACS_INT and vice versa.
@@ -736,7 +735,7 @@ make_natnum (EMACS_INT n)
736/* Return true if X and Y are the same object. */ 735/* Return true if X and Y are the same object. */
737LISP_MACRO_DEFUN (EQ, bool, (Lisp_Object x, Lisp_Object y), (x, y)) 736LISP_MACRO_DEFUN (EQ, bool, (Lisp_Object x, Lisp_Object y), (x, y))
738 737
739/* Value is non-zero if I doesn't fit into a Lisp fixnum. It is 738/* Value is true if I doesn't fit into a Lisp fixnum. It is
740 written this way so that it also works if I is of unsigned 739 written this way so that it also works if I is of unsigned
741 type or if I is a NaN. */ 740 type or if I is a NaN. */
742 741
@@ -1085,17 +1084,23 @@ STRING_MULTIBYTE (Lisp_Object str)
1085 ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, min (SIZE_MAX, PTRDIFF_MAX) - 1)) 1084 ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, min (SIZE_MAX, PTRDIFF_MAX) - 1))
1086 1085
1087/* Mark STR as a unibyte string. */ 1086/* Mark STR as a unibyte string. */
1088#define STRING_SET_UNIBYTE(STR) \ 1087#define STRING_SET_UNIBYTE(STR) \
1089 do { if (EQ (STR, empty_multibyte_string)) \ 1088 do { \
1090 (STR) = empty_unibyte_string; \ 1089 if (EQ (STR, empty_multibyte_string)) \
1091 else XSTRING (STR)->size_byte = -1; } while (0) 1090 (STR) = empty_unibyte_string; \
1091 else \
1092 XSTRING (STR)->size_byte = -1; \
1093 } while (false)
1092 1094
1093/* Mark STR as a multibyte string. Assure that STR contains only 1095/* Mark STR as a multibyte string. Assure that STR contains only
1094 ASCII characters in advance. */ 1096 ASCII characters in advance. */
1095#define STRING_SET_MULTIBYTE(STR) \ 1097#define STRING_SET_MULTIBYTE(STR) \
1096 do { if (EQ (STR, empty_unibyte_string)) \ 1098 do { \
1097 (STR) = empty_multibyte_string; \ 1099 if (EQ (STR, empty_unibyte_string)) \
1098 else XSTRING (STR)->size_byte = XSTRING (STR)->size; } while (0) 1100 (STR) = empty_multibyte_string; \
1101 else \
1102 XSTRING (STR)->size_byte = XSTRING (STR)->size; \
1103 } while (false)
1099 1104
1100/* Convenience functions for dealing with Lisp strings. */ 1105/* Convenience functions for dealing with Lisp strings. */
1101 1106
@@ -1348,14 +1353,14 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val)
1348/* Compute A OP B, using the unsigned comparison operator OP. A and B 1353/* Compute A OP B, using the unsigned comparison operator OP. A and B
1349 should be integer expressions. This is not the same as 1354 should be integer expressions. This is not the same as
1350 mathematical comparison; for example, UNSIGNED_CMP (0, <, -1) 1355 mathematical comparison; for example, UNSIGNED_CMP (0, <, -1)
1351 returns 1. For efficiency, prefer plain unsigned comparison if A 1356 returns true. For efficiency, prefer plain unsigned comparison if A
1352 and B's sizes both fit (after integer promotion). */ 1357 and B's sizes both fit (after integer promotion). */
1353#define UNSIGNED_CMP(a, op, b) \ 1358#define UNSIGNED_CMP(a, op, b) \
1354 (max (sizeof ((a) + 0), sizeof ((b) + 0)) <= sizeof (unsigned) \ 1359 (max (sizeof ((a) + 0), sizeof ((b) + 0)) <= sizeof (unsigned) \
1355 ? ((a) + (unsigned) 0) op ((b) + (unsigned) 0) \ 1360 ? ((a) + (unsigned) 0) op ((b) + (unsigned) 0) \
1356 : ((a) + (uintmax_t) 0) op ((b) + (uintmax_t) 0)) 1361 : ((a) + (uintmax_t) 0) op ((b) + (uintmax_t) 0))
1357 1362
1358/* Nonzero iff C is an ASCII character. */ 1363/* True iff C is an ASCII character. */
1359#define ASCII_CHAR_P(c) UNSIGNED_CMP (c, <, 0x80) 1364#define ASCII_CHAR_P(c) UNSIGNED_CMP (c, <, 0x80)
1360 1365
1361/* A char-table is a kind of vectorlike, with contents are like a 1366/* A char-table is a kind of vectorlike, with contents are like a
@@ -1536,7 +1541,7 @@ enum symbol_redirect
1536 1541
1537struct Lisp_Symbol 1542struct Lisp_Symbol
1538{ 1543{
1539 unsigned gcmarkbit : 1; 1544 bool_bf gcmarkbit : 1;
1540 1545
1541 /* Indicates where the value can be found: 1546 /* Indicates where the value can be found:
1542 0 : it's a plain var, the value is in the `value' field. 1547 0 : it's a plain var, the value is in the `value' field.
@@ -1554,9 +1559,9 @@ struct Lisp_Symbol
1554 enum symbol_interned. */ 1559 enum symbol_interned. */
1555 unsigned interned : 2; 1560 unsigned interned : 2;
1556 1561
1557 /* Non-zero means that this variable has been explicitly declared 1562 /* True means that this variable has been explicitly declared
1558 special (with `defvar' etc), and shouldn't be lexically bound. */ 1563 special (with `defvar' etc), and shouldn't be lexically bound. */
1559 unsigned declared_special : 1; 1564 bool_bf declared_special : 1;
1560 1565
1561 /* The symbol's name, as a Lisp string. */ 1566 /* The symbol's name, as a Lisp string. */
1562 Lisp_Object name; 1567 Lisp_Object name;
@@ -1654,7 +1659,7 @@ SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (Lisp_Object sym)
1654LISP_MACRO_DEFUN (SYMBOL_CONSTANT_P, int, (Lisp_Object sym), (sym)) 1659LISP_MACRO_DEFUN (SYMBOL_CONSTANT_P, int, (Lisp_Object sym), (sym))
1655 1660
1656#define DEFSYM(sym, name) \ 1661#define DEFSYM(sym, name) \
1657 do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0) 1662 do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (false)
1658 1663
1659 1664
1660/*********************************************************************** 1665/***********************************************************************
@@ -1832,22 +1837,22 @@ SXHASH_REDUCE (EMACS_UINT x)
1832struct Lisp_Misc_Any /* Supertype of all Misc types. */ 1837struct Lisp_Misc_Any /* Supertype of all Misc types. */
1833{ 1838{
1834 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */ 1839 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_??? */
1835 unsigned gcmarkbit : 1; 1840 bool_bf gcmarkbit : 1;
1836 unsigned spacer : 15; 1841 unsigned spacer : 15;
1837}; 1842};
1838 1843
1839struct Lisp_Marker 1844struct Lisp_Marker
1840{ 1845{
1841 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */ 1846 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Marker */
1842 unsigned gcmarkbit : 1; 1847 bool_bf gcmarkbit : 1;
1843 unsigned spacer : 13; 1848 unsigned spacer : 13;
1844 /* This flag is temporarily used in the functions 1849 /* This flag is temporarily used in the functions
1845 decode/encode_coding_object to record that the marker position 1850 decode/encode_coding_object to record that the marker position
1846 must be adjusted after the conversion. */ 1851 must be adjusted after the conversion. */
1847 unsigned int need_adjustment : 1; 1852 bool_bf need_adjustment : 1;
1848 /* 1 means normal insertion at the marker's position 1853 /* True means normal insertion at the marker's position
1849 leaves the marker after the inserted text. */ 1854 leaves the marker after the inserted text. */
1850 unsigned int insertion_type : 1; 1855 bool_bf insertion_type : 1;
1851 /* This is the buffer that the marker points into, or 0 if it points nowhere. 1856 /* This is the buffer that the marker points into, or 0 if it points nowhere.
1852 Note: a chain of markers can contain markers pointing into different 1857 Note: a chain of markers can contain markers pointing into different
1853 buffers (the chain is per buffer_text rather than per buffer, so it's 1858 buffers (the chain is per buffer_text rather than per buffer, so it's
@@ -1893,7 +1898,7 @@ struct Lisp_Overlay
1893*/ 1898*/
1894 { 1899 {
1895 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */ 1900 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Overlay */
1896 unsigned gcmarkbit : 1; 1901 bool_bf gcmarkbit : 1;
1897 unsigned spacer : 15; 1902 unsigned spacer : 15;
1898 struct Lisp_Overlay *next; 1903 struct Lisp_Overlay *next;
1899 Lisp_Object start; 1904 Lisp_Object start;
@@ -1971,7 +1976,7 @@ typedef void (*voidfuncptr) (void);
1971struct Lisp_Save_Value 1976struct Lisp_Save_Value
1972 { 1977 {
1973 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */ 1978 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Save_Value */
1974 unsigned gcmarkbit : 1; 1979 bool_bf gcmarkbit : 1;
1975 unsigned spacer : 32 - (16 + 1 + SAVE_TYPE_BITS); 1980 unsigned spacer : 32 - (16 + 1 + SAVE_TYPE_BITS);
1976 1981
1977 /* V->data may hold up to SAVE_VALUE_SLOTS entries. The type of 1982 /* V->data may hold up to SAVE_VALUE_SLOTS entries. The type of
@@ -2047,7 +2052,7 @@ XSAVE_OBJECT (Lisp_Object obj, int n)
2047struct Lisp_Free 2052struct Lisp_Free
2048 { 2053 {
2049 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */ 2054 ENUM_BF (Lisp_Misc_Type) type : 16; /* = Lisp_Misc_Free */
2050 unsigned gcmarkbit : 1; 2055 bool_bf gcmarkbit : 1;
2051 unsigned spacer : 15; 2056 unsigned spacer : 15;
2052 union Lisp_Misc *chain; 2057 union Lisp_Misc *chain;
2053 }; 2058 };
@@ -2116,8 +2121,8 @@ struct Lisp_Intfwd
2116 2121
2117/* Boolean forwarding pointer to an int variable. 2122/* Boolean forwarding pointer to an int variable.
2118 This is like Lisp_Intfwd except that the ostensible 2123 This is like Lisp_Intfwd except that the ostensible
2119 "value" of the symbol is t if the int variable is nonzero, 2124 "value" of the symbol is t if the bool variable is true,
2120 nil if it is zero. */ 2125 nil if it is false. */
2121struct Lisp_Boolfwd 2126struct Lisp_Boolfwd
2122 { 2127 {
2123 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */ 2128 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */
@@ -2170,15 +2175,15 @@ struct Lisp_Buffer_Objfwd
2170 2175
2171struct Lisp_Buffer_Local_Value 2176struct Lisp_Buffer_Local_Value
2172 { 2177 {
2173 /* 1 means that merely setting the variable creates a local 2178 /* True means that merely setting the variable creates a local
2174 binding for the current buffer. */ 2179 binding for the current buffer. */
2175 unsigned int local_if_set : 1; 2180 bool_bf local_if_set : 1;
2176 /* 1 means this variable can have frame-local bindings, otherwise, it is 2181 /* True means this variable can have frame-local bindings, otherwise, it is
2177 can have buffer-local bindings. The two cannot be combined. */ 2182 can have buffer-local bindings. The two cannot be combined. */
2178 unsigned int frame_local : 1; 2183 bool_bf frame_local : 1;
2179 /* 1 means that the binding now loaded was found. 2184 /* True means that the binding now loaded was found.
2180 Presumably equivalent to (defcell!=valcell). */ 2185 Presumably equivalent to (defcell!=valcell). */
2181 unsigned int found : 1; 2186 bool_bf found : 1;
2182 /* If non-NULL, a forwarding to the C var where it should also be set. */ 2187 /* If non-NULL, a forwarding to the C var where it should also be set. */
2183 union Lisp_Fwd *fwd; /* Should never be (Buffer|Kboard)_Objfwd. */ 2188 union Lisp_Fwd *fwd; /* Should never be (Buffer|Kboard)_Objfwd. */
2184 /* The buffer or frame for which the loaded binding was found. */ 2189 /* The buffer or frame for which the loaded binding was found. */
@@ -2373,7 +2378,7 @@ INLINE bool
2373PSEUDOVECTORP (Lisp_Object a, int code) 2378PSEUDOVECTORP (Lisp_Object a, int code)
2374{ 2379{
2375 if (! VECTORLIKEP (a)) 2380 if (! VECTORLIKEP (a))
2376 return 0; 2381 return false;
2377 else 2382 else
2378 { 2383 {
2379 /* Converting to struct vectorlike_header * avoids aliasing issues. */ 2384 /* Converting to struct vectorlike_header * avoids aliasing issues. */
@@ -2541,18 +2546,22 @@ CHECK_NATNUM (Lisp_Object x)
2541 ? MOST_NEGATIVE_FIXNUM \ 2546 ? MOST_NEGATIVE_FIXNUM \
2542 : (lo)), \ 2547 : (lo)), \
2543 make_number (min (hi, MOST_POSITIVE_FIXNUM))); \ 2548 make_number (min (hi, MOST_POSITIVE_FIXNUM))); \
2544 } while (0) 2549 } while (false)
2545#define CHECK_TYPE_RANGED_INTEGER(type, x) \ 2550#define CHECK_TYPE_RANGED_INTEGER(type, x) \
2546 do { \ 2551 do { \
2547 if (TYPE_SIGNED (type)) \ 2552 if (TYPE_SIGNED (type)) \
2548 CHECK_RANGED_INTEGER (x, TYPE_MINIMUM (type), TYPE_MAXIMUM (type)); \ 2553 CHECK_RANGED_INTEGER (x, TYPE_MINIMUM (type), TYPE_MAXIMUM (type)); \
2549 else \ 2554 else \
2550 CHECK_RANGED_INTEGER (x, 0, TYPE_MAXIMUM (type)); \ 2555 CHECK_RANGED_INTEGER (x, 0, TYPE_MAXIMUM (type)); \
2551 } while (0) 2556 } while (false)
2552 2557
2553#define CHECK_NUMBER_COERCE_MARKER(x) \ 2558#define CHECK_NUMBER_COERCE_MARKER(x) \
2554 do { if (MARKERP ((x))) XSETFASTINT (x, marker_position (x)); \ 2559 do { \
2555 else CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x); } while (0) 2560 if (MARKERP ((x))) \
2561 XSETFASTINT (x, marker_position (x)); \
2562 else \
2563 CHECK_TYPE (INTEGERP (x), Qinteger_or_marker_p, x); \
2564 } while (false)
2556 2565
2557INLINE double 2566INLINE double
2558XFLOATINT (Lisp_Object n) 2567XFLOATINT (Lisp_Object n)
@@ -2566,9 +2575,13 @@ CHECK_NUMBER_OR_FLOAT (Lisp_Object x)
2566 CHECK_TYPE (FLOATP (x) || INTEGERP (x), Qnumberp, x); 2575 CHECK_TYPE (FLOATP (x) || INTEGERP (x), Qnumberp, x);
2567} 2576}
2568 2577
2569#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \ 2578#define CHECK_NUMBER_OR_FLOAT_COERCE_MARKER(x) \
2570 do { if (MARKERP (x)) XSETFASTINT (x, marker_position (x)); \ 2579 do { \
2571 else CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); } while (0) 2580 if (MARKERP (x)) \
2581 XSETFASTINT (x, marker_position (x)); \
2582 else \
2583 CHECK_TYPE (INTEGERP (x) || FLOATP (x), Qnumber_or_marker_p, x); \
2584 } while (false)
2572 2585
2573/* Since we can't assign directly to the CAR or CDR fields of a cons 2586/* Since we can't assign directly to the CAR or CDR fields of a cons
2574 cell, use these when checking that those fields contain numbers. */ 2587 cell, use these when checking that those fields contain numbers. */
@@ -2701,34 +2714,34 @@ extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
2701 do { \ 2714 do { \
2702 static struct Lisp_Objfwd o_fwd; \ 2715 static struct Lisp_Objfwd o_fwd; \
2703 defvar_lisp (&o_fwd, lname, &globals.f_ ## vname); \ 2716 defvar_lisp (&o_fwd, lname, &globals.f_ ## vname); \
2704 } while (0) 2717 } while (false)
2705#define DEFVAR_LISP_NOPRO(lname, vname, doc) \ 2718#define DEFVAR_LISP_NOPRO(lname, vname, doc) \
2706 do { \ 2719 do { \
2707 static struct Lisp_Objfwd o_fwd; \ 2720 static struct Lisp_Objfwd o_fwd; \
2708 defvar_lisp_nopro (&o_fwd, lname, &globals.f_ ## vname); \ 2721 defvar_lisp_nopro (&o_fwd, lname, &globals.f_ ## vname); \
2709 } while (0) 2722 } while (false)
2710#define DEFVAR_BOOL(lname, vname, doc) \ 2723#define DEFVAR_BOOL(lname, vname, doc) \
2711 do { \ 2724 do { \
2712 static struct Lisp_Boolfwd b_fwd; \ 2725 static struct Lisp_Boolfwd b_fwd; \
2713 defvar_bool (&b_fwd, lname, &globals.f_ ## vname); \ 2726 defvar_bool (&b_fwd, lname, &globals.f_ ## vname); \
2714 } while (0) 2727 } while (false)
2715#define DEFVAR_INT(lname, vname, doc) \ 2728#define DEFVAR_INT(lname, vname, doc) \
2716 do { \ 2729 do { \
2717 static struct Lisp_Intfwd i_fwd; \ 2730 static struct Lisp_Intfwd i_fwd; \
2718 defvar_int (&i_fwd, lname, &globals.f_ ## vname); \ 2731 defvar_int (&i_fwd, lname, &globals.f_ ## vname); \
2719 } while (0) 2732 } while (false)
2720 2733
2721#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) \ 2734#define DEFVAR_BUFFER_DEFAULTS(lname, vname, doc) \
2722 do { \ 2735 do { \
2723 static struct Lisp_Objfwd o_fwd; \ 2736 static struct Lisp_Objfwd o_fwd; \
2724 defvar_lisp_nopro (&o_fwd, lname, &BVAR (&buffer_defaults, vname)); \ 2737 defvar_lisp_nopro (&o_fwd, lname, &BVAR (&buffer_defaults, vname)); \
2725 } while (0) 2738 } while (false)
2726 2739
2727#define DEFVAR_KBOARD(lname, vname, doc) \ 2740#define DEFVAR_KBOARD(lname, vname, doc) \
2728 do { \ 2741 do { \
2729 static struct Lisp_Kboard_Objfwd ko_fwd; \ 2742 static struct Lisp_Kboard_Objfwd ko_fwd; \
2730 defvar_kboard (&ko_fwd, lname, offsetof (KBOARD, vname ## _)); \ 2743 defvar_kboard (&ko_fwd, lname, offsetof (KBOARD, vname ## _)); \
2731 } while (0) 2744 } while (false)
2732 2745
2733/* Save and restore the instruction and environment pointers, 2746/* Save and restore the instruction and environment pointers,
2734 without affecting the signal mask. */ 2747 without affecting the signal mask. */
@@ -2812,7 +2825,7 @@ union specbinding
2812 } let; 2825 } let;
2813 struct { 2826 struct {
2814 ENUM_BF (specbind_tag) kind : CHAR_BIT; 2827 ENUM_BF (specbind_tag) kind : CHAR_BIT;
2815 unsigned debug_on_exit : 1; 2828 bool_bf debug_on_exit : 1;
2816 Lisp_Object function; 2829 Lisp_Object function;
2817 Lisp_Object *args; 2830 Lisp_Object *args;
2818 ptrdiff_t nargs; 2831 ptrdiff_t nargs;
@@ -2869,7 +2882,7 @@ struct handler
2869 2882
2870 /* Most global vars are reset to their value via the specpdl mechanism, 2883 /* Most global vars are reset to their value via the specpdl mechanism,
2871 but a few others are handled by storing their value here. */ 2884 but a few others are handled by storing their value here. */
2872#if 1 /* GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS, but they're defined later. */ 2885#if true /* GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS, but defined later. */
2873 struct gcpro *gcpro; 2886 struct gcpro *gcpro;
2874#endif 2887#endif
2875 sys_jmp_buf jmp; 2888 sys_jmp_buf jmp;
@@ -2917,7 +2930,7 @@ extern char *stack_bottom;
2917 Unless that is impossible, of course. 2930 Unless that is impossible, of course.
2918 But it is very desirable to avoid creating loops where QUIT is impossible. 2931 But it is very desirable to avoid creating loops where QUIT is impossible.
2919 2932
2920 Exception: if you set immediate_quit to nonzero, 2933 Exception: if you set immediate_quit to true,
2921 then the handler that responds to the C-g does the quit itself. 2934 then the handler that responds to the C-g does the quit itself.
2922 This is a good thing to do around a loop that has no side effects 2935 This is a good thing to do around a loop that has no side effects
2923 and (in particular) cannot call arbitrary Lisp code. 2936 and (in particular) cannot call arbitrary Lisp code.
@@ -2935,10 +2948,10 @@ extern void process_quit_flag (void);
2935 process_quit_flag (); \ 2948 process_quit_flag (); \
2936 else if (pending_signals) \ 2949 else if (pending_signals) \
2937 process_pending_signals (); \ 2950 process_pending_signals (); \
2938 } while (0) 2951 } while (false)
2939 2952
2940 2953
2941/* Nonzero if ought to quit now. */ 2954/* True if ought to quit now. */
2942 2955
2943#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) 2956#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
2944 2957
@@ -3121,9 +3134,9 @@ extern int gcpro_level;
3121 gcprolist = &gcpro6; } 3134 gcprolist = &gcpro6; }
3122 3135
3123#define UNGCPRO \ 3136#define UNGCPRO \
3124 ((--gcpro_level != gcpro1.level) \ 3137 (--gcpro_level != gcpro1.level \
3125 ? (emacs_abort (), 0) \ 3138 ? emacs_abort () \
3126 : ((gcprolist = gcpro1.next), 0)) 3139 : (void) (gcprolist = gcpro1.next))
3127 3140
3128#endif /* DEBUG_GCPRO */ 3141#endif /* DEBUG_GCPRO */
3129#endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */ 3142#endif /* GC_MARK_STACK != GC_MAKE_GCPROS_NOOPS */
@@ -3131,14 +3144,14 @@ extern int gcpro_level;
3131 3144
3132/* Evaluate expr, UNGCPRO, and then return the value of expr. */ 3145/* Evaluate expr, UNGCPRO, and then return the value of expr. */
3133#define RETURN_UNGCPRO(expr) \ 3146#define RETURN_UNGCPRO(expr) \
3134do \ 3147 do \
3135 { \ 3148 { \
3136 Lisp_Object ret_ungc_val; \ 3149 Lisp_Object ret_ungc_val; \
3137 ret_ungc_val = (expr); \ 3150 ret_ungc_val = (expr); \
3138 UNGCPRO; \ 3151 UNGCPRO; \
3139 return ret_ungc_val; \ 3152 return ret_ungc_val; \
3140 } \ 3153 } \
3141while (0) 3154 while (false)
3142 3155
3143/* Call staticpro (&var) to protect static variable `var'. */ 3156/* Call staticpro (&var) to protect static variable `var'. */
3144 3157
@@ -4390,13 +4403,13 @@ enum MAX_ALLOCA { MAX_ALLOCA = 16 * 1024 };
4390extern void *record_xmalloc (size_t); 4403extern void *record_xmalloc (size_t);
4391 4404
4392#define USE_SAFE_ALLOCA \ 4405#define USE_SAFE_ALLOCA \
4393 ptrdiff_t sa_count = SPECPDL_INDEX (); bool sa_must_free = 0 4406 ptrdiff_t sa_count = SPECPDL_INDEX (); bool sa_must_free = false
4394 4407
4395/* SAFE_ALLOCA allocates a simple buffer. */ 4408/* SAFE_ALLOCA allocates a simple buffer. */
4396 4409
4397#define SAFE_ALLOCA(size) ((size) < MAX_ALLOCA \ 4410#define SAFE_ALLOCA(size) ((size) < MAX_ALLOCA \
4398 ? alloca (size) \ 4411 ? alloca (size) \
4399 : (sa_must_free = 1, record_xmalloc (size))) 4412 : (sa_must_free = true, record_xmalloc (size)))
4400 4413
4401/* SAFE_NALLOCA sets BUF to a newly allocated array of MULTIPLIER * 4414/* SAFE_NALLOCA sets BUF to a newly allocated array of MULTIPLIER *
4402 NITEMS items, each of the same type as *BUF. MULTIPLIER must 4415 NITEMS items, each of the same type as *BUF. MULTIPLIER must
@@ -4409,20 +4422,20 @@ extern void *record_xmalloc (size_t);
4409 else \ 4422 else \
4410 { \ 4423 { \
4411 (buf) = xnmalloc (nitems, sizeof *(buf) * (multiplier)); \ 4424 (buf) = xnmalloc (nitems, sizeof *(buf) * (multiplier)); \
4412 sa_must_free = 1; \ 4425 sa_must_free = true; \
4413 record_unwind_protect_ptr (xfree, buf); \ 4426 record_unwind_protect_ptr (xfree, buf); \
4414 } \ 4427 } \
4415 } while (0) 4428 } while (false)
4416 4429
4417/* SAFE_FREE frees xmalloced memory and enables GC as needed. */ 4430/* SAFE_FREE frees xmalloced memory and enables GC as needed. */
4418 4431
4419#define SAFE_FREE() \ 4432#define SAFE_FREE() \
4420 do { \ 4433 do { \
4421 if (sa_must_free) { \ 4434 if (sa_must_free) { \
4422 sa_must_free = 0; \ 4435 sa_must_free = false; \
4423 unbind_to (sa_count, Qnil); \ 4436 unbind_to (sa_count, Qnil); \
4424 } \ 4437 } \
4425 } while (0) 4438 } while (false)
4426 4439
4427 4440
4428/* SAFE_ALLOCA_LISP allocates an array of Lisp_Objects. */ 4441/* SAFE_ALLOCA_LISP allocates an array of Lisp_Objects. */
@@ -4430,39 +4443,40 @@ extern void *record_xmalloc (size_t);
4430#define SAFE_ALLOCA_LISP(buf, nelt) \ 4443#define SAFE_ALLOCA_LISP(buf, nelt) \
4431 do { \ 4444 do { \
4432 if ((nelt) < MAX_ALLOCA / word_size) \ 4445 if ((nelt) < MAX_ALLOCA / word_size) \
4433 buf = alloca ((nelt) * word_size); \ 4446 (buf) = alloca ((nelt) * word_size); \
4434 else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / word_size) \ 4447 else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / word_size) \
4435 { \ 4448 { \
4436 Lisp_Object arg_; \ 4449 Lisp_Object arg_; \
4437 buf = xmalloc ((nelt) * word_size); \ 4450 (buf) = xmalloc ((nelt) * word_size); \
4438 arg_ = make_save_memory (buf, nelt); \ 4451 arg_ = make_save_memory (buf, nelt); \
4439 sa_must_free = 1; \ 4452 sa_must_free = true; \
4440 record_unwind_protect (free_save_value, arg_); \ 4453 record_unwind_protect (free_save_value, arg_); \
4441 } \ 4454 } \
4442 else \ 4455 else \
4443 memory_full (SIZE_MAX); \ 4456 memory_full (SIZE_MAX); \
4444 } while (0) 4457 } while (false)
4445 4458
4446/* Loop over all tails of a list, checking for cycles. 4459/* Loop over all tails of a list, checking for cycles.
4447 FIXME: Make tortoise and n internal declarations. 4460 FIXME: Make tortoise and n internal declarations.
4448 FIXME: Unroll the loop body so we don't need `n'. */ 4461 FIXME: Unroll the loop body so we don't need `n'. */
4449#define FOR_EACH_TAIL(hare, list, tortoise, n) \ 4462#define FOR_EACH_TAIL(hare, list, tortoise, n) \
4450 for (tortoise = hare = (list), n = true; \ 4463 for ((tortoise) = (hare) = (list), (n) = true; \
4451 CONSP (hare); \ 4464 CONSP (hare); \
4452 (hare = XCDR (hare), n = !n, \ 4465 (hare = XCDR (hare), (n) = !(n), \
4453 (n \ 4466 ((n) \
4454 ? ((EQ (hare, tortoise) \ 4467 ? (EQ (hare, tortoise) \
4455 && (xsignal1 (Qcircular_list, (list)), 0))) \ 4468 ? xsignal1 (Qcircular_list, list) \
4469 : (void) 0) \
4456 /* Move tortoise before the next iteration, in case */ \ 4470 /* Move tortoise before the next iteration, in case */ \
4457 /* the next iteration does an Fsetcdr. */ \ 4471 /* the next iteration does an Fsetcdr. */ \
4458 : (tortoise = XCDR (tortoise), 0)))) 4472 : (void) ((tortoise) = XCDR (tortoise)))))
4459 4473
4460/* Do a `for' loop over alist values. */ 4474/* Do a `for' loop over alist values. */
4461 4475
4462#define FOR_EACH_ALIST_VALUE(head_var, list_var, value_var) \ 4476#define FOR_EACH_ALIST_VALUE(head_var, list_var, value_var) \
4463 for (list_var = head_var; \ 4477 for ((list_var) = (head_var); \
4464 (CONSP (list_var) && (value_var = XCDR (XCAR (list_var)), 1)); \ 4478 (CONSP (list_var) && ((value_var) = XCDR (XCAR (list_var)), true)); \
4465 list_var = XCDR (list_var)) 4479 (list_var) = XCDR (list_var))
4466 4480
4467/* Check whether it's time for GC, and run it if so. */ 4481/* Check whether it's time for GC, and run it if so. */
4468 4482
@@ -4498,14 +4512,14 @@ functionp (Lisp_Object object)
4498 if (SUBRP (object)) 4512 if (SUBRP (object))
4499 return XSUBR (object)->max_args != UNEVALLED; 4513 return XSUBR (object)->max_args != UNEVALLED;
4500 else if (COMPILEDP (object)) 4514 else if (COMPILEDP (object))
4501 return 1; 4515 return true;
4502 else if (CONSP (object)) 4516 else if (CONSP (object))
4503 { 4517 {
4504 Lisp_Object car = XCAR (object); 4518 Lisp_Object car = XCAR (object);
4505 return EQ (car, Qlambda) || EQ (car, Qclosure); 4519 return EQ (car, Qlambda) || EQ (car, Qclosure);
4506 } 4520 }
4507 else 4521 else
4508 return 0; 4522 return false;
4509} 4523}
4510 4524
4511INLINE_HEADER_END 4525INLINE_HEADER_END