From 5b3c4004a9647aa2068e54c358e202f57d0ece3c Mon Sep 17 00:00:00 2001 From: Po Lu Date: Mon, 19 Sep 2022 10:01:52 +0800 Subject: [PATCH] Remove calls to intern with a static string from code that runs on X * Makefile.in (actual-all): Reword build failure advice. * src/bytecode.c (exec_byte_code, syms_of_bytecode): * src/font.c (syms_of_font): * src/hbfont.c (uni_combining): * src/xfns.c (Fx_display_backing_store, Fx_display_visual_class) (x_create_tip_frame, Fx_show_tip, syms_of_xfns): * src/xfont.c (xfont_supported_scripts, xfont_driver) (syms_of_xfont): * src/xsmfns.c (Fhandle_save_session, syms_of_xsmfns): Remove calls to intern with a static string. --- Makefile.in | 26 +++++++++++++------------- src/bytecode.c | 4 +++- src/font.c | 4 ++++ src/hbfont.c | 2 +- src/xfns.c | 43 ++++++++++++++++++++++++++++++------------- src/xfont.c | 34 +++++++++++++++++++--------------- src/xsmfns.c | 4 +++- 7 files changed, 73 insertions(+), 44 deletions(-) diff --git a/Makefile.in b/Makefile.in index de263c6858b..9c9923a1f67 100644 --- a/Makefile.in +++ b/Makefile.in @@ -380,26 +380,26 @@ bootstrap-all: actual-all: ${SUBDIR} info $(gsettings_SCHEMAS:.xml=.valid) src-depending-on-lisp # ADVICE-ON-FAILURE-BEGIN:all -# You might try to: -# - run "make bootstrap", which might fix the problem -# - run "make V=1", which displays the full commands invoked by make, -#   to further investigate the problem +# It can help to run "make bootstrap", which can resolve many build +# failures caused by incrementally building from a previously built +# checkout. + +# Failing that, running "make V=1" will cause Make to display the full +# commands it invokes to build Emacs, which helps to investigate the +# problem. # ADVICE-ON-FAILURE-END:all # ADVICE-ON-FAILURE-BEGIN:bootstrap -# You might try to: -# - run "git clean -fdx" and run "make bootstrap" again, which might -#   fix the problem -#   !BEWARE! "git clean -fdx" deletes all files that are not under -#   !BEWARE! version control, which means that all changes to such -#   !BEWARE! files will be lost and cannot be restored later -# - run "make V=1", which displays the full commands invoked by make, -#   to further investigate the problem +# If "make bootstrap" failed, try running "make extraclean" and then +# "make bootstrap" again. If that still fails and you are building +# Emacs from a repository checkout, run "git clean -fdx" and retry +# "make bootstrap". Otherwise, please report a bug by sending email +# to bug-gnu-emacs@gnu.org. # ADVICE-ON-FAILURE-END:bootstrap advice-on-failure: @echo - @echo " \"make ${make-target}\" failed with exit status ${exit-status}." + @echo "make ${make-target}\" failed with exit status ${exit-status}." @cat Makefile | \ sed -n '/^# ADVICE-ON-FAILURE-BEGIN:${make-target}/,$${p;/^# ADVICE-ON-FAILURE-END:${make-target}/q};' | \ sed 's/^# //' | grep -v '^ADVICE-ON-FAILURE-' diff --git a/src/bytecode.c b/src/bytecode.c index d75767bb0c5..c765e1be2bc 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1431,7 +1431,7 @@ exec_byte_code (Lisp_Object fun, ptrdiff_t args_template, NEXT; CASE (Binteractive_p): /* Obsolete since 24.1. */ - PUSH (call0 (intern ("interactive-p"))); + PUSH (call0 (Qinteractive_p)); NEXT; CASE (Bforward_char): @@ -1749,6 +1749,8 @@ get_byte_code_arity (Lisp_Object args_template) void syms_of_bytecode (void) { + DEFSYM (Qinteractive_p, "interactive-p"); + defsubr (&Sbyte_code); defsubr (&Sinternal_stack_stats); diff --git a/src/font.c b/src/font.c index 2a8f00630cc..413cb381eeb 100644 --- a/src/font.c +++ b/src/font.c @@ -5555,6 +5555,10 @@ syms_of_font (void) DEFSYM (Qopentype, "opentype"); + /* Currently used by hbfont.c, which has no syms_of_hbfont function + of its own. */ + DEFSYM (Qcanonical_combining_class, "canonical-combining-class"); + /* Important character set symbols. */ DEFSYM (Qascii_0, "ascii-0"); DEFSYM (Qiso8859_1, "iso8859-1"); diff --git a/src/hbfont.c b/src/hbfont.c index 2721a661208..476e08020e1 100644 --- a/src/hbfont.c +++ b/src/hbfont.c @@ -249,7 +249,7 @@ uni_combining (hb_unicode_funcs_t *funcs, hb_codepoint_t ch, void *user_data) if (!combining_class_loaded) { canonical_combining_class_table = - uniprop_table (intern ("canonical-combining-class")); + uniprop_table (Qcanonical_combining_class); if (NILP (canonical_combining_class_table)) emacs_abort (); staticpro (&canonical_combining_class_table); diff --git a/src/xfns.c b/src/xfns.c index ecb869bf360..4df5ad890e8 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5540,15 +5540,15 @@ On MS Windows, this returns nothing useful. */) switch (DoesBackingStore (dpyinfo->screen)) { case Always: - result = intern ("always"); + result = Qalways; break; case WhenMapped: - result = intern ("when-mapped"); + result = Qwhen_mapped; break; case NotUseful: - result = intern ("not-useful"); + result = Qnot_useful; break; default: @@ -5577,22 +5577,22 @@ If omitted or nil, that stands for the selected frame's display. switch (dpyinfo->visual_info.class) { case StaticGray: - result = intern ("static-gray"); + result = Qstatic_gray; break; case GrayScale: - result = intern ("gray-scale"); + result = Qgray_scale; break; case StaticColor: - result = intern ("static-color"); + result = Qstatic_color; break; case PseudoColor: - result = intern ("pseudo-color"); + result = Qpseudo_color; break; case TrueColor: - result = intern ("true-color"); + result = Qtrue_color; break; case DirectColor: - result = intern ("direct-color"); + result = Qdirect_color; break; default: error ("Display has an unknown visual class"); @@ -8309,9 +8309,9 @@ x_create_tip_frame (struct x_display_info *dpyinfo, Lisp_Object parms) disptype = Qmono; else if (FRAME_X_VISUAL_INFO (f)->class == GrayScale || FRAME_X_VISUAL_INFO (f)->class == StaticGray) - disptype = intern ("grayscale"); + disptype = Qgrayscale; else - disptype = intern ("color"); + disptype = Qcolor; if (NILP (Fframe_parameter (frame, Qdisplay_type))) { @@ -8973,8 +8973,8 @@ Text larger than the specified size is clipped. */) start_timer: /* Let the tip disappear after timeout seconds. */ - tip_timer = call3 (intern ("run-at-time"), timeout, Qnil, - intern ("x-hide-tip")); + tip_timer = call3 (Qrun_at_time, timeout, Qnil, + Qx_hide_tip); return unbind_to (count, Qnil); } @@ -10072,6 +10072,23 @@ eliminated in future versions of Emacs. */); /* Tell Emacs about this window system. */ Fprovide (Qx, Qnil); + /* Used by Fx_show_tip. */ + DEFSYM (Qrun_at_time, "run-at-time"); + DEFSYM (Qx_hide_tip, "x-hide-tip"); + + /* Used by display class and backing store reporting functions. */ + DEFSYM (Qalways, "always"); + DEFSYM (Qwhen_mapped, "when-mapped"); + DEFSYM (Qnot_useful, "not-useful"); + DEFSYM (Qstatic_gray, "static-gray"); + DEFSYM (Qgray_scale, "gray-scale"); + DEFSYM (Qstatic_color, "static-color"); + DEFSYM (Qpseudo_color, "pseudo-color"); + DEFSYM (Qtrue_color, "true-color"); + DEFSYM (Qdirect_color, "direct-color"); + DEFSYM (Qgrayscale, "grayscale"); + DEFSYM (Qcolor, "color"); + #ifdef HAVE_XINPUT2 DEFSYM (Qxinput2, "xinput2"); diff --git a/src/xfont.c b/src/xfont.c index 74237e8aa88..951446b44d2 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -253,9 +253,9 @@ xfont_supported_scripts (Display *display, char *fontname, Lisp_Object props, /* Two special cases to avoid opening rather big fonts. */ if (EQ (AREF (props, 2), Qja)) - return list2 (intern ("kana"), intern ("han")); + return list2 (Qkana, Qhan); if (EQ (AREF (props, 2), Qko)) - return list1 (intern ("hangul")); + return list1 (Qhangul); scripts = Fgethash (props, xfont_scripts_cache, Qt); if (EQ (scripts, Qt)) { @@ -1130,19 +1130,19 @@ static void syms_of_xfont_for_pdumper (void); struct font_driver const xfont_driver = { - .type = LISPSYM_INITIALLY (Qx), - .get_cache = xfont_get_cache, - .list = xfont_list, - .match = xfont_match, - .list_family = xfont_list_family, - .open_font = xfont_open, - .close_font = xfont_close, - .prepare_face = xfont_prepare_face, - .has_char = xfont_has_char, - .encode_char = xfont_encode_char, - .text_extents = xfont_text_extents, - .draw = xfont_draw, - .check = xfont_check, + .type = LISPSYM_INITIALLY (Qx), + .get_cache = xfont_get_cache, + .list = xfont_list, + .match = xfont_match, + .list_family = xfont_list_family, + .open_font = xfont_open, + .close_font = xfont_close, + .prepare_face = xfont_prepare_face, + .has_char = xfont_has_char, + .encode_char = xfont_encode_char, + .text_extents = xfont_text_extents, + .draw = xfont_draw, + .check = xfont_check, }; void @@ -1153,6 +1153,10 @@ syms_of_xfont (void) staticpro (&xfont_scratch_props); xfont_scratch_props = make_nil_vector (8); pdumper_do_now_and_after_load (syms_of_xfont_for_pdumper); + + DEFSYM (Qkana, "kana"); + DEFSYM (Qhan, "han"); + DEFSYM (Qhangul, "hangul"); } static void diff --git a/src/xsmfns.c b/src/xsmfns.c index 7015a8eb633..7a17e6dbd86 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -511,7 +511,7 @@ Do not call this function yourself. */) this at the wrong time. */ if (doing_interact && ! kill_emacs) { - bool cancel_shutdown = ! NILP (call0 (intern ("emacs-session-save"))); + bool cancel_shutdown = ! NILP (call0 (Qemacs_session_save)); SmcInteractDone (smc_conn, cancel_shutdown); SmcSaveYourselfDone (smc_conn, True); @@ -542,6 +542,8 @@ Do not call this function yourself. */) void syms_of_xsmfns (void) { + DEFSYM (Qemacs_session_save, "emacs-session-save"); + DEFVAR_LISP ("x-session-id", Vx_session_id, doc: /* The session id Emacs got from the session manager for this session. Changing the value does not change the session id used by Emacs. -- 2.39.2