From 5fcb97dabd3f7b00ebc574d6be4bad16a64482de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Wed, 19 Aug 2020 14:59:29 +0200 Subject: [PATCH 1/7] Fix cond jump table compilation (bug#42919) This bug affected compilation of (cond ((member '(some list) variable) ...) ...) While equal is symmetric, member is not; in the latter case the arguments must be a variable and a constant list, in that order. Reported by Ikumi Keita. * lisp/emacs-lisp/bytecomp.el (byte-compile--cond-switch-prefix): Don't treat equality and member predicates in the same way; only the former are symmetric in their arguments. * test/lisp/emacs-lisp/bytecomp-tests.el (byte-opt-testsuite-arith-data): Add test cases. --- lisp/emacs-lisp/bytecomp.el | 52 ++++++++++++++------------ test/lisp/emacs-lisp/bytecomp-tests.el | 15 +++++++- 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 5479e6536a3..90745a3a2f3 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -4172,40 +4172,44 @@ Return (TAIL VAR TEST CASES), where: (switch-var nil) (switch-test 'eq)) (while (pcase (car clauses) - (`((,fn ,expr1 ,expr2) . ,body) + (`((,(and fn (or 'eq 'eql 'equal)) ,expr1 ,expr2) . ,body) (let* ((vars (byte-compile--cond-vars expr1 expr2)) (var (car vars)) (value (cdr vars))) (and var (or (eq var switch-var) (not switch-var)) - (cond - ((memq fn '(eq eql equal)) + (progn (setq switch-var var) (setq switch-test (byte-compile--common-test switch-test fn)) (unless (member value keys) (push value keys) (push (cons (list value) (or body '(t))) cases)) - t) - ((and (memq fn '(memq memql member)) - (listp value) - ;; Require a non-empty body, since the member - ;; function value depends on the switch - ;; argument. - body) - (setq switch-var var) - (setq switch-test - (byte-compile--common-test - switch-test (cdr (assq fn '((memq . eq) - (memql . eql) - (member . equal)))))) - (let ((vals nil)) - (dolist (elem value) - (unless (funcall fn elem keys) - (push elem vals))) - (when vals - (setq keys (append vals keys)) - (push (cons (nreverse vals) body) cases))) - t)))))) + t)))) + (`((,(and fn (or 'memq 'memql 'member)) ,var ,expr) . ,body) + (and (symbolp var) + (or (eq var switch-var) (not switch-var)) + (macroexp-const-p expr) + ;; Require a non-empty body, since the member + ;; function value depends on the switch argument. + body + (let ((value (eval expr))) + (and (proper-list-p value) + (progn + (setq switch-var var) + (setq switch-test + (byte-compile--common-test + switch-test + (cdr (assq fn '((memq . eq) + (memql . eql) + (member . equal)))))) + (let ((vals nil)) + (dolist (elem value) + (unless (funcall fn elem keys) + (push elem vals))) + (when vals + (setq keys (append vals keys)) + (push (cons (nreverse vals) body) cases))) + t)))))) (setq clauses (cdr clauses))) ;; Assume that a single switch is cheaper than two or more discrete ;; compare clauses. This could be tuned, possibly taking into diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index a16adfedfb8..3aba9af3e79 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -347,7 +347,20 @@ ((eq x 't) 99) (t 999)))) '((a c) (b c) (7 c) (-3 c) (nil nil) (t c) (q c) (r c) (s c) - (t c) (x "a") (x "c") (x c) (x d) (x e)))) + (t c) (x "a") (x "c") (x c) (x d) (x e))) + + (mapcar (lambda (x) (cond ((member '(a . b) x) 1) + ((equal x '(c)) 2))) + '(((a . b)) a b (c) (d))) + (mapcar (lambda (x) (cond ((memq '(a . b) x) 1) + ((equal x '(c)) 2))) + '(((a . b)) a b (c) (d))) + (mapcar (lambda (x) (cond ((member '(a b) x) 1) + ((equal x '(c)) 2))) + '(((a b)) a b (c) (d))) + (mapcar (lambda (x) (cond ((memq '(a b) x) 1) + ((equal x '(c)) 2))) + '(((a b)) a b (c) (d)))) "List of expression for test. Each element will be executed by interpreter and with bytecompiled code, and their results compared.") From 121be3e1181e609734fc4cc9d2d54cf7eec18ab2 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 19 Aug 2020 19:51:52 +0200 Subject: [PATCH 2/7] ; * etc/NEWS: Remove temporary note on documentation. (Bug#42917) --- etc/NEWS | 8 -------- 1 file changed, 8 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index f1f4151ab2a..c44b5137c5c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -15,12 +15,6 @@ in older Emacs versions. You can narrow news to a specific version by calling 'view-emacs-news' with a prefix argument or by typing 'C-u C-h C-n'. -Temporary note: -+++ indicates that all relevant manuals in doc/ have been updated. ---- means no change in the manuals is needed. -When you add a new item, use the appropriate mark if you are sure it -applies, and please also update docstrings as needed. - * Installation Changes in Emacs 27.2 @@ -53,7 +47,6 @@ This is a bug-fix release with no new features. * Installation Changes in Emacs 27.1 ---- ** Emacs now uses GMP, the GNU Multiple Precision library. By default, if 'configure' does not find a suitable libgmp, it arranges for the included mini-gmp library to be built and used. @@ -87,7 +80,6 @@ that building with Cairo enabled results in using Pango instead of libXft for font support, and that Pango 1.44 has removed support for bitmapped fonts. -+++ ** Emacs now uses a "portable dumper" instead of unexec. This improves compatibility with memory allocation on modern systems, and in particular better supports the Address Space Layout From 16f00e36dc2292db08e7bc88bd25e55c0cbf99f7 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Wed, 19 Aug 2020 20:52:08 +0100 Subject: [PATCH 3/7] * admin/admin.el (set-version): Trap yet another NEWS error. --- admin/admin.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/admin.el b/admin/admin.el index 923f0100820..310cd54e957 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -151,7 +151,7 @@ Root must be the root of an Emacs source tree." (display-warning 'admin "NEWS file contains empty sections - remove them?")) (goto-char (point-min)) - (if (re-search-forward "^\\(\\+\\+\\+ *\\|--- *\\)$" nil t) + (if (re-search-forward "^\\(\\+\\+\\+ *$\\|--- *$\\|Temporary note:\\)" nil t) (display-warning 'admin "NEWS file still contains temporary markup. Documentation changes might not have been completed!")))) From d3a4ce84201c5ea837cc2ddeba2fa01d67f7e6ab Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 19 Aug 2020 20:57:22 +0200 Subject: [PATCH 4/7] Revert "; * etc/NEWS: Remove temporary note on documentation. (Bug#42917)" This reverts commit 121be3e1181e609734fc4cc9d2d54cf7eec18ab2. --- etc/NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index c44b5137c5c..2571108c9ee 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -15,6 +15,12 @@ in older Emacs versions. You can narrow news to a specific version by calling 'view-emacs-news' with a prefix argument or by typing 'C-u C-h C-n'. +Temporary note: ++++ indicates that all relevant manuals in doc/ have been updated. +--- means no change in the manuals is needed. +When you add a new item, use the appropriate mark if you are sure it +applies, and please also update docstrings as needed. + * Installation Changes in Emacs 27.2 From 4e2caef38499873ef801029e30357a023e939929 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Fri, 21 Aug 2020 18:15:05 +0300 Subject: [PATCH 5/7] ; * src/character.c (str_as_multibyte): Fix the commentary. --- src/character.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/character.c b/src/character.c index 5d419a2e836..97065e17f01 100644 --- a/src/character.c +++ b/src/character.c @@ -550,9 +550,9 @@ parse_str_as_multibyte (const unsigned char *str, ptrdiff_t len, /* Arrange unibyte text at STR of NBYTES bytes as a multibyte text. It actually converts only such 8-bit characters that don't construct - a multibyte sequence to multibyte forms of Latin-1 characters. If - NCHARS is nonzero, set *NCHARS to the number of characters in the - text. It is assured that we can use LEN bytes at STR as a work + a multibyte sequence to multibyte forms of raw bytes. If NCHARS + is nonzero, set *NCHARS to the number of characters in the text. + It is assured that we can use LEN bytes at STR as a work area and that is enough. Return the number of bytes of the resulting text. */ From e26e63444d38933809b82b1577313b4343b4f38b Mon Sep 17 00:00:00 2001 From: Phillip Lord Date: Mon, 24 Aug 2020 22:14:01 +0100 Subject: [PATCH 6/7] Add Feature testing for Windows binaries * etc/w32-feature.el: New file --- etc/w32-feature.el | 87 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 etc/w32-feature.el diff --git a/etc/w32-feature.el b/etc/w32-feature.el new file mode 100644 index 00000000000..458a24350d0 --- /dev/null +++ b/etc/w32-feature.el @@ -0,0 +1,87 @@ +;;; w32-feature.el --- Check Availability of Emacs Features -*- lexical-binding: t -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; Author: Phillip Lord + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +;; This file provides tests for various features of Emacs. It is +;; designed to check whether bundled binary distributions of Emacs on +;; windows are fully functional. + +;;; Code: +(require 'ert) + +(ert-deftest feature-optimization () + (should + (string-match-p "CFLAGS=-O2" system-configuration-options))) + +(ert-deftest feature-harfbuzz () + (should + (eq + 'harfbuzz + (car (frame-parameter nil 'font-backend))))) + +(ert-deftest feature-gnutls () + (should (gnutls-available-p))) + +(ert-deftest feature-zlib () + (should (zlib-available-p))) + +(ert-deftest feature-thread () + (should (fboundp 'make-thread))) + +(ert-deftest feature-json () + (should + (fboundp 'json-serialize))) + +(ert-deftest feature-gmp () + (should + (string-match-p "GMP" system-configuration-options))) + +(ert-deftest feature-module () + (should (fboundp 'module-load))) + +(ert-deftest feature-libxml () + (should (libxml-available-p))) + +(ert-deftest feature-lcms2 () + (should (lcms2-available-p))) + +(ert-deftest feature-xpm () + (should (image-type-available-p 'xpm))) + +(ert-deftest feature-gif () + (should (image-type-available-p 'gif))) + +(ert-deftest feature-png () + (should (image-type-available-p 'png))) + +(ert-deftest feature-xpm () + (should (image-type-available-p 'xpm))) + +(ert-deftest feature-jpeg () + (should (image-type-available-p 'jpeg))) + +(ert-deftest feature-tiff () + (should (image-type-available-p 'tiff))) + +(ert-deftest feature-svg () + (should (image-type-available-p 'svg))) +;;; feature.el ends here From 44104a607aeb7fd73bf7edcbbe6a508eee36dd0f Mon Sep 17 00:00:00 2001 From: Phillip Lord Date: Mon, 24 Aug 2020 22:44:21 +0100 Subject: [PATCH 7/7] Fix error in GMP test * etc/w32-feature.el: Update to use system-configuration-features for GMP test. --- etc/w32-feature.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/w32-feature.el b/etc/w32-feature.el index 458a24350d0..3c0f74175cf 100644 --- a/etc/w32-feature.el +++ b/etc/w32-feature.el @@ -53,7 +53,7 @@ (ert-deftest feature-gmp () (should - (string-match-p "GMP" system-configuration-options))) + (string-match-p "GMP" system-configuration-features))) (ert-deftest feature-module () (should (fboundp 'module-load)))