commit b7f3a3055c92010afde318c1108b02e4424a3bac (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Sat Nov 26 00:19:08 2016 -0800 Don't access pointers to freed storage in regex.c Remove __BOUNDED_POINTERS__ code, which does not work with -fcheck-pointer-bound and which has undefined behavior anyway. Problem found when trying to port to gcc -fcheck-pointer-bounds. (This code was removed from glibc and gnulib regex.c many years ago.) * src/regex.c (ELSE_EXTEND_BUFFER_HIGH_BOUND): Remove. (EXTEND_BUFFER): Use a more-portable approach that avoids undefined behavior due to inspecting pointers to freed storage. diff --git a/src/regex.c b/src/regex.c index 1c6c9e5..afd0d18 100644 --- a/src/regex.c +++ b/src/regex.c @@ -1644,28 +1644,6 @@ static int analyze_first (re_char *p, re_char *pend, reset the pointers that pointed into the old block to point to the correct places in the new one. If extending the buffer results in it being larger than MAX_BUF_SIZE, then flag memory exhausted. */ -#if __BOUNDED_POINTERS__ -# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated) -# define MOVE_BUFFER_POINTER(P) \ - (__ptrlow (P) = new_buffer + (__ptrlow (P) - old_buffer), \ - SET_HIGH_BOUND (P), \ - __ptrvalue (P) = new_buffer + (__ptrvalue (P) - old_buffer)) -# define ELSE_EXTEND_BUFFER_HIGH_BOUND \ - else \ - { \ - SET_HIGH_BOUND (b); \ - SET_HIGH_BOUND (begalt); \ - if (fixup_alt_jump) \ - SET_HIGH_BOUND (fixup_alt_jump); \ - if (laststart) \ - SET_HIGH_BOUND (laststart); \ - if (pending_exact) \ - SET_HIGH_BOUND (pending_exact); \ - } -#else -# define MOVE_BUFFER_POINTER(P) ((P) = new_buffer + ((P) - old_buffer)) -# define ELSE_EXTEND_BUFFER_HIGH_BOUND -#endif #define EXTEND_BUFFER() \ do { \ unsigned char *old_buffer = bufp->buffer; \ @@ -1674,23 +1652,24 @@ static int analyze_first (re_char *p, re_char *pend, bufp->allocated <<= 1; \ if (bufp->allocated > MAX_BUF_SIZE) \ bufp->allocated = MAX_BUF_SIZE; \ + ptrdiff_t b_off = b - old_buffer; \ + ptrdiff_t begalt_off = begalt - old_buffer; \ + bool fixup_alt_jump_set = !!fixup_alt_jump; \ + bool laststart_set = !!laststart; \ + bool pending_exact_set = !!pending_exact; \ + ptrdiff_t fixup_alt_jump_off, laststart_off, pending_exact_off; \ + if (fixup_alt_jump_set) fixup_alt_jump_off = fixup_alt_jump - old_buffer; \ + if (laststart_set) laststart_off = laststart - old_buffer; \ + if (pending_exact_set) pending_exact_off = pending_exact - old_buffer; \ RETALLOC (bufp->buffer, bufp->allocated, unsigned char); \ if (bufp->buffer == NULL) \ return REG_ESPACE; \ - /* If the buffer moved, move all the pointers into it. */ \ - if (old_buffer != bufp->buffer) \ - { \ - unsigned char *new_buffer = bufp->buffer; \ - MOVE_BUFFER_POINTER (b); \ - MOVE_BUFFER_POINTER (begalt); \ - if (fixup_alt_jump) \ - MOVE_BUFFER_POINTER (fixup_alt_jump); \ - if (laststart) \ - MOVE_BUFFER_POINTER (laststart); \ - if (pending_exact) \ - MOVE_BUFFER_POINTER (pending_exact); \ - } \ - ELSE_EXTEND_BUFFER_HIGH_BOUND \ + unsigned char *new_buffer = bufp->buffer; \ + b = new_buffer + b_off; \ + begalt = new_buffer + begalt_off; \ + if (fixup_alt_jump_set) fixup_alt_jump = new_buffer + fixup_alt_jump_off; \ + if (laststart_set) laststart = new_buffer + laststart_off; \ + if (pending_exact_set) pending_exact = new_buffer + pending_exact_off; \ } while (0) commit caec5c06caa854a5e9d2001bd8ef7199a0b7540c Author: Eli Zaretskii Date: Sat Nov 26 09:30:59 2016 +0200 ; Fix last change in cpp.el * lisp/progmodes/cpp.el (cpp-message-min-time-interval): Fix the ':type' attribute. diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el index 18b0704..4e029ea 100644 --- a/lisp/progmodes/cpp.el +++ b/lisp/progmodes/cpp.el @@ -107,7 +107,8 @@ Each entry is a list with the following elements: (defcustom cpp-message-min-time-interval 1.0 "Minimum time interval in seconds for `cpp-progress-message' messages. If nil, `cpp-progress-message' prints no progress messages." - :type 'float + :type '(choice (const :tag "Disable progress messages" nil) + float) :group 'cpp :version "26.1") commit d2d4b0746500265eddfa3c618bd6670aaa5eee90 Author: Paul Eggert Date: Fri Nov 25 21:24:28 2016 -0800 Port build to gcc -fcheck-pointer-bounds This does not let Emacs run, just build. * lib-src/etags.c (main): * lib-src/profile.c (main): Use return, not exit. * src/bytecode.c (BYTE_CODE_THREADED) [__CHKP__]: Do not define, as -fcheck-pointer-bounds is incompatible with taking addresses of labels. * src/menu.c (Fx_popup_dialog): Use eassume, not eassert, to pacify gcc -fcheck-pointer-bounds -Wnull-dereference. diff --git a/lib-src/etags.c b/lib-src/etags.c index e5d76d4..6a722e0 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -1330,7 +1330,7 @@ main (int argc, char **argv) pfatal (tagfile); } - exit (EXIT_SUCCESS); + return EXIT_SUCCESS; } /* From here on, we are in (CTAGS && !cxref_style) */ @@ -1383,7 +1383,7 @@ main (int argc, char **argv) z = stpcpy (z, tagfile); *z++ = ' '; strcpy (z, tagfile); - exit (system (cmd)); + return system (cmd); } return EXIT_SUCCESS; } diff --git a/lib-src/profile.c b/lib-src/profile.c index edd36ca..cfee5b8 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c @@ -85,13 +85,13 @@ main (void) puts (get_time ()); break; case 'q': - exit (EXIT_SUCCESS); + return EXIT_SUCCESS; } /* Anything remaining on the line is ignored. */ while (c != '\n' && c != EOF) c = getchar (); } - exit (EXIT_FAILURE); + return EXIT_FAILURE; } diff --git a/src/bytecode.c b/src/bytecode.c index e2d8ab7..be39a81 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -46,7 +46,7 @@ along with GNU Emacs. If not, see . */ indirect threaded, using GCC's computed goto extension. This code, as currently implemented, is incompatible with BYTE_CODE_SAFE and BYTE_CODE_METER. */ -#if (defined __GNUC__ && !defined __STRICT_ANSI__ \ +#if (defined __GNUC__ && !defined __STRICT_ANSI__ && !defined __CHKP__ \ && !BYTE_CODE_SAFE && !defined BYTE_CODE_METER) #define BYTE_CODE_THREADED #endif diff --git a/src/menu.c b/src/menu.c index 638810b..8070967 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1540,7 +1540,7 @@ for instance using the window manager, then this produces a quit and /* Note that xw_popup_dialog can call menu code, so Vmenu_updating_frame should be set (Bug#17891). */ - eassert (f && FRAME_LIVE_P (f)); + eassume (f && FRAME_LIVE_P (f)); XSETFRAME (Vmenu_updating_frame, f); /* Force a redisplay before showing the dialog. If a frame is created commit acb5589fcd981650225e9fb2e949e3681db551c1 Author: Tino Calancha Date: Sat Nov 26 12:03:25 2016 +0900 * lisp/emacs-lisp/subr-x.el (hash-table-keys, hash-table-values): Use cl-loop. diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el index 173cd11..7d1e1c9 100644 --- a/lisp/emacs-lisp/subr-x.el +++ b/lisp/emacs-lisp/subr-x.el @@ -33,6 +33,7 @@ ;;; Code: (require 'pcase) +(eval-when-compile (require 'cl-lib)) (defmacro internal--thread-argument (first? &rest forms) @@ -146,15 +147,11 @@ to bind a single value, BINDINGS can just be a plain tuple." (defsubst hash-table-keys (hash-table) "Return a list of keys in HASH-TABLE." - (let ((keys '())) - (maphash (lambda (k _v) (push k keys)) hash-table) - keys)) + (cl-loop for k being the hash-keys of hash-table collect k)) (defsubst hash-table-values (hash-table) "Return a list of values in HASH-TABLE." - (let ((values '())) - (maphash (lambda (_k v) (push v values)) hash-table) - values)) + (cl-loop for v being the hash-values of hash-table collect v)) (defsubst string-empty-p (string) "Check whether STRING is empty." commit 8e5c0259796a5bb9e97aefdb6a431551aff6a253 Author: Simen Heggestøyl Date: Fri Nov 25 21:08:32 2016 +0100 * lisp/rot13.el: Use lexical-binding diff --git a/lisp/rot13.el b/lisp/rot13.el index 5572547..d0e4048 100644 --- a/lisp/rot13.el +++ b/lisp/rot13.el @@ -1,4 +1,4 @@ -;;; rot13.el --- display a buffer in ROT13 +;;; rot13.el --- display a buffer in ROT13 -*- lexical-binding: t -*- ;; Copyright (C) 1988, 2001-2016 Free Software Foundation, Inc. commit fc01cfc82db3878570373d31f80e486f9f33ecff Author: Mark Oteiza Date: Fri Nov 25 14:14:41 2016 -0500 Add "using" to cl-loop debug spec (Bug#24750) * lisp/emacs-lisp/cl-macs.el (cl-loop): Add element to account for "using" hash table clause. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 2ebb824..210a208 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -923,6 +923,7 @@ For more details, see Info node `(cl)Loop Facility'. "count" "maximize" "minimize" "if" "unless" "return"] form] + ["using" (symbolp symbolp)] ;; Simple default, which covers 99% of the cases. symbolp form))) (if (not (memq t (mapcar #'symbolp commit 83bf70f81ec13b1f6ba3afeba503f483bf2fcc75 Author: Hong Xu Date: Fri Nov 25 12:51:22 2016 +0200 Allow user control of progress messages in cpp.el * progmodes/cpp.el (cpp-message-min-time-interval): New defcustom. (cpp-progress-time): Use 'cpp-message-min-time-interval'. Improve the doc string. (cpp-highlight-buffer): Use 'cpp-progress-message' instead of 'message' to print messages. (Bug#24861) Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el index 7d641ab..18b0704 100644 --- a/lisp/progmodes/cpp.el +++ b/lisp/progmodes/cpp.el @@ -104,6 +104,13 @@ Each entry is a list with the following elements: (const :tag "Both branches writable" both)))) :group 'cpp) +(defcustom cpp-message-min-time-interval 1.0 + "Minimum time interval in seconds for `cpp-progress-message' messages. +If nil, `cpp-progress-message' prints no progress messages." + :type 'float + :group 'cpp + :version "26.1") + (defvar cpp-overlay-list nil) ;; List of cpp overlays active in the current buffer. (make-variable-buffer-local 'cpp-overlay-list) @@ -278,7 +285,7 @@ A prefix arg suppresses display of that buffer." (cpp-parse-close from to)) (t (cpp-parse-error "Parser error")))))))) - (message "Parsing...done")) + (cpp-progress-message "Parsing...done")) (if cpp-state-stack (save-excursion (goto-char (nth 3 (car cpp-state-stack))) @@ -819,16 +826,21 @@ BRANCH should be either nil (false branch), t (true branch) or `both'." ;;; Utilities: -(defvar cpp-progress-time 0) -;; Last time we issued a progress message. +(defvar cpp-progress-time 0 + "Last time `cpp-progress-message' issued a progress message.") (defun cpp-progress-message (&rest args) - ;; Report progress at most once a second. Take same ARGS as `message'. - (let ((time (nth 1 (current-time)))) - (if (= time cpp-progress-time) - () - (setq cpp-progress-time time) - (apply 'message args)))) + "Report progress by printing messages used by \"cpp-\" functions. + +Print messages at most once every `cpp-message-min-time-interval' seconds. +If that option is nil, don't prints messages. +ARGS are the same as for `message'." + (when cpp-message-min-time-interval + (let ((time (current-time))) + (when (>= (float-time (time-subtract time cpp-progress-time)) + cpp-message-min-time-interval) + (setq cpp-progress-time time) + (apply 'message args))))) (provide 'cpp) commit 8da61f884649e1fb98fc83f9401116df8f948a31 Author: Wojciech Gac Date: Fri Nov 25 12:41:20 2016 +0200 New input method 'polish-prefix' * lisp/leim/quail/latin-pre.el ("polish-prefix"): New input method. (Bug#24967) * etc/NEWS: Mention the new input method. Copyright-paperwork-exempt: yes diff --git a/etc/NEWS b/etc/NEWS index a65e262..0b73e5d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -260,7 +260,7 @@ roster of X keysyms. It can be used in combination with another variable of this kind to swap modifiers in Emacs. --- -** New input method: 'cyrillic-tuvan'. +** New input methods: 'cyrillic-tuvan', 'polish-prefix'. * Editing Changes in Emacs 26.1 diff --git a/lisp/leim/quail/latin-pre.el b/lisp/leim/quail/latin-pre.el index 138a97a..dd23add 100644 --- a/lisp/leim/quail/latin-pre.el +++ b/lisp/leim/quail/latin-pre.el @@ -35,6 +35,9 @@ ;; Maintainer: Włodek Bzyl ;; ;; latin-[89]-prefix: Dave Love +;; +;; polish-prefix: +;; Author: Wojciech Gac ;; You might make extra input sequences on the basis of the X ;; locale/*/Compose files (which have both prefix and postfix @@ -704,6 +707,93 @@ Key translation rules are: (".z" ?ż) ) +(quail-define-package + "polish-prefix" "Polish" "PL>" nil + "Input method for Polish, Kashubian, Kurpie and Silesian. +Similar in spirit to `polish-slash', but uses the most intuitive +prefix for each diacritic. In addition to ordinary Polish diacritics, +this input method also contains characters from the Kashubian, Kurpie +and Silesian (both Steuer and Ślabikŏrzowy szrajbōnek) scripts." + nil t t nil nil nil nil nil nil nil t) + +(quail-define-rules + (",a" ?ą) + (",A" ?Ą) + ("/a" ?á) + ("/A" ?Á) + ("'a" ?á) + ("'A" ?Á) + ("\\a" ?à) + ("\\A" ?À) + ("`a" ?à) + ("`A" ?À) + (".a" ?å) + (".A" ?Å) + ("~a" ?ã) + ("~A" ?Ã) + ("/c" ?ć) + ("/C" ?Ć) + ("'c" ?ć) + ("'C" ?Ć) + ("'e" ?é) + ("'E" ?É) + ("/e" ?é) + ("/E" ?É) + (",e" ?ę) + (",E" ?Ę) + (":e" ?ë) + (":E" ?Ë) + (":i" ?ï) + (":I" ?Ï) + ("/l" ?ł) + ("/L" ?Ł) + ("/n" ?ń) + ("/N" ?Ń) + ("'n" ?ń) + ("'N" ?Ń) + ("`o" ?ò) + ("`O" ?Ò) + ("\\o" ?ò) + ("\\O" ?Ò) + ("'o" ?ó) + ("'O" ?Ó) + ("/o" ?ó) + ("/O" ?Ó) + ("^o" ?ô) + ("^O" ?Ô) + ("-o" ?ō) + ("-O" ?Ō) + ("~o" ?õ) + ("~O" ?Õ) + ("#o" ?ŏ) + ("#O" ?Ŏ) + ("/s" ?ś) + ("/S" ?Ś) + ("'s" ?ś) + ("'S" ?Ś) + ("`u" ?ù) + ("`U" ?Ù) + (".u" ?ů) + (".U" ?Ů) + ("/z" ?ź) + ("/Z" ?Ź) + ("'z" ?ź) + ("'Z" ?Ź) + (".z" ?ż) + (".Z" ?Ż) + ;; Explicit input of prefix characters. Normally, to input a prefix + ;; character itself, one needs to press . Definitions below + ;; allow to input those characters by entering them twice. + ("//" ?/) + ("\\\\" ?\\) + ("~~" ?~) + ("''" ?') + ("::" ?:) + ("``" ?`) + ("^^" ?^) + (".." ?.) + (",," ?,) + ("--" ?-)) (quail-define-package "polish-slash" "Polish" "PL>" nil commit fd912a80cc9b88f2c0b155809b68e5f4a55bdb66 Author: Damien Cassou Date: Fri Nov 25 12:29:44 2016 +0200 * lisp/isearch.el: Add 'provide'. (Bug#25026) diff --git a/lisp/isearch.el b/lisp/isearch.el index 9418064..9846f0b 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -3328,4 +3328,6 @@ CASE-FOLD non-nil means the search was case-insensitive." (isearch-search) (isearch-update)) +(provide 'isearch) + ;;; isearch.el ends here commit f70f9a58c438d8b0677b1649ea7084d688ed53c8 Author: Philippe Vaucher Date: Fri Nov 25 12:24:22 2016 +0200 Add missing 'provide's in preloaded packages * lisp/composite.el: * lisp/replace.el: * lisp/textmodes/text-mode.el: Add provide statement. (Bug#24985) diff --git a/lisp/composite.el b/lisp/composite.el index 94b14df..53013c1 100644 --- a/lisp/composite.el +++ b/lisp/composite.el @@ -843,6 +843,8 @@ For more information on Auto Composition mode, see (defalias 'toggle-auto-composition 'auto-composition-mode) +(provide 'composite) + ;;; composite.el ends here diff --git a/lisp/replace.el b/lisp/replace.el index 60948ef..a172174 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -2644,4 +2644,6 @@ It must return a string." ""))) (or (and keep-going stack) multi-buffer))) +(provide 'replace) + ;;; replace.el ends here diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index c42eec0..30873e1 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -232,4 +232,6 @@ The argument NLINES says how many lines to center." (setq nlines (1+ nlines)) (forward-line -1))))) +(provide 'text-mode) + ;;; text-mode.el ends here