From 109ca1bd00b56ba66b123b505d8c2187fded0ef7 Mon Sep 17 00:00:00 2001 From: Mattias EngdegÄrd Date: Thu, 22 Jul 2021 15:00:17 +0200 Subject: Warn about arity errors in inlining calls (bug#12299) Wrong number of arguments in inlining function calls (to `defsubst` or explicitly using `inline`) did not result in warnings, or in very cryptic ones. * lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand): Add calls to `byte-compile--check-arity-bytecode`. * lisp/emacs-lisp/bytecomp.el (byte-compile-emit-callargs-warn) (byte-compile--check-arity-bytecode): New functions. (byte-compile-callargs-warn): Use factored-out function. * test/lisp/emacs-lisp/bytecomp-resources/warn-callargs-defsubst.el: * test/lisp/emacs-lisp/bytecomp-tests.el ("warn-callargs-defsubst.el"): New test case. --- test/lisp/emacs-lisp/bytecomp-resources/warn-callargs-defsubst.el | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/warn-callargs-defsubst.el (limited to 'test/lisp/emacs-lisp/bytecomp-resources/warn-callargs-defsubst.el') diff --git a/test/lisp/emacs-lisp/bytecomp-resources/warn-callargs-defsubst.el b/test/lisp/emacs-lisp/bytecomp-resources/warn-callargs-defsubst.el new file mode 100644 index 00000000000..3a29128cf3a --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/warn-callargs-defsubst.el @@ -0,0 +1,5 @@ +;;; -*- lexical-binding: t -*- +(defsubst warn-callargs-defsubst-f1 (_x) + nil) +(defun warn-callargs-defsubst-f2 () + (warn-callargs-defsubst-f1 1 2)) -- cgit v1.2.3