summaryrefslogtreecommitdiff
path: root/test/src/comp-tests.el
diff options
context:
space:
mode:
authorStephen Gildea <stepheng+emacs@gildea.com>2021-11-26 08:51:38 -0800
committerStephen Gildea <stepheng+emacs@gildea.com>2021-11-26 08:51:38 -0800
commit11860f89a593a8cfe7efb94e86370bbbe4318fba (patch)
tree6addcc49642d94dfa8c780644f4474d01d60c218 /test/src/comp-tests.el
parentdd6b151c25551fe125d61a54890756d9454cc402 (diff)
downloademacs-11860f89a593a8cfe7efb94e86370bbbe4318fba.tar.gz
* test/src/comp-tests.el: Eliminate byte-compiler warnings (Bug#52105).
Diffstat (limited to 'test/src/comp-tests.el')
-rw-r--r--test/src/comp-tests.el37
1 files changed, 27 insertions, 10 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 025bc2058ec..f66a1932058 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -27,14 +27,23 @@
(require 'ert)
(require 'ert-x)
-(require 'cl-lib)
-
-(defconst comp-test-src (ert-resource-file "comp-test-funcs.el"))
-
-(defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el"))
-
-(when (featurep 'native-compile)
- (require 'comp)
+(eval-when-compile
+ (require 'cl-lib)
+ (require 'comp))
+(eval-and-compile
+ (require 'comp-cstr) ;in eval-and-compile for its defstruct
+ (defconst comp-test-src (ert-resource-file "comp-test-funcs.el"))
+ (defconst comp-test-dyn-src (ert-resource-file "comp-test-funcs-dyn.el"))
+ (defconst comp-test-pure-src (ert-resource-file "comp-test-pure.el"))
+ (defconst comp-test-45603-src (ert-resource-file "comp-test-45603.el"))
+ ;; Load the test code here so the compiler can check the function
+ ;; names used in this file.
+ (load comp-test-src nil t)
+ (load comp-test-dyn-src nil t)
+ (load comp-test-pure-src nil t)
+ (load comp-test-45603-src nil t))
+
+(when (native-comp-available-p)
(message "Compiling tests...")
(load (native-compile comp-test-src))
(load (native-compile comp-test-dyn-src)))
@@ -352,6 +361,8 @@ Check that the resulting binaries do not differ."
comp-test-interactive-form2-f)))
(should-not (commandp #'comp-tests-doc-f)))
+(declare-function comp-tests-free-fun-f nil)
+
(comp-deftest free-fun ()
"Check we are able to compile a single function."
(eval '(defun comp-tests-free-fun-f ()
@@ -369,6 +380,8 @@ Check that the resulting binaries do not differ."
(should (equal (interactive-form #'comp-tests-free-fun-f)
'(interactive))))
+(declare-function comp-tests/free\fun-f nil)
+
(comp-deftest free-fun-silly-name ()
"Check we are able to compile a single function."
(eval '(defun comp-tests/free\fun-f ()) t)
@@ -493,7 +506,7 @@ https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-03/msg00914.html."
(comp-deftest 45603-1 ()
"<https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-12/msg01994.html>"
- (load (native-compile (ert-resource-file "comp-test-45603.el")))
+ (load (native-compile comp-test-45603-src))
(should (fboundp #'comp-test-45603--file-local-name)))
(comp-deftest 46670-1 ()
@@ -786,6 +799,8 @@ Return a list of results."
(comp-tests-mentioned-p (comp-c-func-name 'comp-tests-tco-f "F" t)
insn)))))))
+(declare-function comp-tests-tco-f nil)
+
(comp-deftest tco ()
"Check for tail recursion elimination."
(let ((native-comp-speed 3)
@@ -814,6 +829,8 @@ Return a list of results."
(or (comp-tests-mentioned-p 'concat insn)
(comp-tests-mentioned-p 'length insn)))))))
+(declare-function comp-tests-fw-prop-1-f nil)
+
(comp-deftest fw-prop-1 ()
"Some tests for forward propagation."
(let ((native-comp-speed 2)
@@ -1404,7 +1421,7 @@ folded."
(let ((native-comp-speed 3)
(comp-post-pass-hooks '((comp-final comp-tests-pure-checker-1
comp-tests-pure-checker-2))))
- (load (native-compile (ert-resource-file "comp-test-pure.el")))
+ (load (native-compile comp-test-pure-src))
(should (subr-native-elisp-p (symbol-function #'comp-tests-pure-caller-f)))
(should (= (comp-tests-pure-caller-f) 4))