diff options
| author | Alan Mackenzie | 2023-07-19 11:23:00 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2023-07-19 11:26:11 +0000 |
| commit | f9f9c95ab578dee680093cf3f1e618c770fc22c3 (patch) | |
| tree | c8d0ed4236bd42f6db3d9751b4a4fbb03a260375 /test/src | |
| parent | fb5e43040fed987418e8855c677aa44e36f67e33 (diff) | |
| download | emacs-f9f9c95ab578dee680093cf3f1e618c770fc22c3.tar.gz emacs-f9f9c95ab578dee680093cf3f1e618c770fc22c3.zip | |
Fix native compilation in dynamically bound files.
This fixes bug#64642.
* lisp/emacs-lisp/comp.el (comp-spill-lap-function/symbol): Add
code for dynamically bound functions.
* test/src/comp-tests.el (comp-tests-result-lambda): New test.
* test/src/comp-resources/comp-test-funcs-dyn2.el: New test
file.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up to date with 'origin/master'.
#
# Changes to be committed:
# modified: lisp/emacs-lisp/comp.el
# new file: test/src/comp-resources/comp-test-funcs-dyn2.el
# modified: test/src/comp-tests.el
#
# Changes not staged for commit:
# modified: .gitignore
#
# Untracked files:
# .gitignore.acm
# .gitignore.backup
# .timestamps.txt
# 2021-01-03.err
# 2021-01-06.err
# 2021-12-16.make
# 2021-12-30.err
# 2021-12-31.err
# 2022-01-01.err
# 2022-01-02.check.err
# 2022-01-02.err
# 2022-01-04.err
# 2022-01-05.err
# 2022-01-06.err
# 2022-01-07.err
# 2022-01-07.outerr
# 2022-01-08.err
# 2022-01-09.err
# 2022-01-09b.err
# 2022-01-10.err
# 2022-01-11
# 2022-01-11.err
# 2022-02-22.err
# 2022-02-22.outerr
# checkout.20220228.out
# checkout.20220301.out
# checkout.20220302.out
# doc/lispref/syntax.20160318.techsi
# doc/lispref/syntax.20160318b.techsi
# lib/.deps/
# lisp/2022-01-09.err
# lisp/emacs-lisp/comp.el.rej
# src/2021-12-20.err
# src/globals.20211124.aitch
# src/lisp.20211127.aitch
# test/lisp/calendar/icalendar-tests.elcr5m9Wq
#
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/comp-resources/comp-test-funcs-dyn2.el | 31 | ||||
| -rw-r--r-- | test/src/comp-tests.el | 7 |
2 files changed, 37 insertions, 1 deletions
diff --git a/test/src/comp-resources/comp-test-funcs-dyn2.el b/test/src/comp-resources/comp-test-funcs-dyn2.el new file mode 100644 index 00000000000..3d70489d1ca --- /dev/null +++ b/test/src/comp-resources/comp-test-funcs-dyn2.el | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | ;;; comp-test-funcs-dyn2.el -*- lexical-binding: nil; no-byte-compile: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2023 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Alan Mackenzie <acm@muc.de> | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | ;; it under the terms of the GNU General Public License as published by | ||
| 11 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 12 | ;; (at your option) any later version. | ||
| 13 | |||
| 14 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | ;; GNU General Public License for more details. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | ;; Test the compilation of a function under dynamic binding. | ||
| 24 | |||
| 25 | ;;; Code: | ||
| 26 | |||
| 27 | (defun comp-tests-result-lambda () | ||
| 28 | (lambda (bar) (car bar))) | ||
| 29 | |||
| 30 | (provide 'comp-test-funcs-dyn2) | ||
| 31 | ;;; comp-test-funcs-dyn2.el ends here. | ||
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index ce7899d9d4c..30dfd669ded 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el | |||
| @@ -33,7 +33,8 @@ | |||
| 33 | 33 | ||
| 34 | (eval-and-compile | 34 | (eval-and-compile |
| 35 | (defconst comp-test-src (ert-resource-file "comp-test-funcs.el")) | 35 | (defconst comp-test-src (ert-resource-file "comp-test-funcs.el")) |
| 36 | (defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el"))) | 36 | (defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el")) |
| 37 | (defconst comp-test-dyn-src2 (ert-resource-file "comp-test-funcs-dyn2.el"))) | ||
| 37 | 38 | ||
| 38 | (when (native-comp-available-p) | 39 | (when (native-comp-available-p) |
| 39 | (message "Compiling tests...") | 40 | (message "Compiling tests...") |
| @@ -44,6 +45,7 @@ | |||
| 44 | ;; names used in this file. | 45 | ;; names used in this file. |
| 45 | (require 'comp-test-funcs comp-test-src) | 46 | (require 'comp-test-funcs comp-test-src) |
| 46 | (require 'comp-test-dyn-funcs comp-test-dyn-src) ;Non-standard feature name! | 47 | (require 'comp-test-dyn-funcs comp-test-dyn-src) ;Non-standard feature name! |
| 48 | (require 'comp-test-funcs-dyn2 comp-test-dyn-src2) | ||
| 47 | 49 | ||
| 48 | (defmacro comp-deftest (name args &rest docstring-and-body) | 50 | (defmacro comp-deftest (name args &rest docstring-and-body) |
| 49 | "Define a test for the native compiler tagging it as :nativecomp." | 51 | "Define a test for the native compiler tagging it as :nativecomp." |
| @@ -1528,4 +1530,7 @@ folded." | |||
| 1528 | (equal (comp-mvar-typeset mvar) | 1530 | (equal (comp-mvar-typeset mvar) |
| 1529 | comp-tests-cond-rw-expected-type)))))))) | 1531 | comp-tests-cond-rw-expected-type)))))))) |
| 1530 | 1532 | ||
| 1533 | (ert-deftest comp-tests-result-lambda () | ||
| 1534 | (native-compile 'comp-tests-result-lambda) | ||
| 1535 | (should (eq (funcall (comp-tests-result-lambda) '(a . b)) 'a))) | ||
| 1531 | ;;; comp-tests.el ends here | 1536 | ;;; comp-tests.el ends here |