commit 6d6c55db2cdfb6b354873f17285a3f602e011817 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Thu Apr 18 00:30:24 2019 -0700 Mark _Noreturn error functions as cold On my platform this made ‘make compile-always’ 1.3% faster. Suggested by Alex Gramiak in: https://lists.gnu.org/r/emacs-devel/2019-04/msg00684.html * configure.ac (nw): Don’t use -Wsuggest-attribute=cold. * lib-src/make-docfile.c (write_globals): Mark noreturn functions as cold. * src/callproc.c (exec_failed): * src/data.c (wrong_length_argument, wrong_type_argument): * src/emacs-module.c (module_abort): * src/emacs.c (terminate_due_to_signal): * src/eval.c (unwind_to_catch): * src/image.c (my_png_error, my_error_exit): * src/json.c (json_out_of_memory, json_parse_error): * src/keyboard.c (quit_throw_to_read_char, user_error): * src/lisp.h (die, wrong_type_argument, wrong_choice) (args_out_of_range, args_out_of_range_3, circular_list) (buffer_overflow, memory_full, buffer_memory_full) (string_overflow, xsignal, xsignal0, xsignal1, xsignal2) (xsignal3, signal_error, overflow_error, error, verror) (nsberror, report_file_errno, report_file_error) (report_file_notify_error, terminate_due_to_signal) (emacs_abort, fatal): * src/lread.c (load_error_old_style_backquotes) (end_of_file_error, invalid_syntax): * src/pdumper.c (error_unsupported_dump_object): * src/puresize.h (pure_write_error): * src/search.c (matcher_overflow): * src/sound.c (sound_perror, alsa_sound_perror): * src/sysdep.c (handle_arith_signal): * src/systime.h (time_overflow): * src/term.c (maybe_fatal, vfatal): * src/textprop.c (text_read_only): * src/timefns.c (invalid_time_zone_specification) (time_error, invalid_hz): * src/xterm.c (x_connection_closed): Use AVOID instead of _Noreturn void, so that it’s marked cold. * src/conf_post.h (__has_attribute_cold) [!__has_attribute]: New macro. (ATTRIBUTE_COLD): New macro. * src/frame.h (WINDOW_SYSTEM_RETURN): Add ATTRIBUTE_COLD. * src/lisp.h (AVOID): New macro. * src/xterm.c: Omit unnecessary static decls, so that we needn’t worry about which functions should be marked cold. (x_io_error_quitter): Mark as cold. diff --git a/configure.ac b/configure.ac index 3cebf3d78c..9d39bdd76b 100644 --- a/configure.ac +++ b/configure.ac @@ -1068,6 +1068,9 @@ AS_IF([test $gl_gcc_warnings = no], # Emacs's use of alloca inhibits protecting the stack. nw="$nw -Wstack-protector" + # Emacs's use of __attribute__ ((cold)) causes false alarms with this option. + nw="$nw -Wsuggest-attribute=cold" + # Emacs's use of partly-const functions such as Fgnutls_available_p # make this option problematic. nw="$nw -Wsuggest-attribute=const" diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index ccd245e013..4d25b0a6b9 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -747,6 +747,8 @@ write_globals (void) printf ("%d", globals[i].v.value); putchar (')'); + if (globals[i].flags & DEFUN_noreturn) + fputs (" ATTRIBUTE_COLD", stdout); if (globals[i].flags & DEFUN_const) fputs (" ATTRIBUTE_CONST", stdout); diff --git a/src/callproc.c b/src/callproc.c index 2cdf84d9a8..98c67312b4 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -1135,7 +1135,7 @@ add_env (char **env, char **new_env, char *string) mess up the allocator's data structures in the parent. Report the error and exit the child. */ -static _Noreturn void +static AVOID exec_failed (char const *name, int err) { /* Avoid deadlock if the child's perror writes to a full pipe; the diff --git a/src/conf_post.h b/src/conf_post.h index f8254cfa9d..6ea2c7b664 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -73,6 +73,7 @@ typedef bool bool_bf; # define __has_attribute(a) __has_attribute_##a # define __has_attribute_alloc_size GNUC_PREREQ (4, 3, 0) # define __has_attribute_cleanup GNUC_PREREQ (3, 4, 0) +# define __has_attribute_cold GNUC_PREREQ (4, 3, 0) # define __has_attribute_externally_visible GNUC_PREREQ (4, 1, 0) # define __has_attribute_no_address_safety_analysis false # define __has_attribute_no_sanitize_address GNUC_PREREQ (4, 8, 0) @@ -223,6 +224,12 @@ extern void _DebPrint (const char *fmt, ...); extern char *emacs_getenv_TZ (void); extern int emacs_setenv_TZ (char const *); +#if __has_attribute (cold) +# define ATTRIBUTE_COLD __attribute__ ((cold)) +#else +# define ATTRIBUTE_COLD +#endif + #if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ #define NO_INLINE __attribute__((noinline)) #else diff --git a/src/data.c b/src/data.c index 11cd598ed8..1b2431011e 100644 --- a/src/data.c +++ b/src/data.c @@ -130,7 +130,7 @@ set_blv_valcell (struct Lisp_Buffer_Local_Value *blv, Lisp_Object val) blv->valcell = val; } -static _Noreturn void +static AVOID wrong_length_argument (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3) { Lisp_Object size1 = make_fixnum (bool_vector_size (a1)); @@ -142,7 +142,7 @@ wrong_length_argument (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3) make_fixnum (bool_vector_size (a3))); } -_Noreturn void +AVOID wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) { /* If VALUE is not even a valid Lisp object, we'd want to abort here diff --git a/src/emacs-module.c b/src/emacs-module.c index 47ca3368c0..09a768e18e 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -147,8 +147,7 @@ static enum emacs_funcall_exit module_non_local_exit_check (emacs_env *); static void module_assert_thread (void); static void module_assert_runtime (struct emacs_runtime *); static void module_assert_env (emacs_env *); -static _Noreturn void module_abort (const char *format, ...) - ATTRIBUTE_FORMAT_PRINTF(1, 2); +static AVOID module_abort (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); static emacs_env *initialize_environment (emacs_env *, struct emacs_env_private *); static void finalize_environment (emacs_env *); @@ -1163,8 +1162,7 @@ init_module_assertions (bool enable) initialize_storage (&global_storage); } -static _Noreturn void -ATTRIBUTE_FORMAT_PRINTF(1, 2) +static AVOID ATTRIBUTE_FORMAT_PRINTF (1, 2) module_abort (const char *format, ...) { fputs ("Emacs module assertion: ", stderr); diff --git a/src/emacs.c b/src/emacs.c index 6ed4b0ed87..5eba88c74f 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -370,7 +370,7 @@ using_utf8 (void) /* Report a fatal error due to signal SIG, output a backtrace of at most BACKTRACE_LIMIT lines, and exit. */ -_Noreturn void +AVOID terminate_due_to_signal (int sig, int backtrace_limit) { signal (sig, SIG_DFL); diff --git a/src/eval.c b/src/eval.c index fa7b2d0603..c2e996a947 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1133,7 +1133,7 @@ internal_catch (Lisp_Object tag, This is used for correct unwinding in Fthrow and Fsignal. */ -static _Noreturn void +static AVOID unwind_to_catch (struct handler *catch, Lisp_Object value) { bool last_time; diff --git a/src/frame.h b/src/frame.h index ec8f61465f..e2e8eaab9b 100644 --- a/src/frame.h +++ b/src/frame.h @@ -1262,7 +1262,7 @@ extern int frame_default_tool_bar_height; #ifdef HAVE_WINDOW_SYSTEM # define WINDOW_SYSTEM_RETURN #else -# define WINDOW_SYSTEM_RETURN _Noreturn +# define WINDOW_SYSTEM_RETURN _Noreturn ATTRIBUTE_COLD #endif extern WINDOW_SYSTEM_RETURN struct frame * diff --git a/src/image.c b/src/image.c index c1a23edefc..8e3a9a4930 100644 --- a/src/image.c +++ b/src/image.c @@ -6079,7 +6079,7 @@ init_png_functions (void) /* Error and warning handlers installed when the PNG library is initialized. */ -static _Noreturn void +static AVOID my_png_error (png_struct *png_ptr, const char *msg) { eassert (png_ptr != NULL); @@ -6718,7 +6718,7 @@ struct my_jpeg_error_mgr }; -static _Noreturn void +static AVOID my_error_exit (j_common_ptr cinfo) { struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; diff --git a/src/json.c b/src/json.c index 74e0534065..5917212899 100644 --- a/src/json.c +++ b/src/json.c @@ -255,7 +255,7 @@ json_encode (Lisp_Object string) return code_convert_string (string, Qutf_8_unix, Qt, true, true, true); } -static _Noreturn void +static AVOID json_out_of_memory (void) { xsignal0 (Qjson_out_of_memory); @@ -263,7 +263,7 @@ json_out_of_memory (void) /* Signal a Lisp error corresponding to the JSON ERROR. */ -static _Noreturn void +static AVOID json_parse_error (const json_error_t *error) { Lisp_Object symbol; diff --git a/src/keyboard.c b/src/keyboard.c index 8fb6db987b..dff8f6b2fc 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -364,7 +364,7 @@ static void restore_getcjmp (void *); static Lisp_Object apply_modifiers (int, Lisp_Object); static void restore_kboard_configuration (int); static void handle_interrupt (bool); -static _Noreturn void quit_throw_to_read_char (bool); +static AVOID quit_throw_to_read_char (bool); static void timer_start_idle (void); static void timer_stop_idle (void); static void timer_resume_idle (void); @@ -1131,13 +1131,12 @@ This also exits all active minibuffers. */ Fthrow (Qtop_level, Qnil); } -static _Noreturn void +static AVOID user_error (const char *msg) { xsignal1 (Quser_error, build_string (msg)); } -/* _Noreturn will be added to prototype by make-docfile. */ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "", doc: /* Exit from the innermost recursive edit or minibuffer. */ attributes: noreturn) @@ -1149,7 +1148,6 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, user_error ("No recursive edit is in progress"); } -/* _Noreturn will be added to prototype by make-docfile. */ DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "", doc: /* Abort the command that requested this recursive edit or minibuffer input. */ attributes: noreturn) diff --git a/src/lisp.h b/src/lisp.h index 2915944ffe..25d0a3d6ac 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -166,6 +166,9 @@ typedef EMACS_UINT uprintmax_t; # define pD "t" #endif +/* Convenience macro for rarely-used functions that do not return. */ +#define AVOID _Noreturn ATTRIBUTE_COLD void + /* Extra internal type checking? */ /* Define Emacs versions of 's 'assert (COND)' and 's @@ -196,7 +199,7 @@ typedef EMACS_UINT uprintmax_t; # define eassume(cond) assume (cond) #else /* ENABLE_CHECKING */ -extern _Noreturn void die (const char *, const char *, int); +extern AVOID die (const char *, const char *, int); extern bool suppress_checking EXTERNALLY_VISIBLE; @@ -621,7 +624,7 @@ extern Lisp_Object char_table_ref (Lisp_Object, int); extern void char_table_set (Lisp_Object, int, Lisp_Object); /* Defined in data.c. */ -extern _Noreturn void wrong_type_argument (Lisp_Object, Lisp_Object); +extern AVOID wrong_type_argument (Lisp_Object, Lisp_Object); /* Defined in emacs.c. */ @@ -3528,7 +3531,7 @@ modiff_to_integer (modiff_count a) } /* Defined in data.c. */ -extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object); +extern AVOID wrong_choice (Lisp_Object, Lisp_Object); extern void notify_variable_watchers (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); extern Lisp_Object indirect_function (Lisp_Object); @@ -3555,10 +3558,9 @@ extern intmax_t cons_to_signed (Lisp_Object, intmax_t, intmax_t); extern uintmax_t cons_to_unsigned (Lisp_Object, uintmax_t); extern struct Lisp_Symbol *indirect_variable (struct Lisp_Symbol *); -extern _Noreturn void args_out_of_range (Lisp_Object, Lisp_Object); -extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object, - Lisp_Object); -extern _Noreturn void circular_list (Lisp_Object); +extern AVOID args_out_of_range (Lisp_Object, Lisp_Object); +extern AVOID args_out_of_range_3 (Lisp_Object, Lisp_Object, Lisp_Object); +extern AVOID circular_list (Lisp_Object); extern Lisp_Object do_symval_forwarding (lispfwd); enum Set_Internal_Bind { SET_INTERNAL_SET, @@ -3666,7 +3668,7 @@ extern void syms_of_json (void); /* Defined in insdel.c. */ extern void move_gap_both (ptrdiff_t, ptrdiff_t); -extern _Noreturn void buffer_overflow (void); +extern AVOID buffer_overflow (void); extern void make_gap (ptrdiff_t); extern void make_gap_1 (struct buffer *, ptrdiff_t); extern ptrdiff_t copy_text (const unsigned char *, unsigned char *, @@ -3766,8 +3768,8 @@ extern void *my_heap_start (void); extern void check_pure_size (void); extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT); extern void malloc_warning (const char *); -extern _Noreturn void memory_full (size_t); -extern _Noreturn void buffer_memory_full (ptrdiff_t); +extern AVOID memory_full (size_t); +extern AVOID buffer_memory_full (ptrdiff_t); extern bool survives_gc_p (Lisp_Object); extern void mark_object (Lisp_Object); #if defined REL_ALLOC && !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC @@ -3848,7 +3850,7 @@ list4i (EMACS_INT x, EMACS_INT y, EMACS_INT w, EMACS_INT h) extern Lisp_Object make_uninit_bool_vector (EMACS_INT); extern Lisp_Object bool_vector_fill (Lisp_Object, Lisp_Object); -extern _Noreturn void string_overflow (void); +extern AVOID string_overflow (void); extern Lisp_Object make_string (const char *, ptrdiff_t); extern Lisp_Object make_formatted_string (char *, const char *, ...) ATTRIBUTE_FORMAT_PRINTF (2, 3); @@ -4095,18 +4097,17 @@ extern Lisp_Object run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args, Lisp_Object (*funcall) (ptrdiff_t nargs, Lisp_Object *args)); extern Lisp_Object quit (void); -INLINE _Noreturn void +INLINE AVOID xsignal (Lisp_Object error_symbol, Lisp_Object data) { Fsignal (error_symbol, data); } -extern _Noreturn void xsignal0 (Lisp_Object); -extern _Noreturn void xsignal1 (Lisp_Object, Lisp_Object); -extern _Noreturn void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object); -extern _Noreturn void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object); -extern _Noreturn void signal_error (const char *, Lisp_Object); -extern _Noreturn void overflow_error (void); +extern AVOID xsignal0 (Lisp_Object); +extern AVOID xsignal1 (Lisp_Object, Lisp_Object); +extern AVOID xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object); +extern AVOID xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); +extern AVOID signal_error (const char *, Lisp_Object); +extern AVOID overflow_error (void); extern bool FUNCTIONP (Lisp_Object); extern Lisp_Object funcall_subr (struct Lisp_Subr *subr, ptrdiff_t numargs, Lisp_Object *arg_vector); extern Lisp_Object eval_sub (Lisp_Object form); @@ -4145,8 +4146,8 @@ extern void set_unwind_protect_ptr (ptrdiff_t, void (*) (void *), void *); extern Lisp_Object unbind_to (ptrdiff_t, Lisp_Object); extern void rebind_for_thread_switch (void); extern void unbind_for_thread_switch (struct thread_state *); -extern _Noreturn void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); -extern _Noreturn void verror (const char *, va_list) +extern AVOID error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); +extern AVOID verror (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); extern Lisp_Object vformat_string (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); @@ -4243,7 +4244,7 @@ extern void syms_of_editfns (void); /* Defined in buffer.c. */ extern bool mouse_face_overlay_overlaps (Lisp_Object); extern Lisp_Object disable_line_numbers_overlay_at_eob (void); -extern _Noreturn void nsberror (Lisp_Object); +extern AVOID nsberror (Lisp_Object); extern void adjust_overlays_for_insert (ptrdiff_t, ptrdiff_t); extern void adjust_overlays_for_delete (ptrdiff_t, ptrdiff_t); extern void fix_start_end_in_overlays (ptrdiff_t, ptrdiff_t); @@ -4286,9 +4287,9 @@ extern void close_file_unwind (int); extern void fclose_unwind (void *); extern void restore_point_unwind (Lisp_Object); extern Lisp_Object get_file_errno_data (const char *, Lisp_Object, int); -extern _Noreturn void report_file_errno (const char *, Lisp_Object, int); -extern _Noreturn void report_file_error (const char *, Lisp_Object); -extern _Noreturn void report_file_notify_error (const char *, Lisp_Object); +extern AVOID report_file_errno (const char *, Lisp_Object, int); +extern AVOID report_file_error (const char *, Lisp_Object); +extern AVOID report_file_notify_error (const char *, Lisp_Object); extern bool internal_delete_file (Lisp_Object); extern Lisp_Object emacs_readlinkat (int, const char *); extern bool file_directory_p (Lisp_Object); @@ -4409,7 +4410,7 @@ extern bool display_arg; #endif extern Lisp_Object decode_env_path (const char *, const char *, bool); extern Lisp_Object empty_unibyte_string, empty_multibyte_string; -extern _Noreturn void terminate_due_to_signal (int, int); +extern AVOID terminate_due_to_signal (int, int); #ifdef WINDOWSNT extern Lisp_Object Vlibrary_cache; #endif @@ -4574,7 +4575,7 @@ extern EMACS_INT get_random (void); extern void seed_random (void *, ptrdiff_t); extern void init_random (void); extern void emacs_backtrace (int); -extern _Noreturn void emacs_abort (void) NO_INLINE; +extern AVOID emacs_abort (void) NO_INLINE; extern int emacs_open (const char *, int, int); extern int emacs_pipe (int[2]); extern int emacs_close (int); @@ -4615,8 +4616,7 @@ extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object, /* Defined in term.c. */ extern int *char_ins_del_vector; extern void syms_of_term (void); -extern _Noreturn void fatal (const char *msgid, ...) - ATTRIBUTE_FORMAT_PRINTF (1, 2); +extern AVOID fatal (const char *msgid, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); /* Defined in terminal.c. */ extern void syms_of_terminal (void); diff --git a/src/lread.c b/src/lread.c index 5f33fcd695..8cb4b63cc3 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1019,7 +1019,7 @@ load_error_handler (Lisp_Object data) return Qnil; } -static _Noreturn void +static AVOID load_error_old_style_backquotes (void) { if (NILP (Vload_file_name)) @@ -1874,7 +1874,7 @@ readevalloop_1 (int old) /* Signal an `end-of-file' error, if possible with file name information. */ -static _Noreturn void +static AVOID end_of_file_error (void) { if (STRINGP (Vload_file_name)) @@ -2297,7 +2297,7 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) /* Signal Qinvalid_read_syntax error. S is error string of length N (if > 0) */ -static _Noreturn void +static AVOID invalid_syntax (const char *s) { xsignal1 (Qinvalid_read_syntax, build_string (s)); diff --git a/src/pdumper.c b/src/pdumper.c index 600c5b3ca3..2cc9af7f56 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -680,8 +680,7 @@ static void dump_remember_cold_op (struct dump_context *ctx, enum cold_op op, Lisp_Object arg); -_Noreturn -static void +static AVOID error_unsupported_dump_object (struct dump_context *ctx, Lisp_Object object, const char *msg) diff --git a/src/puresize.h b/src/puresize.h index f120a4b330..f5fad8b42b 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -77,7 +77,7 @@ INLINE_HEADER_BEGIN #define PURESIZE (BASE_PURESIZE * PURESIZE_RATIO * PURESIZE_CHECKING_RATIO) #endif -extern _Noreturn void pure_write_error (Lisp_Object); +extern AVOID pure_write_error (Lisp_Object); extern EMACS_INT pure[]; diff --git a/src/search.c b/src/search.c index a450e920b0..7a6e680685 100644 --- a/src/search.c +++ b/src/search.c @@ -73,7 +73,7 @@ static EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t, Lisp_Object re_match_object; -static _Noreturn void +static AVOID matcher_overflow (void) { error ("Stack overflow in regexp matcher"); diff --git a/src/sound.c b/src/sound.c index 2b8715010e..4ba826e82c 100644 --- a/src/sound.c +++ b/src/sound.c @@ -297,7 +297,7 @@ static int do_play_sound (const char *, unsigned long); #ifndef WINDOWSNT /* Like perror, but signals an error. */ -static _Noreturn void +static AVOID sound_perror (const char *msg) { int saved_errno = errno; @@ -874,7 +874,7 @@ vox_write (struct sound_device *sd, const char *buffer, ptrdiff_t nbytes) #define DEFAULT_ALSA_SOUND_DEVICE "default" #endif -static _Noreturn void +static AVOID alsa_sound_perror (const char *msg, int err) { error ("%s: %s", msg, snd_strerror (err)); diff --git a/src/sysdep.c b/src/sysdep.c index 57ea8220ca..bc88e70dcb 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1805,7 +1805,7 @@ deliver_fatal_thread_signal (int sig) deliver_thread_signal (sig, handle_fatal_signal); } -static _Noreturn void +static AVOID handle_arith_signal (int sig) { pthread_sigmask (SIG_SETMASK, &empty_mask, 0); diff --git a/src/systime.h b/src/systime.h index 9080cd2bba..89af0c5e3d 100644 --- a/src/systime.h +++ b/src/systime.h @@ -92,7 +92,7 @@ extern Lisp_Object make_lisp_time (struct timespec); extern bool list4_to_timespec (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, struct timespec *); extern struct timespec lisp_time_argument (Lisp_Object); -extern _Noreturn void time_overflow (void); +extern AVOID time_overflow (void); extern void init_timefns (void); extern void syms_of_timefns (void); diff --git a/src/term.c b/src/term.c index a492276c88..2de0a0e664 100644 --- a/src/term.c +++ b/src/term.c @@ -73,11 +73,10 @@ static void clear_tty_hooks (struct terminal *terminal); static void set_tty_hooks (struct terminal *terminal); static void dissociate_if_controlling_tty (int fd); static void delete_tty (struct terminal *); -static _Noreturn void maybe_fatal (bool, struct terminal *, - const char *, const char *, ...) +static AVOID maybe_fatal (bool, struct terminal *, const char *, const char *, + ...) ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5); -static _Noreturn void vfatal (const char *str, va_list ap) - ATTRIBUTE_FORMAT_PRINTF (1, 0); +static AVOID vfatal (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); #define OUTPUT(tty, a) \ diff --git a/src/textprop.c b/src/textprop.c index bb063d3eaa..ae42c44185 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -65,7 +65,7 @@ static Lisp_Object interval_insert_in_front_hooks; /* Signal a `text-read-only' error. This function makes it easier to capture that error in GDB by putting a breakpoint on it. */ -static _Noreturn void +static AVOID text_read_only (Lisp_Object propval) { if (STRINGP (propval)) diff --git a/src/timefns.c b/src/timefns.c index 514fa24f8b..cb953d1b4c 100644 --- a/src/timefns.c +++ b/src/timefns.c @@ -172,7 +172,7 @@ emacs_localtime_rz (timezone_t tz, time_t const *t, struct tm *tm) return tm; } -static _Noreturn void +static AVOID invalid_time_zone_specification (Lisp_Object zone) { xsignal2 (Qerror, build_string ("Invalid time zone specification"), zone); @@ -337,7 +337,7 @@ time_overflow (void) error ("Specified time is not representable"); } -static _Noreturn void +static AVOID time_error (int err) { switch (err) @@ -348,7 +348,7 @@ time_error (int err) } } -static _Noreturn void +static AVOID invalid_hz (Lisp_Object hz) { xsignal2 (Qerror, build_string ("Invalid time frequency"), hz); diff --git a/src/xterm.c b/src/xterm.c index 0facb52454..0b83263a0e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1505,37 +1505,8 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring Glyph display ***********************************************************************/ - - -static void x_set_glyph_string_clipping (struct glyph_string *); -static void x_set_glyph_string_gc (struct glyph_string *); -static void x_draw_glyph_string_foreground (struct glyph_string *); -static void x_draw_composite_glyph_string_foreground (struct glyph_string *); -static void x_draw_glyph_string_box (struct glyph_string *); -static void x_draw_glyph_string (struct glyph_string *); -static _Noreturn void x_delete_glyphs (struct frame *, int); -static void x_compute_glyph_string_overhangs (struct glyph_string *); -static void x_set_cursor_gc (struct glyph_string *); -static void x_set_mode_line_face_gc (struct glyph_string *); -static void x_set_mouse_face_gc (struct glyph_string *); static bool x_alloc_lighter_color (struct frame *, Display *, Colormap, unsigned long *, double, int); -static void x_setup_relief_color (struct frame *, struct relief *, - double, int, unsigned long); -static void x_setup_relief_colors (struct glyph_string *); -static void x_draw_image_glyph_string (struct glyph_string *); -static void x_draw_image_relief (struct glyph_string *); -static void x_draw_image_foreground (struct glyph_string *); -#ifndef USE_CAIRO -static void x_draw_image_foreground_1 (struct glyph_string *, Pixmap); -#endif -static void x_clear_glyph_string_rect (struct glyph_string *, int, - int, int, int); -static void x_draw_relief_rect (struct frame *, int, int, int, int, - int, bool, bool, bool, bool, bool, - XRectangle *); -static void x_draw_box_rect (struct glyph_string *, int, int, int, int, - int, bool, bool, XRectangle *); static void x_scroll_bar_clear (struct frame *); #ifdef GLYPH_DEBUG @@ -3975,7 +3946,7 @@ x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, for X frames. */ static void -x_delete_glyphs (struct frame *f, register int n) +x_delete_glyphs (struct frame *f, int n) { emacs_abort (); } @@ -9842,7 +9813,7 @@ static char *error_msg; /* Handle the loss of connection to display DPY. ERROR_MESSAGE is the text of an error message that lead to the connection loss. */ -static _Noreturn void +static AVOID x_connection_closed (Display *dpy, const char *error_message, bool ioerror) { struct x_display_info *dpyinfo = x_display_info_for_display (dpy); @@ -10005,7 +9976,7 @@ x_error_quitter (Display *display, XErrorEvent *event) It kills all frames on the display that we lost touch with. If that was the only one, it prints an error message and kills Emacs. */ -static _Noreturn int +static _Noreturn ATTRIBUTE_COLD int x_io_error_quitter (Display *display) { char buf[256]; commit dded2c4cf30fbdb5e90c44bc76a26970d00e0f22 Author: YAMAMOTO Mitsuharu Date: Thu Apr 18 11:30:17 2019 +0900 * src/ftcrfont.c (ftcrfont_glyph_extents): Fix last change. diff --git a/src/ftcrfont.c b/src/ftcrfont.c index 31ff8e87c0..18f9c2dd31 100644 --- a/src/ftcrfont.c +++ b/src/ftcrfont.c @@ -75,7 +75,7 @@ ftcrfont_glyph_extents (struct font *font, if (METRICS_STATUS (cache) == METRICS_INVALID) { - cairo_glyph_t cr_glyph = {.index = glyph, .x = 0, . y = 0}; + cairo_glyph_t cr_glyph = {.index = glyph}; cairo_text_extents_t extents; cairo_scaled_font_glyph_extents (ftcrfont_info->cr_scaled_font, @@ -83,8 +83,8 @@ ftcrfont_glyph_extents (struct font *font, cache->lbearing = floor (extents.x_bearing); cache->rbearing = ceil (extents.width + extents.x_bearing); cache->width = lround (extents.x_advance); - cache->ascent = ceil (extents.y_bearing); - cache->descent = ceil (extents.height - extents.y_bearing); + cache->ascent = ceil (- extents.y_bearing); + cache->descent = ceil (extents.height + extents.y_bearing); } if (metrics) commit 774da19789b650fbce969c975bbb78920b7b2c66 Author: Philipp Stephani Date: Wed Apr 17 21:27:15 2019 +0200 Add ERT explainer for 'tramp--test-file-attributes-equal-p' * test/lisp/net/tramp-tests.el (tramp--test-file-attributes-equal-p): Use ERT explainer for 'equal' to improve failure messages. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index c88b1b83da..926bf3371c 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -3011,6 +3011,9 @@ They might differ only in access time." (setcar (nthcdr 4 attr2) tramp-time-dont-know) (equal attr1 attr2)) +;; This isn't 100% correct, but better than no explainer at all. +(put #'tramp--test-file-attributes-equal-p 'ert-explainer #'ert--explain-equal) + (ert-deftest tramp-test19-directory-files-and-attributes () "Check `directory-files-and-attributes'." (skip-unless (tramp--test-enabled)) commit 2116dfffce257dd727409788b1d5a9dca9754543 Author: Michael Albinus Date: Wed Apr 17 21:23:41 2019 +0200 Fix tramp-test32-shell-command * test/lisp/net/tramp-tests.el (tramp-test32-shell-command): Run only if "tput" exist. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 24eb7d6f0b..c88b1b83da 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4186,10 +4186,12 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (ignore-errors (delete-file tmp-name))) ;; Test `shell-command-width' of `async-shell-command'. - (when (tramp--test-sh-p) + + ;; `executable-find' has changed the number of parameters in + ;; Emacs 27.1, so we use `apply' for older Emacsen. + (when (and (executable-find "tput") + (apply #'executable-find '("tput" 'remote))) (let (shell-command-width) - (tramp--test-message "Hallo1 %s" (ignore-errors (car (process-lines "tput" "cols")))) - (tramp--test-message "Hallo2 %s" (ignore-errors (tramp--test-shell-command-to-string-asynchronously "tput cols"))) (should (string-equal ;; `frame-width' does not return a proper value. @@ -4199,7 +4201,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (tramp--test-shell-command-to-string-asynchronously "tput cols"))) (setq shell-command-width 1024) - (tramp--test-message "Hallo3 %s" (ignore-errors (tramp--test-shell-command-to-string-asynchronously "tput cols"))) (should (string-equal "1024\n" commit 0797897f34467272b150eba54aa3bbff19e92aa1 Merge: 41d9004e1c a1c53d4294 Author: Glenn Morris Date: Wed Apr 17 09:32:40 2019 -0700 Merge from origin/emacs-26 a1c53d4 (origin/emacs-26) * admin/admin.el (make-manuals-dist--1): Up... d0f745f Document some compilation-mode faces 23ccba0 Mention the assignment form in "Copyright Assignment" 0f5568e Fix confusing wording in the user manual 70ec392 Fix the MSDOS build when running under CWSDPMI 7a608fc * lisp/progmodes/python.el: Be more careful about temp file r... commit 41d9004e1cf50aa18720b52c6228b06e35ca96f5 Merge: 632f489f7d b3cab4199a Author: Glenn Morris Date: Wed Apr 17 09:32:40 2019 -0700 ; Merge from origin/emacs-26 The following commits were skipped: b3cab41 Backport: Plug memory leak in GTK x-display-monitor-attribute... e40f39b Backport: * lisp/frame.el (frame--size-history): Fix infloop.... commit 632f489f7da21d682d2b292cf3b3079145ea83ca Merge: 63a190a640 266c62290f Author: Glenn Morris Date: Wed Apr 17 09:32:39 2019 -0700 Merge from origin/emacs-26 266c622 Downcase charset 92f3459 Update for Emacs-26 beb4eac * doc/lispref/display.texi (Showing Images): Fix a typo. (Bu... commit 63a190a640f620f49b42e70e9e68f88e61c158b3 Author: Noam Postavsky Date: Wed Apr 17 10:24:12 2019 -0400 ; Fix files-tests-executable-find on w32 (Bug#35241) * test/lisp/files-tests.el (files-tests-executable-find): Make the tmpfile end with one of exec-suffixes, so that it will be executable on w32. diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 53e6e9064a..ae8ea41a79 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1221,7 +1221,7 @@ See ." (ert-deftest files-tests-executable-find () "Test that `executable-find' works also with a relative or remote PATH. See ." - (let ((tmpfile (make-temp-file "files-test"))) + (let ((tmpfile (make-temp-file "files-test" nil (car exec-suffixes)))) (unwind-protect (progn (set-file-modes tmpfile #o777) commit 314c2aa7c4ad813522f6a1bf2e052981dc8a80c2 Author: Michael Albinus Date: Wed Apr 17 14:19:42 2019 +0200 ; Instrument tramp-test32-shell-command for EMBA diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 64eb1ddefd..24eb7d6f0b 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4188,6 +4188,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Test `shell-command-width' of `async-shell-command'. (when (tramp--test-sh-p) (let (shell-command-width) + (tramp--test-message "Hallo1 %s" (ignore-errors (car (process-lines "tput" "cols")))) + (tramp--test-message "Hallo2 %s" (ignore-errors (tramp--test-shell-command-to-string-asynchronously "tput cols"))) (should (string-equal ;; `frame-width' does not return a proper value. @@ -4197,6 +4199,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (tramp--test-shell-command-to-string-asynchronously "tput cols"))) (setq shell-command-width 1024) + (tramp--test-message "Hallo3 %s" (ignore-errors (tramp--test-shell-command-to-string-asynchronously "tput cols"))) (should (string-equal "1024\n" commit 2c06731dca42ee4f10484a6c72b3528e14c548d7 Author: Michael Albinus Date: Wed Apr 17 14:04:37 2019 +0200 Fix Bug#35241 * lisp/files.el (executable-find): Quote default-directory. (Bug#35241) * test/lisp/files-tests.el (files-tests-executable-find): New test. diff --git a/lisp/files.el b/lisp/files.el index b81550e297..c05d70a00e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1058,7 +1058,8 @@ REMOTE is non-nil, search on the remote host indicated by (when (stringp res) (file-local-name res))) ;; Use 1 rather than file-executable-p to better match the ;; behavior of call-process. - (locate-file command exec-path exec-suffixes 1))) + (let ((default-directory (file-name-quote default-directory 'top))) + (locate-file command exec-path exec-suffixes 1)))) (defun load-library (library) "Load the Emacs Lisp library named LIBRARY. diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 13e8bb4943..53e6e9064a 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1218,5 +1218,31 @@ See ." process-environment))) (should (equal old (file-truename (abbreviate-file-name testfile)))))) +(ert-deftest files-tests-executable-find () + "Test that `executable-find' works also with a relative or remote PATH. +See ." + (let ((tmpfile (make-temp-file "files-test"))) + (unwind-protect + (progn + (set-file-modes tmpfile #o777) + (let ((exec-path `(,temporary-file-directory))) + (should + (equal tmpfile + (executable-find (file-name-nondirectory tmpfile))))) + ;; An empty element of `exec-path' means `default-directory'. + (let ((default-directory temporary-file-directory) + (exec-path nil)) + (should + (equal tmpfile + (executable-find (file-name-nondirectory tmpfile))))) + ;; The remote file name shall be quoted, and handled like a + ;; non-existing directory. + (let ((default-directory "/ssh::") + (exec-path (append exec-path `("." ,temporary-file-directory)))) + (should + (equal tmpfile + (executable-find (file-name-nondirectory tmpfile)))))) + (delete-file tmpfile)))) + (provide 'files-tests) ;;; files-tests.el ends here commit 48a6a3ac028181dbe32f6619982539adb0cd9a6a Author: Michael Albinus Date: Wed Apr 17 11:54:17 2019 +0200 * test/lisp/files-tests.el: Unify test names * test/lisp/files-tests.el (files-tests-local-variables) (files-tests-bug-18141, files-tests-make-temp-file-empty-prefix) (files-tests-bug-21454) (files-tests-save-buffers-kill-emacs--confirm-kill-processes) (files-tests-read-file-in-~) (files-tests-file-name-non-special--subprocess) (files-tests-file-name-non-special--buffers) (files-tests-insert-directory-wildcard-in-dir-p) (files-tests-make-directory, files-tests-no-file-write-contents) (files-tests-copy-directory, files-tests-abbreviated-home-dir): Unify test names. diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 57d8363ef9..13e8bb4943 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -137,7 +137,7 @@ form.") (hack-local-variables) (eval (nth 2 test-settings))))) -(ert-deftest files-test-local-variables () +(ert-deftest files-tests-local-variables () "Test the file-local variables implementation." (cl-letf (((symbol-function 'hack-local-variables-confirm) (lambda (&rest _) @@ -154,7 +154,7 @@ form.") (expand-file-name "data/files-bug18141.el.gz" (getenv "EMACS_TEST_DIRECTORY")) "Test file for bug#18141.") -(ert-deftest files-test-bug-18141 () +(ert-deftest files-tests-bug-18141 () "Test for https://debbugs.gnu.org/18141 ." (skip-unless (executable-find "gzip")) ;; If called interactively, environment variable @@ -170,7 +170,7 @@ form.") (should (eq buffer-file-coding-system 'iso-2022-7bit-unix)))) (delete-file tempfile)))) -(ert-deftest files-test-make-temp-file-empty-prefix () +(ert-deftest files-tests-make-temp-file-empty-prefix () "Test make-temp-file with an empty prefix." (let ((tempfile (make-temp-file "")) (tempdir (make-temp-file "" t)) @@ -188,7 +188,7 @@ form.") ;; Stop the above "Local Var..." confusing Emacs. -(ert-deftest files-test-bug-21454 () +(ert-deftest files-tests-bug-21454 () "Test for https://debbugs.gnu.org/21454 ." :expected-result :failed (let ((input-result @@ -216,7 +216,7 @@ form.") (setenv "FOO" foo-env) (setenv "BAR" bar-env)))) -(ert-deftest files-test--save-buffers-kill-emacs--confirm-kill-processes () +(ert-deftest files-tests-save-buffers-kill-emacs--confirm-kill-processes () "Test that `save-buffers-kill-emacs' honors `confirm-kill-processes'." (cl-letf* ((yes-or-no-p-prompts nil) @@ -239,7 +239,7 @@ form.") (should-not yes-or-no-p-prompts) (should (equal kill-emacs-args '(nil))))) -(ert-deftest files-test-read-file-in-~ () +(ert-deftest files-tests-read-file-in-~ () "Test file prompting in directory named '~'. If we are in a directory named '~', the default value should not be $HOME." @@ -278,7 +278,7 @@ be $HOME." (file-name-unquote (file-name-unquote temporary-file-directory)))))) -(ert-deftest files-tests--file-name-non-special--subprocess () +(ert-deftest files-tests-file-name-non-special--subprocess () "Check that Bug#25949 is fixed." (skip-unless (executable-find "true")) (let ((default-directory (file-name-quote temporary-file-directory))) @@ -306,7 +306,7 @@ be $HOME." (progn ,@body) (delete-file ,name)))) -(ert-deftest files-tests--file-name-non-special--buffers () +(ert-deftest files-tests-file-name-non-special--buffers () "Check that Bug#25951 is fixed. We call `verify-visited-file-modtime' on a buffer visiting a file with a quoted name. We use two different variants: first with @@ -1119,7 +1119,7 @@ works as expected if the default directory is quoted." :command (list program "--version") :file-handler t))))) -(ert-deftest files-tests--insert-directory-wildcard-in-dir-p () +(ert-deftest files-tests-insert-directory-wildcard-in-dir-p () (let ((alist (list (cons "/home/user/*/.txt" (cons "/home/user/" "*/.txt")) (cons "/home/user/.txt" nil) (cons "/home/*/.txt" (cons "/home/" "*/.txt")) @@ -1136,7 +1136,7 @@ works as expected if the default directory is quoted." (cdr path-res) (insert-directory-wildcard-in-dir-p (car path-res))))))) -(ert-deftest files-tests--make-directory () +(ert-deftest files-tests-make-directory () (let* ((dir (make-temp-file "files-mkdir-test" t)) (dirname (file-name-as-directory dir)) (file (concat dirname "file")) @@ -1158,7 +1158,7 @@ works as expected if the default directory is quoted." (should-not (make-directory a/b t)) (delete-directory dir 'recursive))) -(ert-deftest files-test-no-file-write-contents () +(ert-deftest files-tests-no-file-write-contents () "Test that `write-contents-functions' permits saving a file. Usually `basic-save-buffer' will prompt for a file name if the current buffer has none. It should first call the functions in @@ -1187,7 +1187,7 @@ name (Bug#28412)." (should (null (save-buffer))) (should (eq (buffer-size) 1)))))) -(ert-deftest files-tests--copy-directory () +(ert-deftest files-tests-copy-directory () (let* ((dir (make-temp-file "files-mkdir-test" t)) (dirname (file-name-as-directory dir)) (source (concat dirname "source")) @@ -1204,7 +1204,7 @@ name (Bug#28412)." (should (file-directory-p (concat (file-name-as-directory dest2) "a"))) (delete-directory dir 'recursive))) -(ert-deftest files-test-abbreviated-home-dir () +(ert-deftest files-tests-abbreviated-home-dir () "Test that changing HOME does not confuse `abbreviate-file-name'. See ." (let* ((homedir temporary-file-directory) commit 7e07bb2d2911f1a1dd3696227187501d7b7278a9 Author: Michael Albinus Date: Wed Apr 17 11:42:06 2019 +0200 Test `shell-command-width' in Tramp * test/lisp/net/tramp-tests.el (tramp--test-shell-command-to-string-asynchronously): Move up. (tramp-test32-shell-command): Test `shell-command-width'. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index cc3200be94..64eb1ddefd 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4079,6 +4079,16 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Cleanup. (ignore-errors (delete-process proc))))) +(defun tramp--test-shell-command-to-string-asynchronously (command) + "Like `shell-command-to-string', but for asynchronous processes." + (with-temp-buffer + (async-shell-command command (current-buffer)) + (with-timeout + ((if (getenv "EMACS_EMBA_CI") 30 10) (tramp--test-timeout-handler)) + (while (accept-process-output + (get-buffer-process (current-buffer)) nil nil t))) + (buffer-substring-no-properties (point-min) (point-max)))) + (ert-deftest tramp-test32-shell-command () "Check `shell-command'." :tags '(:expensive-test) @@ -4094,6 +4104,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Suppress nasty messages. (inhibit-message t) kill-buffer-query-functions) + + ;; Test ordinary `shell-command'. (unwind-protect (with-temp-buffer (write-region "foo" nil tmp-name) @@ -4114,6 +4126,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Cleanup. (ignore-errors (delete-file tmp-name))) + ;; Test ordinary `async-shell-command'. (unwind-protect (with-temp-buffer (write-region "foo" nil tmp-name) @@ -4142,6 +4155,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Cleanup. (ignore-errors (delete-file tmp-name))) + ;; Test sending string to `async-shell-command'. (unwind-protect (with-temp-buffer (write-region "foo" nil tmp-name) @@ -4169,17 +4183,25 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (buffer-string)))) ;; Cleanup. - (ignore-errors (delete-file tmp-name)))))) + (ignore-errors (delete-file tmp-name))) -(defun tramp--test-shell-command-to-string-asynchronously (command) - "Like `shell-command-to-string', but for asynchronous processes." - (with-temp-buffer - (async-shell-command command (current-buffer)) - (with-timeout - ((if (getenv "EMACS_EMBA_CI") 30 10) (tramp--test-timeout-handler)) - (while (accept-process-output - (get-buffer-process (current-buffer)) nil nil t))) - (buffer-substring-no-properties (point-min) (point-max)))) + ;; Test `shell-command-width' of `async-shell-command'. + (when (tramp--test-sh-p) + (let (shell-command-width) + (should + (string-equal + ;; `frame-width' does not return a proper value. + ;; `process-lines' uses `call-process', it doesn't care + ;; about `shell-command-width'. + (format "%s\n" (car (process-lines "tput" "cols"))) + (tramp--test-shell-command-to-string-asynchronously + "tput cols"))) + (setq shell-command-width 1024) + (should + (string-equal + "1024\n" + (tramp--test-shell-command-to-string-asynchronously + "tput cols")))))))) ;; This test is inspired by Bug#23952. (ert-deftest tramp-test33-environment-variables () commit a1c53d4294550380de76d6a6c4e29e9e8f6f9133 (refs/remotes/origin/emacs-26) Author: Glenn Morris Date: Tue Apr 16 14:33:24 2019 -0700 * admin/admin.el (make-manuals-dist--1): Update for incompatible copy-file change re "directories". diff --git a/admin/admin.el b/admin/admin.el index 41b1854c90..c1f6174874 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -696,6 +696,7 @@ style=\"text-align:left\">") (if (file-directory-p stem) (delete-directory stem t)) (make-directory stem) + (setq stem (file-name-as-directory stem)) (copy-file "../doc/misc/texinfo.tex" stem) (unless (equal type "emacs") (copy-file "../doc/emacs/emacsver.texi" stem) @@ -718,7 +719,7 @@ style=\"text-align:left\">") (setq ats t) (message "Unexpanded: %s" (match-string 0))) (if ats (error "Unexpanded configure variables in Makefile?"))) - (write-region nil nil (expand-file-name (format "%s/Makefile" stem)) + (write-region nil nil (expand-file-name (format "%sMakefile" stem)) nil 'silent)) (call-process "tar" nil nil nil "-cf" tarfile stem) (delete-directory stem t) commit d0f745f67ac36b4acc452deaa3a63d36c1c580a7 Author: Robert Pluim Date: Tue Apr 16 18:07:31 2019 +0200 Document some compilation-mode faces * doc/emacs/building.texi (Compilation Mode): Describe faces available to affect appearance of compilation-mode buffers. diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi index 7ce62498b8..31acfc827b 100644 --- a/doc/emacs/building.texi +++ b/doc/emacs/building.texi @@ -151,6 +151,20 @@ with the mouse (@pxref{Mouse References}), to visit the @dfn{locus} of the error message in a separate window. The locus is the specific position in a file where that error occurred. +@cindex compilation mode faces +@vindex compilation-error +@vindex compilation-warning + The appearance of the @file{*compilation*} buffer can be controlled +by customizing the faces which are used to highlight parts of the +@file{*compilation*} buffer, e.g., @code{compilation-error} or +@code{compilation-warning}, for error and warning messages +respectively. Note that since those faces inherit from the +@code{error} and @code{warning} faces, it is also possible to +customize the parent face directly instead. + + Use @w{@kbd{M-x customize-group RET compilation}} to see the entire +list of customization variables and faces. + @findex compile-goto-error @vindex compilation-auto-jump-to-first-error If you change the variable commit 23ccba0cf95db9815296ac82c56d0b6bcb499fd8 Author: Eli Zaretskii Date: Tue Apr 16 18:32:18 2019 +0300 Mention the assignment form in "Copyright Assignment" * doc/emacs/trouble.texi (Copyright Assignment): Mention the copyright assignment form explicitly. Suggested by Konstantin Kharlamov . diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 1bdd9fa014..2fe5487805 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -1400,9 +1400,10 @@ to the FSF@. For the reasons behind this, see @url{https://www.gnu.org/licenses/why-assign.html}. Copyright assignment is a simple process. Residents of some countries -can do it entirely electronically. We can help you get started, and -answer any questions you may have (or point you to the people with the -answers), at the @email{emacs-devel@@gnu.org} mailing list. +can do it entirely electronically. We can help you get started, +including sending you the forms you should fill, and answer any +questions you may have (or point you to the people with the answers), +at the @email{emacs-devel@@gnu.org} mailing list. (Please note: general discussion about why some GNU projects ask for a copyright assignment is off-topic for emacs-devel. commit 0f5568ea7c1e6952986dd03ef642a20e87736138 Author: Eli Zaretskii Date: Tue Apr 16 18:27:37 2019 +0300 Fix confusing wording in the user manual * doc/emacs/maintaining.texi (VC Undo): Remove a potentially inaccurate, outdated, and/or confusing sentence. (Bug#35290) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index cddffd6f2a..93dbce4759 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1084,8 +1084,7 @@ started editing, and asks for confirmation for discarding the changes. If you agree, the fileset is reverted. If you don't want @kbd{C-x v u} to show a diff, set the variable @code{vc-revert-show-diff} to @code{nil} (you can still view the diff directly with @kbd{C-x v =}; -@pxref{Old Revisions}). Note that @kbd{C-x v u} cannot be reversed -with the usual undo commands (@pxref{Undo}), so use it with care. +@pxref{Old Revisions}). On locking-based version control systems, @kbd{C-x v u} leaves files unlocked; you must lock again to resume editing. You can also use commit 70ec3928666353b69efae1bdc831d704fa505e72 Author: Eli Zaretskii Date: Mon Apr 15 18:05:52 2019 +0300 Fix the MSDOS build when running under CWSDPMI * src/msdos.c (the_only_tty_output): Define. * src/msdos.h (the_only_tty_output): Declare. * src/frame.c (make_terminal_frame) [MSDOS]: * src/dispnew.c (init_display) [MSDOS]: Set up f->output_data.tty pointer using the_only_tty_output, before dereferencing the pointer. This prevents crashes with DPMI servers that provide NULL pointer protection. diff --git a/src/dispnew.c b/src/dispnew.c index 03fac54e05..15a58cc2f5 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6117,6 +6117,7 @@ init_display (void) t->reference_count++; #ifdef MSDOS + f->output_data.tty = &the_only_tty_output; f->output_data.tty->display_info = &the_only_display_info; #else if (f->output_method == output_termcap) diff --git a/src/frame.c b/src/frame.c index 4ed140d7d0..08925308f9 100644 --- a/src/frame.c +++ b/src/frame.c @@ -1117,6 +1117,7 @@ make_terminal_frame (struct terminal *terminal) f->terminal = terminal; f->terminal->reference_count++; #ifdef MSDOS + f->output_data.tty = &the_only_tty_output; f->output_data.tty->display_info = &the_only_display_info; if (!inhibit_window_system && (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame)) diff --git a/src/msdos.c b/src/msdos.c index 3645dc8bb3..4367da4714 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -420,6 +420,9 @@ static unsigned short outside_cursor; /* The only display since MS-DOS does not support multiple ones. */ struct tty_display_info the_only_display_info; +/* The only tty_output, since MS-DOS supports only 1 display. */ +struct tty_output the_only_tty_output; + /* Support for DOS/V (allows Japanese characters to be displayed on standard, non-Japanese, ATs). Only supported for DJGPP v2 and later. */ diff --git a/src/msdos.h b/src/msdos.h index ff756f8f63..0d15df7a33 100644 --- a/src/msdos.h +++ b/src/msdos.h @@ -93,6 +93,7 @@ typedef int XRectangle; typedef struct tty_display_info Display_Info; extern struct tty_display_info the_only_display_info; +extern struct tty_output the_only_tty_output; #define FRAME_X_DISPLAY(f) ((Display *) 0) #define FRAME_FONT(f) ((f)->output_data.tty->font) commit 7a608fc6f3ded3e615e7accb29f16bfd290d80a1 Author: Stefan Monnier Date: Sun Apr 14 18:45:35 2019 -0400 * lisp/progmodes/python.el: Be more careful about temp file removal (python-shell-prompt-detect): Use unwind-protect to try and not leave file behind in case of error. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 27d31abaf5..38dcc823d0 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2266,15 +2266,16 @@ detection and just returns nil." ;; carriage returns in unbuffered mode. (let ((inhibit-eol-conversion (getenv "PYTHONUNBUFFERED"))) (python-shell--save-temp-file code)))) - ;; Use `process-file' as it is remote-host friendly. - (process-file - interpreter - code-file - '(t nil) - nil - interpreter-arg) - ;; Try to cleanup - (delete-file code-file))) + (unwind-protect + ;; Use `process-file' as it is remote-host friendly. + (process-file + interpreter + code-file + '(t nil) + nil + interpreter-arg) + ;; Try to cleanup + (delete-file code-file)))) (buffer-string))) (prompts (catch 'prompts commit b3cab4199a46b30539a24fb4d4b53ccdf488253e Author: Alexander Gramiak Date: Sat Apr 6 23:02:24 2019 -0600 Backport: Plug memory leak in GTK x-display-monitor-attributes-list * src/frame.c (free_monitors) [USE_GTK]: Define in the GTK case as well. * src/xfns.c (x-display-monitor-attributes-list) [USE_GTK]: Plug memory leak. Use dupstring over xstrdup as gdk_monitor_get_model may return NULL. diff --git a/src/frame.c b/src/frame.c index 9c3ff72271..4ed140d7d0 100644 --- a/src/frame.c +++ b/src/frame.c @@ -5533,8 +5533,8 @@ selected frame. This is useful when `make-pointer-invisible' is set. */) #ifdef HAVE_WINDOW_SYSTEM -# if (defined HAVE_NS \ - || (!defined USE_GTK && (defined HAVE_XINERAMA || defined HAVE_XRANDR))) +# if (defined USE_GTK || defined HAVE_NS || defined HAVE_XINERAMA \ + || defined HAVE_XRANDR) void free_monitors (struct MonitorInfo *monitors, int n_monitors) { diff --git a/src/xfns.c b/src/xfns.c index 732bc87814..b53999aaad 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5009,7 +5009,7 @@ Internal use only, use `display-monitor-attributes-list' instead. */) mi->mm_height = height_mm; #if GTK_CHECK_VERSION (3, 22, 0) - mi->name = g_strdup (gdk_monitor_get_model (monitor)); + dupstring (&mi->name, (gdk_monitor_get_model (monitor))); #elif GTK_CHECK_VERSION (2, 14, 0) mi->name = gdk_screen_get_monitor_plug_name (gscreen, i); #endif @@ -5020,6 +5020,11 @@ Internal use only, use `display-monitor-attributes-list' instead. */) primary_monitor, monitor_frames, source); +#if GTK_CHECK_VERSION (2, 14, 0) + free_monitors (monitors, n_monitors); +#else + xfree (monitors); +#endif unblock_input (); #else /* not USE_GTK */ commit e40f39bec34feeec893fb66625f19cc4663cd217 Author: Alexander Gramiak Date: Sun Apr 14 09:27:50 2019 -0600 Backport: * lisp/frame.el (frame--size-history): Fix infloop. (Bug#35272) diff --git a/lisp/frame.el b/lisp/frame.el index a0e62e1d69..30f6ca91ba 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1446,14 +1446,16 @@ selected frame." (with-current-buffer (get-buffer-create "*frame-size-history*") (erase-buffer) (insert (format "Frame size history of %s\n" frame)) - (while (listp (setq entry (pop history))) + (while (consp (setq entry (pop history))) (when (eq (car entry) frame) (pop entry) (insert (format "%s" (pop entry))) (move-to-column 24 t) (while entry (insert (format " %s" (pop entry)))) - (insert "\n")))))) + (insert "\n"))) + (unless frame-size-history + (insert "Frame size history is nil.\n"))))) (declare-function x-frame-edges "xfns.c" (&optional frame type)) (declare-function w32-frame-edges "w32fns.c" (&optional frame type)) commit 266c62290f5a0843555d2a18878a58395a6fd05f Author: Robert Pluim Date: Sun Apr 14 14:36:30 2019 +0200 Downcase charset RFC 2046 specifies that the charset parameter is case-insensitive. * lisp/gnus/gnus-icalendar.el (gnus-icalendar-with-decoded-handle): Downcase charset. Suggested by Christophe TROESTLER . (Bug#35265). diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el index f79ce36843..e4ad2af063 100644 --- a/lisp/gnus/gnus-icalendar.el +++ b/lisp/gnus/gnus-icalendar.el @@ -767,7 +767,7 @@ These will be used to retrieve the RSVP information from ical events." `(let ((,charset (cdr (assoc 'charset (mm-handle-type ,handle))))) (with-temp-buffer (mm-insert-part ,handle) - (when (string= ,charset "utf-8") + (when (string= (downcase ,charset) "utf-8") (decode-coding-region (point-min) (point-max) 'utf-8)) ,@body)))) commit 92f3459cd7ac53e39b933e80411934d4011caae9 Author: Phillip Lord Date: Sun Apr 14 18:16:52 2019 +0100 Update for Emacs-26 * nt/README.W32: Update details about packaging which changed for Emacs-26. diff --git a/nt/README.W32 b/nt/README.W32 index ce7b510e30..da5151fb02 100644 --- a/nt/README.W32 +++ b/nt/README.W32 @@ -24,7 +24,7 @@ See the end of the file for license conditions. * Preliminaries There are two binary distributions named - emacs-VER-x86_64-w64-mingw32.zip and emacs-VER-i686-w64-mingw32.zip, + emacs-VER-x86_64.zip and emacs-VER-i686.zip, where VER is the Emacs version. These are 64-bit and 32-bit builds, respectively. If you are running a 32-bit version of MS-Windows, you need to install the 32-bit build; users of 64-bit Windows can @@ -45,29 +45,14 @@ See the end of the file for license conditions. action, by default this will be in a top-level directory with the same name as the zip file. - We also provide a set of optional dependencies, in - emacs-MVER-x86_64-deps.zip or emacs-MVER-i686-deps.zip respectively, - where MVER is the major Emacs version that should use these - libraries. These provide Emacs with a number of additional optional - capabilities, described in detail below. To use these, unpack them - directly over the emacs directory structure. Note that, if - extracting with the Windows Explorer, you will have to override the - directory where it wants to put the file with the same directory - where you extracted the Emacs binary package. - - Finally, and also optionally, you can run the program addpm.exe in - the bin subdirectory which will place an icon for Emacs on the start - page. (This is no longer needed in latest versions of Emacs, so we - recommend you not do that, as running addpm.exe will insert entries - into the Registry which might get in the way if you upgrade to later - versions without updating those entries, or would like to uninstall - Emacs.) - Emacs is completely portable. You can create your own shortcut to runemacs.exe and place this wherever you find it convenient (the desktop and/or the Taskbar), or run it from a USB or network drive without copying or installing anything on the machine itself. + It is also possible, although not recommended to use the program + bin/addpm.exe which will place an icon for Emacs on the start page. + * Prerequisites for Windows 9X The 32-bit build supports MS-Windows 9X (Windows 95/98/Me). To run @@ -151,48 +136,41 @@ See the end of the file for license conditions. + update-game-score.exe - A utility for updating the score files of Emacs games. -* Optional dependency libraries +* Emacs without optional dependencies - Emacs has built in support for XBM and PPM/PGM/PBM images, and the - libXpm library is bundled, providing XPM support (required for color - toolbar icons and splash screen). Source for libXpm should be - available from the same place from which you got this binary - distribution. + The files emacs-VER-x86_64.zip and emacs-VER-i686.zip contain a + large number of optional dependencies for Emacs. - Emacs has a number of optional features which need additional - libraries. These are provided in a separate bundle of dependencies, - as described above, and enable support for the following: + Emacs has a number of optional features which use these additional + dependencies. They enable support for the following: - displaying inline images of many types (PNG, JPEG, GIF, TIFF, SVG) - SSL/TLS secure network communications (HTTPS, IMAPS, etc.) - HTML and XML parsing (necessary for the built-in EWW browser) - built-in decompression of compressed text - The optional dependency libraries are in emacs-MVER-x86_64-deps.zip - (64-bit) and emacs-MVER-i686-deps.zip (32-bit), and their sources - are in emacs-MVER-deps-mingw-w64-src.zip, where MVER is the major - version of Emacs that should use these dependencies. Note that a - 64-bit Emacs will only work with the 64-bit dependencies, and the - 32-bit Emacs only with the 32-bit dependencies. - - Newer/updated builds for these optional libraries are available at - http://msys2.github.io/ and - http://sourceforge.net/projects/ezwinports/files/ (but you shouldn't - need these except in emergencies). + If you do not want these files (if you have them already for + instance, or you want the smallest possible Emacs), then you may use + the files emacs-VER-x86_64-no-deps.zip or + emacs-VER-i686-no-deps.zip. The dependency files are also available + as emacs-MVER-x86_64-no-deps.zip and emacs-MVER-i686-deps.zip. Source + code for these dependencies is available as + emacs-26-deps-mingw-w64-src.zip. - If you install the libraries in a directory different from where you - have the Emacs executable programs, we recommend to add the - directory with DLLs to your Path, so that Emacs will be able to find - those DLLs when needed. + All distributions of Emacs have built in support for XBM and + PPM/PGM/PBM images, and the libXpm library is bundled, providing XPM + support (required for color toolbar icons and splash screen). + Source for libXpm should be available from the same place from which + you got this binary distribution. * Installing Emacs with an existing MSYS2 installation - You may also use Emacs with an existing MSYS2 installation by simply - unpacking the Emacs distribution over MSYS2. You can then use the - 'pacman' utility to install dependencies. You should not use the - optional dependencies bundle from this site, as this will overwrite - MSYS2 files (the dependency bundle derives from MSYS2, but may be a - different version). + You may also use Emacs with an existing MSYS2 installation by + unpacking the emacs-VER-x86_64-no-deps.zip over the MSYS2 + distribution. You should not use the emacs-VER-x86_64.zip from this + site, as this will overwrite MSYS2 files (the dependency bundle + derives from MSYS2, but will be from a different version). You can + then use the 'pacman' utility to install dependencies. Some of the optional libraries need to be of certain versions to work with your Emacs binary. Make sure you install those versions @@ -218,6 +196,7 @@ See the end of the file for license conditions. mingw-w64-x86_64-libtiff mingw-w64-x86_64-libxml2 mingw-w64-x86_64-xpm-nox + mingw-w64-x86_64-lcms2 You can type any subset of this list. When asked whether to proceed with installation, answer Y. commit beb4eac6546cbc20467c0a4474963a1b12915370 Author: Eli Zaretskii Date: Fri Apr 12 21:46:25 2019 +0300 * doc/lispref/display.texi (Showing Images): Fix a typo. (Bug#35240 diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index e3ee62ffb6..b07999432c 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -5856,8 +5856,8 @@ This function returns the size of an image as a pair specification. @var{pixels} non-@code{nil} means return sizes measured in pixels, otherwise return sizes measured in the default character size of @var{frame} (@pxref{Frame Font}). @var{frame} is the frame on which -the image will be displayed. @var{frame} null or omitted means use the -selected frame (@pxref{Input Focus}). +the image will be displayed. @var{frame} @code{nil} or omitted means +use the selected frame (@pxref{Input Focus}). @end defun @defvar max-image-size