From debbugs-submit-bounces@debbugs.gnu.org Thu May 16 17:24:40 2019 Received: (at submit) by debbugs.gnu.org; 16 May 2019 21:24:40 +0000 Received: from localhost ([127.0.0.1]:56638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRNrk-0004ll-92 for submit@debbugs.gnu.org; Thu, 16 May 2019 17:24:40 -0400 Received: from eggs.gnu.org ([209.51.188.92]:36352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRNri-0004lY-Nc for submit@debbugs.gnu.org; Thu, 16 May 2019 17:24:39 -0400 Received: from lists.gnu.org ([209.51.188.17]:40015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRNrd-00070H-KN for submit@debbugs.gnu.org; Thu, 16 May 2019 17:24:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRNrc-0001LQ-N5 for bug-gnu-emacs@gnu.org; Thu, 16 May 2019 17:24:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRNrb-0006wn-1J for bug-gnu-emacs@gnu.org; Thu, 16 May 2019 17:24:32 -0400 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]:34055) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hRNra-0006oV-5X for bug-gnu-emacs@gnu.org; Thu, 16 May 2019 17:24:30 -0400 Received: by mail-ot1-x329.google.com with SMTP id l17so4865425otq.1 for ; Thu, 16 May 2019 14:24:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=user-agent:from:to:subject:date:message-id:mime-version; bh=ThQDaIt42oaRUI40k7u7o2cqlRUaOykDOTbA3GPHyjQ=; b=D5V+FZCOaAX4rwGMykKL/pSxgyF5OET/088inK4BTrPKWcprmo3FaLwnd83b3R1+MW Z2B/kmTAyV/VzRKyscCShivtO8giU20SqXJl2INsnHS5667BNLsAJGmAlYmZXk2P/FFu HBRYxPQxdaXDUMKm7XoZmGVEo4hp4ZafKcwmtnmBLQW78lgcru6m1w4jpSjpy4aDluvZ sRrcUdytr1eXspQGC5sHS6ySRw73SORQcZXsFizSbYv7ju4RYwfF0K3jxeYaOYmmExdL eUMpygtq6tZaMzU4wWnfjwTExfrItzF+/+KvIhpP5bY4gLOD/+oG68OARXKQ4rOjN6Fy TsOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:date:message-id :mime-version; bh=ThQDaIt42oaRUI40k7u7o2cqlRUaOykDOTbA3GPHyjQ=; b=IsV9u1S5Ev6jIfj7y6w8pM0dZ8xHuOFmTplnfaMlENiKpOi54kjaed9lozbZmPhY70 7uaxHXBvXQP04z7gqdZyjNky8ywyOg9niIgio+QQuWh9QQaN9u8/QBkXx+4OAyyK6GZb XLQAzXRJ6CNCTXlI8jDUchMRST3hpCrXSVoP/86iOfFsOHdxFuBEYl/QTwJm/TGHu0NO 6WsWOf2+bUqnhoVFt24T0Rd1hMQ1jcI/qF3YkTNiPmYMZnQOiT9vw1C+runWCM8TUqfH 6lwNImDFHSJMQXHwhakk/ScWCzcX5zK1Jfzmwj9fXjw1ry501AVSol2druPVoKDF2M7B cgrw== X-Gm-Message-State: APjAAAVfiRjiyzIPOKiaXRjZKVOU2vzZK8BKoPb+QIWxWlNAcrvjXuu9 ftLIXszIZWmUNLG3NROJHQROy2+H X-Google-Smtp-Source: APXvYqzepLaoyDAZ7SRpbMUsYjThMKYfMxNeYGCZPllA67otBShXG/+jr0Ue27OsVFARGcWvIUvgVA== X-Received: by 2002:a9d:6a10:: with SMTP id g16mr31233171otn.203.1558041864202; Thu, 16 May 2019 14:24:24 -0700 (PDT) Received: from mars (cpe-70-114-192-208.austin.res.rr.com. [70.114.192.208]) by smtp.gmail.com with ESMTPSA id m8sm2146980otl.40.2019.05.16.14.24.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 16 May 2019 14:24:23 -0700 (PDT) User-agent: mu4e 1.2.0; emacs 27.0.50 From: Alex Branham To: bug-gnu-emacs@gnu.org Subject: 26.1; byte compiler lost warning about calling define-key with wrong number of arguments Date: Thu, 16 May 2019 16:24:21 -0500 Message-ID: <87pnoidrei.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::329 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Save a file with this line somewhere and call it foo.el: (define-key "l" #'ignore) Then call: emacs -Q --eval "(setq byte-compile-error-on-warn t)" -batch -f batch-byte-compile foo.el it _should_ emit an error since define-key gets called with the wrong number of arguments. In Emacs 25.3, it does. In Emacs 26.1 and Emacs built recently from git master, it does not. Alex From debbugs-submit-bounces@debbugs.gnu.org Mon May 27 20:59:44 2019 Received: (at 35767) by debbugs.gnu.org; 28 May 2019 00:59:44 +0000 Received: from localhost ([127.0.0.1]:54591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hVQSu-0001NU-5F for submit@debbugs.gnu.org; Mon, 27 May 2019 20:59:44 -0400 Received: from mail-io1-f50.google.com ([209.85.166.50]:34600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hVQSp-0001Mu-TZ; Mon, 27 May 2019 20:59:40 -0400 Received: by mail-io1-f50.google.com with SMTP id k8so1316250iot.1; Mon, 27 May 2019 17:59:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ajSE2AEsgcaYnPn3+eVavcqCYPxJrVRJ8lfRD0Y2Wtc=; b=utOtc3mwmynGLI55wE9yZ+G3rlFTG9K4aYJjigS6X7o71jJHrDf4RIg9kB6eosl2bT KmLmsnLxSyd/iduk7CH7qS85URzjoSpnD3Zq81u+JNmNIIPkcWIquCoHN2wmxXC+F4vH gHuFOiv+QAMOE8aVOmDoKSVDN91NkZM6d0Ebhum3tmS8rt0yJ5L7+5EgOndxAvykdnIQ HMF47u1J+aL2KFKsSTr80zqKpC+k0WCcbdvu9+ouC0eE15IgtI5GOnx71v+GE/1KU88r MBwsfbRT3xTpOhnB89WOWTE7ySwJPscuBKtwVRrkgh65bNvnpa82W1fYRA3eWxbWLHOR ixyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=ajSE2AEsgcaYnPn3+eVavcqCYPxJrVRJ8lfRD0Y2Wtc=; b=Bog95HTDYdeBZT/dtaPGVggzTQsW9pcsQWuHjO4E5wwIl3pitbL6C3tQa+IcF/Ogm0 mzwvuYVjk0nZJE2yC7tF9bZ1l9VvV7/ck1dkx/BydxADNlwG9BRW/RylPmvC+/OB2OjI C5v60rtE/fcJofjEjwWyfrwp3wd0jtL6vyit69+lQerspuuo5UGuYh/3hQ1ub42B1cv2 dfOui/7Le1Hn9ZwsJGkhcamNbIibuGUsc+forggOli2YDsrzdrCd1JxUTczEcD3k8C8q WtmRxWjHHLbnBNsdXUNfWXy+/21wsgXWpDTNvJCoDAGw7QRTOG8NDElvdwcQQnbBrHyt XhUQ== X-Gm-Message-State: APjAAAVHhPoEmEE5223H/dX8iVUwE8FvugNPaHW27OHftY2KME92+I28 0qF2LIBWh+0APDpvQriW+eZM7Yf0 X-Google-Smtp-Source: APXvYqx42SmyYMOgiUBn4CgwLaozhV2hqlLoe/Oo4nTLsqQKTG9ojnkIPBeYO1bMtotyC+2qZgG/4Q== X-Received: by 2002:a6b:e61a:: with SMTP id g26mr4561863ioh.300.1559005173970; Mon, 27 May 2019 17:59:33 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id a11sm571527itc.42.2019.05.27.17.59.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 May 2019 17:59:32 -0700 (PDT) From: Noam Postavsky To: Alex Branham Subject: Re: bug#35767: 26.1; byte compiler lost warning about calling define-key with wrong number of arguments References: <87pnoidrei.fsf@gmail.com> Date: Mon, 27 May 2019 20:59:30 -0400 In-Reply-To: <87pnoidrei.fsf@gmail.com> (Alex Branham's message of "Thu, 16 May 2019 16:24:21 -0500") Message-ID: <87sgsz75sd.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35767 Cc: 35767@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tags 35767 + patch quit Alex Branham writes: > (define-key "l" #'ignore) > > Then call: > > emacs -Q --eval "(setq byte-compile-error-on-warn t)" -batch -f batch-byt= e-compile foo.el > > it _should_ emit an error since define-key gets called with the wrong > number of arguments. In Emacs 25.3, it does. In Emacs 26.1 and Emacs > built recently from git master, it does not. Specifically, Emacs 26+ doesn't warn about wrong number of arguments to subrs. The fix seems simple enough to apply to emacs-26. Minor caveat, some subrs (e.g., length) get warned about twice (with slightly different wording each time), but this occurs in 25.3 as well, so I guess it's acceptable: Warning: =E2=80=98length=E2=80=99 called with 3 args, but requires 1 Warning: length called with 3 arguments, but accepts only 1 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Warn-about-wrong-number-of-args-for-subrs-Bug-35767.patch Content-Description: patch >From 050b2bd3041d3d856dcb5ff6adfa75e8a63d8032 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Mon, 27 May 2019 20:36:41 -0400 Subject: [PATCH] Warn about wrong number of args for subrs (Bug#35767) * lisp/emacs-lisp/bytecomp.el (byte-compile-callargs-warn): Don't assume byte-compile-fdefinition will return non-nil. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn-wrong-args) (bytecomp-warn-wrong-args-subr): New tests. --- lisp/emacs-lisp/bytecomp.el | 2 +- test/lisp/emacs-lisp/bytecomp-tests.el | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 9ea4179b68..72e81a653c 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1379,7 +1379,7 @@ (defun byte-compile-function-warn (f nargs def) (defun byte-compile-callargs-warn (form) (let* ((def (or (byte-compile-fdefinition (car form) nil) (byte-compile-fdefinition (car form) t))) - (sig (byte-compile--function-signature def)) + (sig (byte-compile--function-signature (or def (car form)))) (ncall (length (cdr form)))) ;; Check many or unevalled from subr-arity. (if (and (cdr-safe sig) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index bc28c5a6a0..c399f65b40 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -438,6 +438,20 @@ (ert-deftest bytecomp-tests--warnings () ;; Should not warn that mt--test2 is not known to be defined. (should-not (re-search-forward "my--test2" nil t)))) +(ert-deftest bytecomp-warn-wrong-args () + (with-current-buffer (get-buffer-create "*Compile-Log*") + (let ((inhibit-read-only t)) (erase-buffer)) + (byte-compile '(remq 1 2 3)) + (ert-info ((buffer-string) :prefix "buffer: ") + (should (re-search-forward "remq.*3.*2"))))) + +(ert-deftest bytecomp-warn-wrong-args-subr () + (with-current-buffer (get-buffer-create "*Compile-Log*") + (let ((inhibit-read-only t)) (erase-buffer)) + (byte-compile '(safe-length 1 2 3)) + (ert-info ((buffer-string) :prefix "buffer: ") + (should (re-search-forward "safe-length.*3.*1"))))) + (ert-deftest test-eager-load-macro-expansion () (test-byte-comp-compile-and-load nil '(progn (defmacro abc (arg) 1) (defun def () (abc 2)))) -- 2.11.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu May 30 18:51:48 2019 Received: (at 35767) by debbugs.gnu.org; 30 May 2019 22:51:49 +0000 Received: from localhost ([127.0.0.1]:34302 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWTtk-0006W7-Ij for submit@debbugs.gnu.org; Thu, 30 May 2019 18:51:48 -0400 Received: from mail-it1-f174.google.com ([209.85.166.174]:52080) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hWTti-0006Vo-9Y; Thu, 30 May 2019 18:51:46 -0400 Received: by mail-it1-f174.google.com with SMTP id m3so12734702itl.1; Thu, 30 May 2019 15:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=KHVpt1vTI2S8YF+ZDfByeUwDOsLlkciCAFcWx1EfWSw=; b=Ly05r3G+Q9FkDyn0keZPy0yG+hLpNHGy7hxWqp/K/WOjVoevZiCBEmm8jFTdCaLxSv 9R+Ko3VVvryvK3fYVly338P38tf18KyRqkF2OscLyzPn/13vJ5TzSFtaW7AO1jO4F6jA QsuYHmFzQbmi5b8eRdjJ9g/rgCI9WSOqbekOhiFK7JoEac9wtlCQYV0wyUlA/OctTDxk QfH0ob3YCL0PFe6AwPFq93Ee9HfvYE+FuXyJhOHJumhe2yU4ok2TsjffOEtZyKBi9QfA zza5W4aJWW+YBKfEsafY2VQmh+aEh+WvVx1b2426Lx3WXVhAiZDil9iS8M6ThMEtC6Oh mt6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=KHVpt1vTI2S8YF+ZDfByeUwDOsLlkciCAFcWx1EfWSw=; b=PITKTL2o8RuwfboZi3rEFLH0DBANnywfmBAdqx+JUxe5dL51HosiX7gbVX795OeQuA 8R+Gl+0ygkoX38E3Q/dtr/8n3m/f1sBUZAjU2aJbQWiyyHz7fz+ijRY37/7C6ere5xDz th+JlERzvqk7qI5v9X4Mo44oG4ldjJxCGdSahud0cGeIVUgmnskNcP7PXkTkw3dJ3Gnc 52nL45GwklcE2xKCbrmi/coz7B5mAymYQ+e56Lg7NbupdDIgRLKLqXwID5Yt9oZl5raa Kmqiis905/THFmbd2/SPIb69lPs8E7AItPfoHNq5p5Xl2Avpt6bNEA4VzJL0k7ql82fI jaVA== X-Gm-Message-State: APjAAAWLFeWdaoep9llbEBfBGENuEb3dQNzv/p7c7EA/WsBQy0JkjBPN 3GfcsICjwn84vEYybogssxs/gD39 X-Google-Smtp-Source: APXvYqzZXWGDoMvFM8NFg8XFitd2yYEHSvHDLYi78eH2sELlpHBT8eR3x3Nqbvwf/sQQo2s9mVc1dQ== X-Received: by 2002:a24:28c1:: with SMTP id h184mr5327494ith.105.1559256700337; Thu, 30 May 2019 15:51:40 -0700 (PDT) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id s10sm1326567iob.29.2019.05.30.15.51.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 May 2019 15:51:39 -0700 (PDT) From: Noam Postavsky To: Alex Branham Subject: Re: bug#35767: 26.1; byte compiler lost warning about calling define-key with wrong number of arguments References: <87pnoidrei.fsf@gmail.com> <87sgsz75sd.fsf@gmail.com> Date: Thu, 30 May 2019 18:51:38 -0400 In-Reply-To: <87sgsz75sd.fsf@gmail.com> (Noam Postavsky's message of "Mon, 27 May 2019 20:59:30 -0400") Message-ID: <874l5b7dz9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35767 Cc: 35767@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 35767 fixed close 35767 26.3 quit > Subject: [PATCH] Warn about wrong number of args for subrs (Bug#35767) > > * lisp/emacs-lisp/bytecomp.el (byte-compile-callargs-warn): Don't > assume byte-compile-fdefinition will return non-nil. > * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-warn-wrong-args) > (bytecomp-warn-wrong-args-subr): New tests. Pushed to emacs-26. 134edc1036 2019-05-30T18:46:07-04:00 "Warn about wrong number of args for subrs (Bug#35767)" https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=134edc10367a8434167656e631865c85b5f10c42 From unknown Sun Aug 17 10:10:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 28 Jun 2019 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator