* bug#33314: 27.0.50; wrong compiler warning @ 2018-11-08 14:38 Andreas Röhler [not found] ` <mailman.3649.1541688141.1284.bug-gnu-emacs@gnu.org> 0 siblings, 1 reply; 5+ messages in thread From: Andreas Röhler @ 2018-11-08 14:38 UTC (permalink / raw) To: 33314 Get a compiler Warning: Unused lexical variable ‘regexp’ WRT a form like below: (defun foo (regexp &optional something) "..." (unless (bobp) (when (empty-line-p) (skip-chars-backward " \t\r\n\f")) (let* ((orig (point)) (regexpvalue (if (eq regexp 'py-clause-re) (symbol-value 'py-extended-block-or-clause-re) (symbol-value regexp))) ... ;; As visible, regexp is evaluated in last clause. Thanks, Andreas GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.14.5) of 2018-10-13 ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <mailman.3649.1541688141.1284.bug-gnu-emacs@gnu.org>]
* bug#33314: 27.0.50; wrong compiler warning [not found] ` <mailman.3649.1541688141.1284.bug-gnu-emacs@gnu.org> @ 2018-11-08 15:54 ` Alan Mackenzie 2018-11-08 16:41 ` Andreas Röhler 0 siblings, 1 reply; 5+ messages in thread From: Alan Mackenzie @ 2018-11-08 15:54 UTC (permalink / raw) To: Andreas Röhler; +Cc: 33314 Hello, Andreas. In article <mailman.3649.1541688141.1284.bug-gnu-emacs@gnu.org> you wrote: > Get a compiler Warning: Unused lexical variable ‘regexp’ > WRT a form like below: > (defun foo (regexp &optional something) > "..." > (unless (bobp) > (when (empty-line-p) (skip-chars-backward " \t\r\n\f")) > (let* ((orig (point)) > (regexpvalue (if (eq regexp 'py-clause-re) (symbol-value > 'py-extended-block-or-clause-re) (symbol-value regexp))) > ... Reformatting that to make things clearer: (defun foo (regexp &optional something) "..." (unless (bobp) (when (empty-line-p) (skip-chars-backward " \t\r\n\f")) (let* ((orig (point)) (regexpvalue (if (eq regexp 'py-clause-re) (symbol-value 'py-extended-block-or-clause-re) (symbol-value regexp))) > ;; > As visible, regexp is evaluated in last clause. Does the rest of that let* form use regexpvalue? If not, the lack of use of regexpvalue will, I believe, transfer to regexp. Incidentally, why write (symbol-value 'py-extended-block-or-clause-re) rather than just py-extended-block-or-clause-re? > Thanks, > Andreas > GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.14.5) of > 2018-10-13 -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#33314: 27.0.50; wrong compiler warning 2018-11-08 15:54 ` Alan Mackenzie @ 2018-11-08 16:41 ` Andreas Röhler 2018-11-09 1:11 ` Noam Postavsky 0 siblings, 1 reply; 5+ messages in thread From: Andreas Röhler @ 2018-11-08 16:41 UTC (permalink / raw) To: Alan Mackenzie; +Cc: 33314 On 08.11.2018 16:54, Alan Mackenzie wrote: > Hello, Andreas. > > In article <mailman.3649.1541688141.1284.bug-gnu-emacs@gnu.org> you wrote: >> Get a compiler Warning: Unused lexical variable ‘regexp’ > >> WRT a form like below: > > Reformatting that to make things clearer: > > (defun foo (regexp &optional something) > "..." > (unless (bobp) > (when (empty-line-p) (skip-chars-backward " \t\r\n\f")) > (let* ((orig (point)) > (regexpvalue > (if (eq regexp 'py-clause-re) > (symbol-value 'py-extended-block-or-clause-re) > (symbol-value regexp))) > >> ;; > >> As visible, regexp is evaluated in last clause. > > Does the rest of that let* form use regexpvalue? If not, the lack of > use of regexpvalue will, I believe, transfer to regexp. > > Incidentally, why write (symbol-value 'py-extended-block-or-clause-re) > rather than just py-extended-block-or-clause-re? > Hi Alan, that form is used to make a decision at a certain point: (cond ((and (member regexp (list 'py-block-or-clause-re ... )) (looking-at regexpvalue)) So regexpvalue is used too. May send the complete function if interested. ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#33314: 27.0.50; wrong compiler warning 2018-11-08 16:41 ` Andreas Röhler @ 2018-11-09 1:11 ` Noam Postavsky 2018-11-09 8:35 ` Andreas Röhler 0 siblings, 1 reply; 5+ messages in thread From: Noam Postavsky @ 2018-11-09 1:11 UTC (permalink / raw) To: Andreas Röhler; +Cc: Alan Mackenzie, 33314 tags 33314 unreproducible moreinfo quit Andreas Röhler <andreas.roehler@online.de> writes: > So regexpvalue is used too. May send the complete function if interested. Please do, I can't reproduce the warning you claimed in your original report (and frankly, I think you've been doing this long enough that you should know by now that such an abbreviated report is not very helpful). Trying to fill in your example like this: ;;; -*- lexical-binding: t -*- (defun foo (regexp &optional something) "..." (unless (bobp) (when (empty-line-p) (skip-chars-backward " \t\r\n\f")) (let* ((orig (point)) (regexpvalue (if (eq regexp 'py-clause-re) (symbol-value 'py-extended-block-or-clause-re) (symbol-value regexp)))) t))) gives bug-33314-bcomp-warning.el:3:1:Warning: Unused lexical variable ‘regexpvalue’ bug-33314-bcomp-warning.el:3:1:Warning: Unused lexical variable ‘orig’ bug-33314-bcomp-warning.el:3:1:Warning: Unused lexical argument ‘something’ In end of data: bug-33314-bcomp-warning.el:13:1:Warning: the function ‘empty-line-p’ is not known to be defined. `regexp' is not mentioned, but the other unused variables are, as expected. ^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#33314: 27.0.50; wrong compiler warning 2018-11-09 1:11 ` Noam Postavsky @ 2018-11-09 8:35 ` Andreas Röhler 0 siblings, 0 replies; 5+ messages in thread From: Andreas Röhler @ 2018-11-09 8:35 UTC (permalink / raw) To: Noam Postavsky; +Cc: Alan Mackenzie, 33314 On 09.11.2018 02:11, Noam Postavsky wrote: > tags 33314 unreproducible moreinfo > quit > > Andreas Röhler <andreas.roehler@online.de> writes: > >> So regexpvalue is used too. May send the complete function if interested. > > Please do, I can't reproduce the warning you claimed in your original > report (and frankly, I think you've been doing this long enough that you > should know by now that such an abbreviated report is not very helpful). > > Trying to fill in your example like this: > > ;;; -*- lexical-binding: t -*- > > (defun foo (regexp &optional something) > "..." > (unless (bobp) > (when (empty-line-p) (skip-chars-backward " \t\r\n\f")) > (let* ((orig (point)) > (regexpvalue (if (eq regexp 'py-clause-re) > (symbol-value > 'py-extended-block-or-clause-re) > (symbol-value regexp)))) > t))) > > gives > > bug-33314-bcomp-warning.el:3:1:Warning: Unused lexical variable ‘regexpvalue’ > bug-33314-bcomp-warning.el:3:1:Warning: Unused lexical variable ‘orig’ > bug-33314-bcomp-warning.el:3:1:Warning: Unused lexical argument ‘something’ > > In end of data: > bug-33314-bcomp-warning.el:13:1:Warning: the function ‘empty-line-p’ is not > known to be defined. > > `regexp' is not mentioned, but the other unused variables are, as > expected. > Hmm, sorry, can't reproduce it any more. As this happens from time to time, should send a complete report indeed. Tried to replay for now, but couldn't find a saved state. Thanks for your care, Andreas ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-11-09 8:35 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-11-08 14:38 bug#33314: 27.0.50; wrong compiler warning Andreas Röhler [not found] ` <mailman.3649.1541688141.1284.bug-gnu-emacs@gnu.org> 2018-11-08 15:54 ` Alan Mackenzie 2018-11-08 16:41 ` Andreas Röhler 2018-11-09 1:11 ` Noam Postavsky 2018-11-09 8:35 ` Andreas Röhler
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).