From 53f7cc2078c64fa169b167faa89f552fbafea18e Mon Sep 17 00:00:00 2001 From: Po Lu Date: Wed, 31 May 2023 21:08:33 +0800 Subject: [PATCH] Fix build with Lisp_Object type checking * configure.ac: Pass through `--enable-check-lisp-object-type' on Android. * src/alloc.c (android_make_lisp_symbol): * src/android.c: * src/androidfns.c (android_set_no_focus_on_map) (android_set_no_accept_focus): * src/androidfont.c (androidfont_match, androidfont_open_font): * src/androidselect.c (Fandroid_get_clipboard) (Fandroid_get_clipboard_targets): * src/keyboard.c (make_lispy_event, syms_of_keyboard): * src/sfntfont.c (sfnt_enum_font_1, sfntfont_list_1): * src/textconv.c (really_set_point_and_mark): Fix Lisp_Object and integer screw-ups. --- configure.ac | 4 ++++ src/alloc.c | 7 ++++--- src/android.c | 4 ++-- src/androidfns.c | 4 ++-- src/androidfont.c | 6 +----- src/androidselect.c | 4 ++-- src/keyboard.c | 6 +++--- src/sfntfont.c | 6 +++--- src/textconv.c | 3 ++- 9 files changed, 23 insertions(+), 21 deletions(-) diff --git a/configure.ac b/configure.ac index 529639bfa17..aa5fcea732b 100644 --- a/configure.ac +++ b/configure.ac @@ -1216,6 +1216,10 @@ package will likely install on older systems but crash on startup.]) passthrough="$passthrough --with-pop=$with_pop" passthrough="$passthrough --with-harfbuzz=$with_harfbuzz" + # Now pass through some checking options. + emacs_val="--enable-check-lisp-object-type=$enable_check_lisp_object_type" + passthrough="$passthrough $emacs_val" + AS_IF([test "x$with_mailutils" = "xyes"], [emacs_use_mailutils=yes]) AC_SUBST([emacs_use_mailutils]) diff --git a/src/alloc.c b/src/alloc.c index 82b1c6b0355..c77bdc6372d 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6195,14 +6195,15 @@ static Lisp_Object android_make_lisp_symbol (struct Lisp_Symbol *sym) { intptr_t symoffset; - Lisp_Object a; symoffset = (intptr_t) sym; INT_SUBTRACT_WRAPV (symoffset, (intptr_t) &lispsym, &symoffset); - a = TAG_PTR (Lisp_Symbol, symoffset); - return a; + { + Lisp_Object a = TAG_PTR (Lisp_Symbol, symoffset); + return a; + } } #endif diff --git a/src/android.c b/src/android.c index 43122f73be1..67590ae373d 100644 --- a/src/android.c +++ b/src/android.c @@ -6495,8 +6495,8 @@ android_exception_check_1 (jobject object) } } -/* Like android_exception_check_one, except it takes more than one - local reference argument. */ +/* Like android_exception_check_1, except it takes more than one local + reference argument. */ void android_exception_check_2 (jobject object, jobject object1) diff --git a/src/androidfns.c b/src/androidfns.c index 60b0549e7d1..cc48de1a359 100644 --- a/src/androidfns.c +++ b/src/androidfns.c @@ -2885,7 +2885,7 @@ android_set_no_focus_on_map (struct frame *f, Lisp_Object new_value, if (!EQ (new_value, old_value)) { android_set_dont_focus_on_map (FRAME_ANDROID_WINDOW (f), - new_value); + !NILP (new_value)); FRAME_NO_FOCUS_ON_MAP (f) = !NILP (new_value); } } @@ -2897,7 +2897,7 @@ android_set_no_accept_focus (struct frame *f, Lisp_Object new_value, if (!EQ (new_value, old_value)) { android_set_dont_accept_focus (FRAME_ANDROID_WINDOW (f), - new_value); + !NILP (new_value)); FRAME_NO_ACCEPT_FOCUS (f) = !NILP (new_value); } } diff --git a/src/androidfont.c b/src/androidfont.c index 1a09027bca7..db2f94008f2 100644 --- a/src/androidfont.c +++ b/src/androidfont.c @@ -636,7 +636,7 @@ androidfont_match (struct frame *f, Lisp_Object font_spec) androidfont_from_java (result, entity); info->object = (*android_java_env)->NewGlobalRef (android_java_env, (jobject) result); - android_exception_check_2 (entity, result); + android_exception_check_1 (result); ANDROID_DELETE_LOCAL_REF (result); return entity; @@ -713,10 +713,6 @@ androidfont_open_font (struct frame *f, Lisp_Object font_entity, pixel_size = 12; } - __android_log_print (ANDROID_LOG_DEBUG, __func__, - "opening font entity %"pI"x:%d", - (EMACS_INT) font_entity, pixel_size); - entity = (struct androidfont_entity *) XFONT_ENTITY (font_entity); block_input (); diff --git a/src/androidselect.c b/src/androidselect.c index 54c712ca93b..d1f2ebb52f9 100644 --- a/src/androidselect.c +++ b/src/androidselect.c @@ -208,7 +208,7 @@ Alternatively, return nil if the clipboard is empty. */) ANDROID_DELETE_LOCAL_REF (bytes); /* Now decode the resulting string. */ - return code_convert_string_norecord (string, Qutf_8, Qnil); + return code_convert_string_norecord (string, Qutf_8, false); } DEFUN ("android-clipboard-exists-p", Fandroid_clipboard_exists_p, @@ -304,7 +304,7 @@ data type available from the clipboard. */) /* Decode the string. */ tem = make_unibyte_string ((char *) data, length1); - tem = code_convert_string_norecord (tem, Qutf_8, Qnil); + tem = code_convert_string_norecord (tem, Qutf_8, false); targets = Fcons (tem, targets); /* Delete the retrieved data. */ diff --git a/src/keyboard.c b/src/keyboard.c index 364f26f421d..ec9a6dc712a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -6569,7 +6569,7 @@ make_lispy_event (struct input_event *event) menu bar event. */ menu_bar_touch_id = Qnil; - if (f->menu_bar_window) + if (!NILP (f->menu_bar_window)) { x_y_to_hpos_vpos (XWINDOW (f->menu_bar_window), XFIXNUM (x), XFIXNUM (y), &column, &row, NULL, NULL, @@ -13465,12 +13465,12 @@ This usually happens as a result of `select-active-regions'. The hook is called with one argument, the string that was selected. */); Vpost_select_region_hook = Qnil; - DEFVAR_LISP ("disable-inhibit-text-conversion", + DEFVAR_BOOL ("disable-inhibit-text-conversion", disable_inhibit_text_conversion, doc: /* Don't disable text conversion inside `read-key-sequence'. If non-nil, text conversion will continue to happen after a prefix key has been read inside `read-key-sequence'. */); - disable_inhibit_text_conversion = false; + disable_inhibit_text_conversion = false; pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper); } diff --git a/src/sfntfont.c b/src/sfntfont.c index 71399b890d2..826c830ece5 100644 --- a/src/sfntfont.c +++ b/src/sfntfont.c @@ -991,7 +991,7 @@ sfnt_enum_font_1 (int fd, const char *file, style1 = sfnt_decode_instance_name (&fvar->instance[i], name); - if (!style1) + if (NILP (style1)) continue; /* Now parse the style. */ @@ -1520,8 +1520,8 @@ sfntfont_list_1 (struct sfnt_font_desc *desc, Lisp_Object spec, if (STRINGP (XCAR (XCAR (tail))) && STRINGP (XCDR (XCAR (tail))) - && Fstring_equal (SYMBOL_NAME (tem), - XCAR (XCAR (tail)))) + && !NILP (Fstring_equal (SYMBOL_NAME (tem), + XCAR (XCAR (tail))))) { /* Special family found. */ tem = Fintern (XCDR (XCAR (tail)), Qnil); diff --git a/src/textconv.c b/src/textconv.c index 1530cc0ce32..a2c790d5374 100644 --- a/src/textconv.c +++ b/src/textconv.c @@ -1022,7 +1022,8 @@ really_set_point_and_mark (struct frame *f, ptrdiff_t point, /* Set the point. */ Fgoto_char (make_fixnum (point)); - if (mark == point && BVAR (current_buffer, mark_active)) + if (mark == point + && !NILP (BVAR (current_buffer, mark_active))) call0 (Qdeactivate_mark); else call1 (Qpush_mark, make_fixnum (mark)); -- 2.39.2