From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 11 23:40:39 2015 Received: (at submit) by debbugs.gnu.org; 12 Sep 2015 03:40:39 +0000 Received: from localhost ([127.0.0.1]:57565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zabg6-0004vx-Hl for submit@debbugs.gnu.org; Fri, 11 Sep 2015 23:40:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51596) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zabg4-0004vq-Sk for submit@debbugs.gnu.org; Fri, 11 Sep 2015 23:40:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zabg2-0001pW-Oq for submit@debbugs.gnu.org; Fri, 11 Sep 2015 23:40:36 -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.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:50054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zabg2-0001p7-LG for submit@debbugs.gnu.org; Fri, 11 Sep 2015 23:40:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33362) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zabg0-0003oA-Mm for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2015 23:40:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zabfx-0001my-B6 for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2015 23:40:32 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:37562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zabfx-0001mT-4H for bug-gnu-emacs@gnu.org; Fri, 11 Sep 2015 23:40:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AdIgA731xV/zi6xEVcgxABgQMuglBOsgUBkAyGAASBQDwRAQEBAQEBAYEKQQWEBjNYAgUTDgIRARwNN4gsmy+PXaRDgSGSDYFFBYtEnw+IbIFFI2FmAQoBAQE1HIFuIjGBAySBIAEBAQ X-IPAS-Result: A0AdIgA731xV/zi6xEVcgxABgQMuglBOsgUBkAyGAASBQDwRAQEBAQEBAYEKQQWEBjNYAgUTDgIRARwNN4gsmy+PXaRDgSGSDYFFBYtEnw+IbIFFI2FmAQoBAQE1HIFuIjGBAySBIAEBAQ X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="164612669" Received: from 69-196-186-56.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.196.186.56]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 11 Sep 2015 23:37:26 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 53C8EAE12C; Fri, 11 Sep 2015 23:36:45 -0400 (EDT) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: [PATCH] Avoid defining (temporarily) vars and functions X-debbugs-cc: bug-cc-mode@gnu.org Date: Fri, 11 Sep 2015 23:36:45 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -4.0 (----) Package: Emacs Version: 25.0.50 CC-mode currently defines various non-CC-mode variables and functions with dummy values, as a way to avoid byte-compiler warnings when using those external vars/functions. Since this is dangerous business, CC-mode has to be extra careful to undo such settings when they're not needed any more. It might have made sense back in the days when the byte-compiler did not offer built-in ways to silence those warnings, but nowadays we can do better. Any objections to the patch below (which also removes the unused cc-bytecomp-put, while we're at it)? Stefan 2015-09-12 Stefan Monnier * lisp/progmodes/cc-bytecomp.el: Use newer compiler-silencers. (cc-bytecomp-defvar): Use just (defvar ) when that is known to silence the byte-compiler warnings. (cc-bytecomp-defun): Use just (declare-function ) when that is known to silence the byte-compiler warnings. (cc-bytecomp-boundp, cc-bytecomp-fboundp): Change accordingly. (cc-bytecomp-put): Remove, unused. (cc-bytecomp-original-properties): Remove var. (cc-bytecomp-setup-environment, cc-bytecomp-restore-environment): Don't use cc-bytecomp-original-properties any more. diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el index 81b7a82..fff2a9e 100644 --- a/lisp/progmodes/cc-bytecomp.el +++ b/lisp/progmodes/cc-bytecomp.el @@ -75,12 +75,10 @@ =20 (defvar cc-bytecomp-unbound-variables nil) (defvar cc-bytecomp-original-functions nil) -(defvar cc-bytecomp-original-properties nil) (defvar cc-bytecomp-loaded-files nil) =20 (setq cc-bytecomp-unbound-variables nil) (setq cc-bytecomp-original-functions nil) -(setq cc-bytecomp-original-properties nil) (setq cc-bytecomp-loaded-files nil) =20 (defvar cc-bytecomp-environment-set nil) @@ -173,16 +171,6 @@ perhaps a `cc-bytecomp-restore-environment' is forgott= en somewhere")) (cc-bytecomp-debug-msg "cc-bytecomp-setup-environment: Covered function %s" fun)))) (setq p (cdr p))) - (setq p cc-bytecomp-original-properties) - (while p - (let ((sym (car (car (car p)))) - (prop (cdr (car (car p)))) - (tempdef (car (cdr (car p))))) - (put sym prop tempdef) - (cc-bytecomp-debug-msg - "cc-bytecomp-setup-environment: Bound property %s for %s to %s" - prop sym tempdef)) - (setq p (cdr p))) (setq cc-bytecomp-environment-set t) (cc-bytecomp-debug-msg "cc-bytecomp-setup-environment: Done")))) @@ -232,22 +220,6 @@ perhaps a `cc-bytecomp-restore-environment' is forgott= en somewhere")) "cc-bytecomp-restore-environment: Not restoring function %s" fun)))) (setq p (cdr p))) - (setq p cc-bytecomp-original-properties) - (while p - (let ((sym (car (car (car p)))) - (prop (cdr (car (car p)))) - (tempdef (car (cdr (car p)))) - (origdef (cdr (cdr (car p))))) - (if (eq (get sym prop) tempdef) - (progn - (put sym prop origdef) - (cc-bytecomp-debug-msg - "cc-bytecomp-restore-environment: Restored property %s for %s to %s" - prop sym origdef)) - (cc-bytecomp-debug-msg - "cc-bytecomp-restore-environment: Not restoring property %s for %s" - prop sym))) - (setq p (cdr p))) (setq cc-bytecomp-environment-set nil) (cc-bytecomp-debug-msg "cc-bytecomp-restore-environment: Done")))) @@ -348,25 +320,28 @@ afterwards. Don't use within `eval-when-compile'." (eval-when-compile (cc-bytecomp-setup-environment)))) =20 (defmacro cc-bytecomp-defvar (var) - "Binds the symbol as a variable during compilation of the file, + "Bind the symbol as a variable during compilation of the file, to silence the byte compiler. Don't use within `eval-when-compile'." - `(eval-when-compile - (if (boundp ',var) - (cc-bytecomp-debug-msg - "cc-bytecomp-defvar: %s bound already as variable" ',var) - (if (not (memq ',var cc-bytecomp-unbound-variables)) - (progn - (cc-bytecomp-debug-msg - "cc-bytecomp-defvar: Saving %s (as unbound)" ',var) - (setq cc-bytecomp-unbound-variables - (cons ',var cc-bytecomp-unbound-variables)))) - (if (cc-bytecomp-is-compiling) - (progn - (defvar ,var) - (set ',var (intern (concat "cc-bytecomp-ignore-var:" - (symbol-name ',var)))) - (cc-bytecomp-debug-msg - "cc-bytecomp-defvar: Covered variable %s" ',var)))))) + (if (not (featurep 'xemacs)) + `(defvar ,var) + ;; Not sure if XEmacs's =E2=80=98defvar=E2=80=99 works in the same way. + `(eval-when-compile + (if (boundp ',var) + (cc-bytecomp-debug-msg + "cc-bytecomp-defvar: %s bound already as variable" ',var) + (if (not (memq ',var cc-bytecomp-unbound-variables)) + (progn + (cc-bytecomp-debug-msg + "cc-bytecomp-defvar: Saving %s (as unbound)" ',var) + (setq cc-bytecomp-unbound-variables + (cons ',var cc-bytecomp-unbound-variables)))) + (if (cc-bytecomp-is-compiling) + (progn + (defvar ,var) + (set ',var (intern (concat "cc-bytecomp-ignore-var:" + (symbol-name ',var)))) + (cc-bytecomp-debug-msg + "cc-bytecomp-defvar: Covered variable %s" ',var))))))) =20 (defmacro cc-bytecomp-defun (fun) "Bind the symbol as a function during compilation of the file, @@ -377,48 +352,33 @@ definition. That means that this macro will not shut= up warnings about incorrect number of arguments. It's dangerous to try to replace existing functions since the byte compiler might need the definition at compile time, e.g. for macros and inline functions." - `(eval-when-compile - (if (fboundp ',fun) - (cc-bytecomp-debug-msg - "cc-bytecomp-defun: %s bound already as function" ',fun) - (if (not (assq ',fun cc-bytecomp-original-functions)) - (progn - (cc-bytecomp-debug-msg - "cc-bytecomp-defun: Saving %s (as unbound)" ',fun) - (setq cc-bytecomp-original-functions - (cons (list ',fun nil 'unbound) - cc-bytecomp-original-functions)))) - (if (cc-bytecomp-is-compiling) - (progn - (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:" - (symbol-name ',fun)))) - (cc-bytecomp-debug-msg - "cc-bytecomp-defun: Covered function %s" ',fun)))))) - -(defmacro cc-bytecomp-put (symbol propname value) - "Set a property on a symbol during compilation (and evaluation) of -the file. Don't use outside `eval-when-compile'." - `(eval-when-compile - (if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-propert= ies)) - (progn + (if (fboundp 'declare-function) + `(declare-function ,fun nil) + `(eval-when-compile + (if (fboundp ',fun) (cc-bytecomp-debug-msg - "cc-bytecomp-put: Saving property %s for %s with value %s" - ,propname ,symbol (get ,symbol ,propname)) - (setq cc-bytecomp-original-properties - (cons (cons (cons ,symbol ,propname) - (cons ,value (get ,symbol ,propname))) - cc-bytecomp-original-properties)))) - (put ,symbol ,propname ,value) - (cc-bytecomp-debug-msg - "cc-bytecomp-put: Bound property %s for %s to %s" - ,propname ,symbol ,value))) + "cc-bytecomp-defun: %s bound already as function" ',fun) + (if (not (assq ',fun cc-bytecomp-original-functions)) + (progn + (cc-bytecomp-debug-msg + "cc-bytecomp-defun: Saving %s (as unbound)" ',fun) + (setq cc-bytecomp-original-functions + (cons (list ',fun nil 'unbound) + cc-bytecomp-original-functions)))) + (if (cc-bytecomp-is-compiling) + (progn + (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:" + (symbol-name ',fun)))) + (cc-bytecomp-debug-msg + "cc-bytecomp-defun: Covered function %s" ',fun))))))) =20 (defmacro cc-bytecomp-boundp (symbol) "Return non-nil if the given symbol is bound as a variable outside the compilation. This is the same as using `boundp' but additionally exclude any variables that have been bound during compilation with `cc-bytecomp-defvar'." - (if (and (cc-bytecomp-is-compiling) + (if (and (featurep 'xemacs) + (cc-bytecomp-is-compiling) (memq (car (cdr symbol)) cc-bytecomp-unbound-variables)) nil `(boundp ,symbol))) @@ -429,7 +389,8 @@ the compilation. This is the same as using `fboundp' b= ut additionally exclude any functions that have been bound during compilation with `cc-bytecomp-defun'." (let (fun-elem) - (if (and (cc-bytecomp-is-compiling) + (if (and (not (fboundp 'declare-function)) + (cc-bytecomp-is-compiling) (setq fun-elem (assq (car (cdr symbol)) cc-bytecomp-original-functions)) (eq (elt fun-elem 2) 'unbound)) From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 29 09:09:59 2015 Received: (at 21466) by debbugs.gnu.org; 29 Oct 2015 13:09:59 +0000 Received: from localhost ([127.0.0.1]:43410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zrmxm-0006lG-Vf for submit@debbugs.gnu.org; Thu, 29 Oct 2015 09:09:58 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:12667) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZrmxO-0006kl-TM for 21466@debbugs.gnu.org; Thu, 29 Oct 2015 09:09:53 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A8FgA731xV/+Z93mhcgxCBMoJQToUHu0CHSwQCAoE8OhMBAQEBAQEBgQpBBYNdAQEDASMzIwULCxoCGA4CAhQYDTeIJAirDKQXAQEBBwIBH4EhihmEUjMHgmiBRQWLRKlAI2GBKRyBbiIxgQMkgSABAQE X-IPAS-Result: A0A8FgA731xV/+Z93mhcgxCBMoJQToUHu0CHSwQCAoE8OhMBAQEBAQEBgQpBBYNdAQEDASMzIwULCxoCGA4CAhQYDTeIJAirDKQXAQEBBwIBH4EhihmEUjMHgmiBRQWLRKlAI2GBKRyBbiIxgQMkgSABAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="171944489" Received: from 104-222-125-230.cpe.teksavvy.com (HELO fmsmemgm.homelinux.net) ([104.222.125.230]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Oct 2015 09:09:30 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id AA264AE25E; Thu, 29 Oct 2015 09:09:29 -0400 (EDT) From: Stefan Monnier To: 21466@debbugs.gnu.org Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions Message-ID: References: Date: Thu, 29 Oct 2015 09:09:29 -0400 In-Reply-To: (Stefan Monnier's message of "Fri, 11 Sep 2015 23:36:45 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 21466 Cc: bug-cc-mode@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: 0.3 (/) Ping? Stefan >>>>> "Stefan" =3D=3D Stefan Monnier writes: > Package: Emacs > Version: 25.0.50 > CC-mode currently defines various non-CC-mode variables and functions > with dummy values, as a way to avoid byte-compiler warnings when using > those external vars/functions. > Since this is dangerous business, CC-mode has to be extra careful to > undo such settings when they're not needed any more. > It might have made sense back in the days when the byte-compiler did not > offer built-in ways to silence those warnings, but nowadays we can > do better. > Any objections to the patch below (which also removes the unused > cc-bytecomp-put, while we're at it)? > Stefan > 2015-09-12 Stefan Monnier > * lisp/progmodes/cc-bytecomp.el: Use newer compiler-silencers. > (cc-bytecomp-defvar): Use just (defvar ) when that is known to > silence the byte-compiler warnings. > (cc-bytecomp-defun): Use just (declare-function ) when that is > known to silence the byte-compiler warnings. > (cc-bytecomp-boundp, cc-bytecomp-fboundp): Change accordingly. > (cc-bytecomp-put): Remove, unused. > (cc-bytecomp-original-properties): Remove var. > (cc-bytecomp-setup-environment, cc-bytecomp-restore-environment): > Don't use cc-bytecomp-original-properties any more. > diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el > index 81b7a82..fff2a9e 100644 > --- a/lisp/progmodes/cc-bytecomp.el > +++ b/lisp/progmodes/cc-bytecomp.el > @@ -75,12 +75,10 @@ =20 > (defvar cc-bytecomp-unbound-variables nil) > (defvar cc-bytecomp-original-functions nil) > -(defvar cc-bytecomp-original-properties nil) > (defvar cc-bytecomp-loaded-files nil) =20 > (setq cc-bytecomp-unbound-variables nil) > (setq cc-bytecomp-original-functions nil) > -(setq cc-bytecomp-original-properties nil) > (setq cc-bytecomp-loaded-files nil) =20 > (defvar cc-bytecomp-environment-set nil) > @@ -173,16 +171,6 @@ perhaps a `cc-bytecomp-restore-environment' is forgo= tten somewhere")) > (cc-bytecomp-debug-msg > "cc-bytecomp-setup-environment: Covered function %s" fun)))) > (setq p (cdr p))) > - (setq p cc-bytecomp-original-properties) > - (while p > - (let ((sym (car (car (car p)))) > - (prop (cdr (car (car p)))) > - (tempdef (car (cdr (car p))))) > - (put sym prop tempdef) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-setup-environment: Bound property %s for %s to %s" > - prop sym tempdef)) > - (setq p (cdr p))) > (setq cc-bytecomp-environment-set t) > (cc-bytecomp-debug-msg > "cc-bytecomp-setup-environment: Done")))) > @@ -232,22 +220,6 @@ perhaps a `cc-bytecomp-restore-environment' is forgo= tten somewhere")) > "cc-bytecomp-restore-environment: Not restoring function %s" > fun)))) > (setq p (cdr p))) > - (setq p cc-bytecomp-original-properties) > - (while p > - (let ((sym (car (car (car p)))) > - (prop (cdr (car (car p)))) > - (tempdef (car (cdr (car p)))) > - (origdef (cdr (cdr (car p))))) > - (if (eq (get sym prop) tempdef) > - (progn > - (put sym prop origdef) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-restore-environment: Restored property %s for %s to %s" > - prop sym origdef)) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-restore-environment: Not restoring property %s for = %s" > - prop sym))) > - (setq p (cdr p))) > (setq cc-bytecomp-environment-set nil) > (cc-bytecomp-debug-msg > "cc-bytecomp-restore-environment: Done")))) > @@ -348,25 +320,28 @@ afterwards. Don't use within `eval-when-compile'." > (eval-when-compile (cc-bytecomp-setup-environment)))) =20 > (defmacro cc-bytecomp-defvar (var) > - "Binds the symbol as a variable during compilation of the file, > + "Bind the symbol as a variable during compilation of the file, > to silence the byte compiler. Don't use within `eval-when-compile'." > - `(eval-when-compile > - (if (boundp ',var) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defvar: %s bound already as variable" ',var) > - (if (not (memq ',var cc-bytecomp-unbound-variables)) > - (progn > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defvar: Saving %s (as unbound)" ',var) > - (setq cc-bytecomp-unbound-variables > - (cons ',var cc-bytecomp-unbound-variables)))) > - (if (cc-bytecomp-is-compiling) > - (progn > - (defvar ,var) > - (set ',var (intern (concat "cc-bytecomp-ignore-var:" > - (symbol-name ',var)))) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defvar: Covered variable %s" ',var)))))) > + (if (not (featurep 'xemacs)) > + `(defvar ,var) > + ;; Not sure if XEmacs's =E2=80=98defvar=E2=80=99 works in the same w= ay. > + `(eval-when-compile > + (if (boundp ',var) > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defvar: %s bound already as variable" ',var) > + (if (not (memq ',var cc-bytecomp-unbound-variables)) > + (progn > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defvar: Saving %s (as unbound)" ',var) > + (setq cc-bytecomp-unbound-variables > + (cons ',var cc-bytecomp-unbound-variables)))) > + (if (cc-bytecomp-is-compiling) > + (progn > + (defvar ,var) > + (set ',var (intern (concat "cc-bytecomp-ignore-var:" > + (symbol-name ',var)))) > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defvar: Covered variable %s" ',var))))))) =20 > (defmacro cc-bytecomp-defun (fun) > "Bind the symbol as a function during compilation of the file, > @@ -377,48 +352,33 @@ definition. That means that this macro will not sh= ut up warnings > about incorrect number of arguments. It's dangerous to try to replace > existing functions since the byte compiler might need the definition > at compile time, e.g. for macros and inline functions." > - `(eval-when-compile > - (if (fboundp ',fun) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defun: %s bound already as function" ',fun) > - (if (not (assq ',fun cc-bytecomp-original-functions)) > - (progn > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defun: Saving %s (as unbound)" ',fun) > - (setq cc-bytecomp-original-functions > - (cons (list ',fun nil 'unbound) > - cc-bytecomp-original-functions)))) > - (if (cc-bytecomp-is-compiling) > - (progn > - (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:" > - (symbol-name ',fun)))) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defun: Covered function %s" ',fun)))))) > - > -(defmacro cc-bytecomp-put (symbol propname value) > - "Set a property on a symbol during compilation (and evaluation) of > -the file. Don't use outside `eval-when-compile'." > - `(eval-when-compile > - (if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-prope= rties)) > - (progn > + (if (fboundp 'declare-function) > + `(declare-function ,fun nil) > + `(eval-when-compile > + (if (fboundp ',fun) > (cc-bytecomp-debug-msg > - "cc-bytecomp-put: Saving property %s for %s with value %s" > - ,propname ,symbol (get ,symbol ,propname)) > - (setq cc-bytecomp-original-properties > - (cons (cons (cons ,symbol ,propname) > - (cons ,value (get ,symbol ,propname))) > - cc-bytecomp-original-properties)))) > - (put ,symbol ,propname ,value) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-put: Bound property %s for %s to %s" > - ,propname ,symbol ,value))) > + "cc-bytecomp-defun: %s bound already as function" ',fun) > + (if (not (assq ',fun cc-bytecomp-original-functions)) > + (progn > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defun: Saving %s (as unbound)" ',fun) > + (setq cc-bytecomp-original-functions > + (cons (list ',fun nil 'unbound) > + cc-bytecomp-original-functions)))) > + (if (cc-bytecomp-is-compiling) > + (progn > + (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:" > + (symbol-name ',fun)))) > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defun: Covered function %s" ',fun))))))) =20 > (defmacro cc-bytecomp-boundp (symbol) > "Return non-nil if the given symbol is bound as a variable outside > the compilation. This is the same as using `boundp' but additionally > exclude any variables that have been bound during compilation with > `cc-bytecomp-defvar'." > - (if (and (cc-bytecomp-is-compiling) > + (if (and (featurep 'xemacs) > + (cc-bytecomp-is-compiling) > (memq (car (cdr symbol)) cc-bytecomp-unbound-variables)) > nil > `(boundp ,symbol))) > @@ -429,7 +389,8 @@ the compilation. This is the same as using `fboundp'= but additionally > exclude any functions that have been bound during compilation with > `cc-bytecomp-defun'." > (let (fun-elem) > - (if (and (cc-bytecomp-is-compiling) > + (if (and (not (fboundp 'declare-function)) > + (cc-bytecomp-is-compiling) > (setq fun-elem (assq (car (cdr symbol)) > cc-bytecomp-original-functions)) > (eq (elt fun-elem 2) 'unbound)) From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 05 20:29:21 2019 Received: (at 21466) by debbugs.gnu.org; 6 Nov 2019 01:29:21 +0000 Received: from localhost ([127.0.0.1]:39337 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSA8O-0002Rr-G9 for submit@debbugs.gnu.org; Tue, 05 Nov 2019 20:29:20 -0500 Received: from host.gofardesign.uk ([208.79.239.190]:38761) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSA8M-0002Rd-6A for 21466@debbugs.gnu.org; Tue, 05 Nov 2019 20:29:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Date:References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Ks8ygVjs2Vdnvv41xWejtFa/RMjo8r88/KIB67yYpwA=; b=dImy7fC5oOsc7IMgrxXGEkXdvN l5zbwkiHO2sda7dTBVrTyvGcNVkx9AXiPfLYeO0+TtoKh50CqOuOcPfoF0ShWysRjWzQHM06KQOYC pC73Tb+J1DR0DTz1IYmsVuqcrYiqR5jIV2282GT/Z8GmyTyMpOIJskH67MjbZ0CTOg4w=; Received: from h-70-69.a785.priv.bahnhof.se ([155.4.70.69]:49380 helo=localhost) by host.gofardesign.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1iSA8E-0007vp-TB; Tue, 05 Nov 2019 19:29:12 -0600 From: Stefan Kangas To: Stefan Monnier Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions In-Reply-To: (Stefan Monnier's message of "Fri, 11 Sep 2015 23:36:45 -0400") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Date: Wed, 06 Nov 2019 02:29:09 +0100 Message-ID: <87wocd4wt6.fsf@marxist.se> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: host.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: host.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 21466 Cc: Alan Mackenzie , 21466@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 (-) Stefan Monnier writes: > Package: Emacs > Version: 25.0.50 > > > CC-mode currently defines various non-CC-mode variables and functions > with dummy values, as a way to avoid byte-compiler warnings when using > those external vars/functions. > > Since this is dangerous business, CC-mode has to be extra careful to > undo such settings when they're not needed any more. > > It might have made sense back in the days when the byte-compiler did not > offer built-in ways to silence those warnings, but nowadays we can > do better. > > Any objections to the patch below (which also removes the unused > cc-bytecomp-put, while we're at it)? Hi Alan, This patch was sent to the bug list in 2015, but it seems like it never got a reply at the time. Assuming this patch is still relevant, could you please take a look? Best regards, Stefan Kangas > 2015-09-12 Stefan Monnier > > * lisp/progmodes/cc-bytecomp.el: Use newer compiler-silencers. > (cc-bytecomp-defvar): Use just (defvar ) when that is known to > silence the byte-compiler warnings. > (cc-bytecomp-defun): Use just (declare-function ) when that is > known to silence the byte-compiler warnings. > (cc-bytecomp-boundp, cc-bytecomp-fboundp): Change accordingly. > (cc-bytecomp-put): Remove, unused. > (cc-bytecomp-original-properties): Remove var. > (cc-bytecomp-setup-environment, cc-bytecomp-restore-environment): > Don't use cc-bytecomp-original-properties any more. > > > diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el > index 81b7a82..fff2a9e 100644 > --- a/lisp/progmodes/cc-bytecomp.el > +++ b/lisp/progmodes/cc-bytecomp.el > @@ -75,12 +75,10 @@ >=20=20 > (defvar cc-bytecomp-unbound-variables nil) > (defvar cc-bytecomp-original-functions nil) > -(defvar cc-bytecomp-original-properties nil) > (defvar cc-bytecomp-loaded-files nil) >=20=20 > (setq cc-bytecomp-unbound-variables nil) > (setq cc-bytecomp-original-functions nil) > -(setq cc-bytecomp-original-properties nil) > (setq cc-bytecomp-loaded-files nil) >=20=20 > (defvar cc-bytecomp-environment-set nil) > @@ -173,16 +171,6 @@ perhaps a `cc-bytecomp-restore-environment' is forgo= tten somewhere")) > (cc-bytecomp-debug-msg > "cc-bytecomp-setup-environment: Covered function %s" fun)))) > (setq p (cdr p))) > - (setq p cc-bytecomp-original-properties) > - (while p > - (let ((sym (car (car (car p)))) > - (prop (cdr (car (car p)))) > - (tempdef (car (cdr (car p))))) > - (put sym prop tempdef) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-setup-environment: Bound property %s for %s to %s" > - prop sym tempdef)) > - (setq p (cdr p))) > (setq cc-bytecomp-environment-set t) > (cc-bytecomp-debug-msg > "cc-bytecomp-setup-environment: Done")))) > @@ -232,22 +220,6 @@ perhaps a `cc-bytecomp-restore-environment' is forgo= tten somewhere")) > "cc-bytecomp-restore-environment: Not restoring function %s" > fun)))) > (setq p (cdr p))) > - (setq p cc-bytecomp-original-properties) > - (while p > - (let ((sym (car (car (car p)))) > - (prop (cdr (car (car p)))) > - (tempdef (car (cdr (car p)))) > - (origdef (cdr (cdr (car p))))) > - (if (eq (get sym prop) tempdef) > - (progn > - (put sym prop origdef) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-restore-environment: Restored property %s for %s to %s" > - prop sym origdef)) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-restore-environment: Not restoring property %s for = %s" > - prop sym))) > - (setq p (cdr p))) > (setq cc-bytecomp-environment-set nil) > (cc-bytecomp-debug-msg > "cc-bytecomp-restore-environment: Done")))) > @@ -348,25 +320,28 @@ afterwards. Don't use within `eval-when-compile'." > (eval-when-compile (cc-bytecomp-setup-environment)))) >=20=20 > (defmacro cc-bytecomp-defvar (var) > - "Binds the symbol as a variable during compilation of the file, > + "Bind the symbol as a variable during compilation of the file, > to silence the byte compiler. Don't use within `eval-when-compile'." > - `(eval-when-compile > - (if (boundp ',var) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defvar: %s bound already as variable" ',var) > - (if (not (memq ',var cc-bytecomp-unbound-variables)) > - (progn > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defvar: Saving %s (as unbound)" ',var) > - (setq cc-bytecomp-unbound-variables > - (cons ',var cc-bytecomp-unbound-variables)))) > - (if (cc-bytecomp-is-compiling) > - (progn > - (defvar ,var) > - (set ',var (intern (concat "cc-bytecomp-ignore-var:" > - (symbol-name ',var)))) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defvar: Covered variable %s" ',var)))))) > + (if (not (featurep 'xemacs)) > + `(defvar ,var) > + ;; Not sure if XEmacs's =E2=80=98defvar=E2=80=99 works in the same w= ay. > + `(eval-when-compile > + (if (boundp ',var) > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defvar: %s bound already as variable" ',var) > + (if (not (memq ',var cc-bytecomp-unbound-variables)) > + (progn > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defvar: Saving %s (as unbound)" ',var) > + (setq cc-bytecomp-unbound-variables > + (cons ',var cc-bytecomp-unbound-variables)))) > + (if (cc-bytecomp-is-compiling) > + (progn > + (defvar ,var) > + (set ',var (intern (concat "cc-bytecomp-ignore-var:" > + (symbol-name ',var)))) > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defvar: Covered variable %s" ',var))))))) >=20=20 > (defmacro cc-bytecomp-defun (fun) > "Bind the symbol as a function during compilation of the file, > @@ -377,48 +352,33 @@ definition. That means that this macro will not sh= ut up warnings > about incorrect number of arguments. It's dangerous to try to replace > existing functions since the byte compiler might need the definition > at compile time, e.g. for macros and inline functions." > - `(eval-when-compile > - (if (fboundp ',fun) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defun: %s bound already as function" ',fun) > - (if (not (assq ',fun cc-bytecomp-original-functions)) > - (progn > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defun: Saving %s (as unbound)" ',fun) > - (setq cc-bytecomp-original-functions > - (cons (list ',fun nil 'unbound) > - cc-bytecomp-original-functions)))) > - (if (cc-bytecomp-is-compiling) > - (progn > - (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:" > - (symbol-name ',fun)))) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-defun: Covered function %s" ',fun)))))) > - > -(defmacro cc-bytecomp-put (symbol propname value) > - "Set a property on a symbol during compilation (and evaluation) of > -the file. Don't use outside `eval-when-compile'." > - `(eval-when-compile > - (if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-prope= rties)) > - (progn > + (if (fboundp 'declare-function) > + `(declare-function ,fun nil) > + `(eval-when-compile > + (if (fboundp ',fun) > (cc-bytecomp-debug-msg > - "cc-bytecomp-put: Saving property %s for %s with value %s" > - ,propname ,symbol (get ,symbol ,propname)) > - (setq cc-bytecomp-original-properties > - (cons (cons (cons ,symbol ,propname) > - (cons ,value (get ,symbol ,propname))) > - cc-bytecomp-original-properties)))) > - (put ,symbol ,propname ,value) > - (cc-bytecomp-debug-msg > - "cc-bytecomp-put: Bound property %s for %s to %s" > - ,propname ,symbol ,value))) > + "cc-bytecomp-defun: %s bound already as function" ',fun) > + (if (not (assq ',fun cc-bytecomp-original-functions)) > + (progn > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defun: Saving %s (as unbound)" ',fun) > + (setq cc-bytecomp-original-functions > + (cons (list ',fun nil 'unbound) > + cc-bytecomp-original-functions)))) > + (if (cc-bytecomp-is-compiling) > + (progn > + (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:" > + (symbol-name ',fun)))) > + (cc-bytecomp-debug-msg > + "cc-bytecomp-defun: Covered function %s" ',fun))))))) >=20=20 > (defmacro cc-bytecomp-boundp (symbol) > "Return non-nil if the given symbol is bound as a variable outside > the compilation. This is the same as using `boundp' but additionally > exclude any variables that have been bound during compilation with > `cc-bytecomp-defvar'." > - (if (and (cc-bytecomp-is-compiling) > + (if (and (featurep 'xemacs) > + (cc-bytecomp-is-compiling) > (memq (car (cdr symbol)) cc-bytecomp-unbound-variables)) > nil > `(boundp ,symbol))) > @@ -429,7 +389,8 @@ the compilation. This is the same as using `fboundp'= but additionally > exclude any functions that have been bound during compilation with > `cc-bytecomp-defun'." > (let (fun-elem) > - (if (and (cc-bytecomp-is-compiling) > + (if (and (not (fboundp 'declare-function)) > + (cc-bytecomp-is-compiling) > (setq fun-elem (assq (car (cdr symbol)) > cc-bytecomp-original-functions)) > (eq (elt fun-elem 2) 'unbound)) From debbugs-submit-bounces@debbugs.gnu.org Mon May 10 07:45:32 2021 Received: (at 21466) by debbugs.gnu.org; 10 May 2021 11:45:32 +0000 Received: from localhost ([127.0.0.1]:57558 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lg4Ls-0001Bz-JQ for submit@debbugs.gnu.org; Mon, 10 May 2021 07:45:32 -0400 Received: from quimby.gnus.org ([95.216.78.240]:34354) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lg4Lq-00014m-Qc for 21466@debbugs.gnu.org; Mon, 10 May 2021 07:45:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ccRcndDx+GOvMvGm5+/gQLbgD9wwDU8K2nePzKXYWM0=; b=si42dYPwckmqvIjtn70+tQCDT2 iAKwZfv6tk+kkYfrLu4UBbkT3SeZ5pGxdqruksUTraIw+ybs3nDDR0rZOk6zWDi5bz8IrUzPuUrnW oMotw2jh7Yeaysxy+obHAmgQy9Y6GjSRcvXk6ZkDlEUVlHruUEcQQOhpf2Rwgq/Wyj9A=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lg4Lh-0007kb-OV; Mon, 10 May 2021 13:45:24 +0200 From: Lars Ingebrigtsen To: Stefan Monnier Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions References: X-Now-Playing: Severed Heads's _Gigapus_: "Courier" Date: Mon, 10 May 2021 13:45:21 +0200 In-Reply-To: (Stefan Monnier's message of "Fri, 11 Sep 2015 23:36:45 -0400") Message-ID: <87eeeestgu.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Stefan Monnier writes: > CC-mode currently defines various non-CC-mode variables and functions > with dummy values, as a way to avoid byte-compiler warnings when using > those external vars/functions. > > Since this is dang [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21466 Cc: Alan Mackenzie , 21466@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 (-) Stefan Monnier writes: > CC-mode currently defines various non-CC-mode variables and functions > with dummy values, as a way to avoid byte-compiler warnings when using > those external vars/functions. > > Since this is dangerous business, CC-mode has to be extra careful to > undo such settings when they're not needed any more. This was five years ago, but skimming the code, it seems like it's generally applicable still? Alan, do you have any comments on this patch? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue May 11 16:34:40 2021 Received: (at 21466) by debbugs.gnu.org; 11 May 2021 20:34:40 +0000 Received: from localhost ([127.0.0.1]:37606 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lgZ5T-0003In-VS for submit@debbugs.gnu.org; Tue, 11 May 2021 16:34:40 -0400 Received: from colin.muc.de ([193.149.48.1]:51262 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lgZ5R-0003IZ-E5 for 21466@debbugs.gnu.org; Tue, 11 May 2021 16:34:38 -0400 Received: (qmail 75955 invoked by uid 3782); 11 May 2021 20:34:30 -0000 Received: from acm.muc.de (p4fe15d8c.dip0.t-ipconnect.de [79.225.93.140]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 11 May 2021 22:34:30 +0200 Received: (qmail 13148 invoked by uid 1000); 11 May 2021 20:34:30 -0000 Date: Tue, 11 May 2021 20:34:30 +0000 To: Lars Ingebrigtsen Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions Message-ID: References: <87eeeestgu.fsf@gnus.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87eeeestgu.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 21466 Cc: Stefan Monnier , 21466@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 (-) Hello, Lars. On Mon, May 10, 2021 at 13:45:21 +0200, Lars Ingebrigtsen wrote: > Stefan Monnier writes: > > CC-mode currently defines various non-CC-mode variables and functions > > with dummy values, as a way to avoid byte-compiler warnings when using > > those external vars/functions. > > Since this is dangerous business, CC-mode has to be extra careful to > > undo such settings when they're not needed any more. > This was five years ago, but skimming the code, it seems like it's > generally applicable still? > Alan, do you have any comments on this patch? I meant to comment on it back then, but the patch is unusually difficult to follow: most of the context lines are unhelpful in giving the context, and the git macros identifying the current function in the diff aren't working here, to a large degree. There are little things I'm unhappy about with the patch: it explicitly tests (featurep 'xemacs), which is not done in CC Mode, being regarded as somewhat vulgar. Instead specific functionalities are always tested for. Also, in place of cc-bytecomp-defun is proposed declare-function. However this is in an inconsistent state, with the documentation requiring a FILE argument, but Stefan's patch supplying nil. It seems that cc-bytecomp-defvar has long (?always) been unnecessary, given that (defvar foo) has ?always had the desired effect, even in XEmacs. So I don't have anything against clearing out the cc-bytecomp-defvar's. So, I don't object on principle to the principle of the patch, just there are these little irritations about it, and it will need me to study it more closely to check nothing subtle would get lost (I doubt it would). > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue May 11 18:03:53 2021 Received: (at 21466) by debbugs.gnu.org; 11 May 2021 22:03:53 +0000 Received: from localhost ([127.0.0.1]:37713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lgaTo-0001OO-Pg for submit@debbugs.gnu.org; Tue, 11 May 2021 18:03:53 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lgaTm-0001OB-Un for 21466@debbugs.gnu.org; Tue, 11 May 2021 18:03:51 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 534524414D6; Tue, 11 May 2021 18:03:45 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B00D44414D0; Tue, 11 May 2021 18:03:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1620770619; bh=/FPA5vlkS7B9LJVoTHDd3cZ7Wo5NMfqZzGN3Ht2KTSY=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Dj4uKZdgIiRYrw0BZQ2CsDsBMJIpNxFZxbrWrxLK0JcRHG1zpPYwzoiMcBY/a5DLa 4D2YebMaHl3NUs1PQeeloYwqM/QmEGHJaEpukfQs/LA19NzArZFLIoKJPKe9hCc7xy uulpO6CyZjvWG1ikFUoGrVlyevuatfhv+hMwYVpnH8Lp9B6I+nfTTKaFIY8RoqrORJ I/NWwWb9PWfAsTf+NrkDjp72zIPXZox8eXaYR2PBUMd9fMHQH+wq6duGCnhTbs/Xdy GqxL8PCR5dt3GMC/MOidLwjjICFUayGb9Z/LC8lhub5sy+hglpY7rq1bmvj7xdCr9r c5BYdcFgCIEiQ== Received: from alfajor (76-10-140-76.dsl.teksavvy.com [76.10.140.76]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5C51912067C; Tue, 11 May 2021 18:03:39 -0400 (EDT) From: Stefan Monnier To: Alan Mackenzie Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions Message-ID: References: <87eeeestgu.fsf@gnus.org> Date: Tue, 11 May 2021 18:03:38 -0400 In-Reply-To: (Alan Mackenzie's message of "Tue, 11 May 2021 20:34:30 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.067 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 21466 Cc: Lars Ingebrigtsen , 21466@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: -3.3 (---) > There are little things I'm unhappy about with the patch: it > explicitly tests (featurep 'xemacs), which is not done in CC Mode, > being regarded as somewhat vulgar. Instead specific functionalities > are always tested for. I use (featurep 'xemacs) because it results in cleaner byte-code because the compiler replaces it with nil. It also usually results in fewer spurious warnings (because of the removal of XEmacs-only code). [ I believe the same holds on XEmacs where (featurep 'xemacs) is optimized to t, which removes Emacs-only code. ] But that's just my favorite bikeshed color, it's not crucial for the patch. > Also, in place of cc-bytecomp-defun is proposed declare-function. > However this is in an inconsistent state, with the documentation > requiring a FILE argument, but Stefan's patch supplying nil. `declare-function` says: The FILE argument is not used by the byte-compiler, but by the `check-declare' package, which checks that FILE contains a definition for FN. So indeed, a real FILE argument would be preferable, but passing nil works fine (it will simply prevent `check-declare` from making sure that file indeed defines that function, which is no different than what we have now with `cc-bytecomp-defun` which `check-declare` also ignores). If you want the "better" option, then it will require changing `cc-bytecomp-defun` so it takes a FILE arg. Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 23 09:14:52 2021 Received: (at 21466) by debbugs.gnu.org; 23 Jul 2021 13:14:52 +0000 Received: from localhost ([127.0.0.1]:42582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6v0u-0004cP-CO for submit@debbugs.gnu.org; Fri, 23 Jul 2021 09:14:52 -0400 Received: from quimby.gnus.org ([95.216.78.240]:38750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6v0s-0004c9-Ht for 21466@debbugs.gnu.org; Fri, 23 Jul 2021 09:14:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=G2TNFFhQV6EFru/RCCC5MQbfu/7ofyoitAUKOVFTR9Q=; b=Iu2EJNL5fedBBaDMyNBDEBNLFL DAh3zDdjHALopzlpqwnewzE9HZHj+iSPKt7xt9Q+GS8CbQhaOvyEeZ2qYLst9bavW+rsPZU2OnC/e 5GKHmRHxN1GpIppzlNQ1MdmH6yBuJAMouXa++X/55YpsYGJ7YE6j+n0mOdEnjYL277h0=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m6v0j-00008r-Ke; Fri, 23 Jul 2021 15:14:44 +0200 From: Lars Ingebrigtsen To: Stefan Monnier Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions References: <87eeeestgu.fsf@gnus.org> X-Now-Playing: The Human League's _Octopus (2)_: "Words (Demo)" Date: Fri, 23 Jul 2021 15:14:41 +0200 In-Reply-To: (Stefan Monnier's message of "Tue, 11 May 2021 18:03:38 -0400") Message-ID: <87fsw5cgu6.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Stefan Monnier writes: >> Also, in place of cc-bytecomp-defun is proposed declare-function. >> However this is in an inconsistent state, with the documentation >> requiring a FILE argument, but Stefan's patch supplying nil. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 21466 Cc: Alan Mackenzie , 21466@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: -3.3 (---) Stefan Monnier writes: >> Also, in place of cc-bytecomp-defun is proposed declare-function. >> However this is in an inconsistent state, with the documentation >> requiring a FILE argument, but Stefan's patch supplying nil. > > `declare-function` says: > > The FILE argument is not used by the byte-compiler, but by the > `check-declare' package, which checks that FILE contains a > definition for FN. > > So indeed, a real FILE argument would be preferable, but passing nil > works fine (it will simply prevent `check-declare` from making sure > that file indeed defines that function, I've now amended the doc string to `declare-function on the trunk to mention this. Alan, it sounded like you were generally positive to the patch (except for the `declare-function' bit, which should now be clarified and the (featurep 'xemacs))? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 23 11:01:18 2021 Received: (at 21466) by debbugs.gnu.org; 23 Jul 2021 15:01:18 +0000 Received: from localhost ([127.0.0.1]:44274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6wfu-0003dV-In for submit@debbugs.gnu.org; Fri, 23 Jul 2021 11:01:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m6wft-0003dI-4X for 21466@debbugs.gnu.org; Fri, 23 Jul 2021 11:01:17 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57710) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m6wfm-0001K5-K2; Fri, 23 Jul 2021 11:01:10 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1m6wff-0002Po-Nx; Fri, 23 Jul 2021 11:01:05 -0400 From: Glenn Morris To: Lars Ingebrigtsen Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions References: <87eeeestgu.fsf@gnus.org> <87fsw5cgu6.fsf@gnus.org> X-Spook: Swine CipherTAC-2000 Montenegro Biological infection X-Ran: 0}X.!1DDyN1Fazc,*`N{X3VQ-z^`/hr;cY (Lars Ingebrigtsen's message of "Fri, 23 Jul 2021 15:14:41 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 21466 Cc: Alan Mackenzie , Stefan Monnier , 21466@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: -3.3 (---) Lars Ingebrigtsen wrote: >> So indeed, a real FILE argument would be preferable, but passing nil >> works fine (it will simply prevent `check-declare` from making sure >> that file indeed defines that function, > > I've now amended the doc string to `declare-function on the trunk to > mention this. Whilst that may happen to work as a kludge, it's against the intent of declare-function, so personally I would prefer that it either remained undocumented, or you do it properly and make FILE an optional argument (I haven't checked if check-declare would need changes for that). Ref: https://lists.gnu.org/r/emacs-devel/2007-11/msg01409.html From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 24 06:26:43 2021 Received: (at 21466) by debbugs.gnu.org; 24 Jul 2021 10:26:43 +0000 Received: from localhost ([127.0.0.1]:45212 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7Erj-00077o-FX for submit@debbugs.gnu.org; Sat, 24 Jul 2021 06:26:43 -0400 Received: from quimby.gnus.org ([95.216.78.240]:60450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m7Erg-00077a-VV for 21466@debbugs.gnu.org; Sat, 24 Jul 2021 06:26:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=QIZnZ1q7Wr/wkd5ZXC8zXIi0yeNrsCbZmhJE9k7DzEY=; b=EvyeGnrBOdF9S/vXqTXx/2AUW/ BcAy1m1rx9+Kvb/VtCl4LECLUc0N10+8jemg+EinKuxitAeU6CtBErXSR2pBpF+jlm1h5uYGbbmpN wNDfNPRkMcjJbUCCzHNe2+FH8J89QvJXH9rTiWBtEbbbz8Zhs8Gq5+uE08oP0ZBmRAiw=; Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m7ErX-0004ED-EK; Sat, 24 Jul 2021 12:26:34 +0200 From: Lars Ingebrigtsen To: Glenn Morris Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions References: <87eeeestgu.fsf@gnus.org> <87fsw5cgu6.fsf@gnus.org> Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/xhBQAAACBj SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAElBMVEX41p3otofWmnCp aVNKLyb///85U+krAAAAAWJLR0QF+G/pxwAAAAd0SU1FB+UHGAoJDHgz8UUAAAG+SURBVDjLbZPb leQgDETBk4CENwAjOoA2cgLbkH9MWxL4MbNDf7QPl1LxKIUwB4VvI15fRN/gE8Qn4CeIvwKQhS7E fJUkgGtdvACbgsMpYU5zhZRE27YQnwrx/0UxStry6cHJwZdq762CMIqwCRwsNo8BEfEcE/QxmuaT SDGno5+kxm3MOwhzFlxlCkQNXIrePjG7w09gkmigOHi1m7wj/w42caAO1v6oNb0dfD3A3+n9H2jZ wfCITxCt0gRhPZ6KdIOnP3G+AZ7h9GnJBBNQvjUfTtU2pf7A/tTu07YYdW53CSsvmyQ//l5ZtJZq pTisVLIWu/amutayFzWwhUJFHDQ8LyxyKQYyAFa89Gh6qEorMhQprPngT2na8VP5lPoa5rQmxZd5 9KppTyg1tksStVrmYF7tPdYyDph2ThmJAcChcbvmYnFeaPF52EsOI1YABPsUKUqWVxMakUZKcCGW VogiQB4gOUCMI0PE6U/fzrAPABXOyXnt7xuMUJ7dsNNoKGRXpiKEYl1yNhRAzhO8cCmdpjuAn4k9 wniSOmpNIBmS0Sbt6kEHArCMMLgiXkB45qS9z3b2fF1AdR+15B+Mln+kRFSe+QAAACV0RVh0ZGF0 ZTpjcmVhdGUAMjAyMS0wNy0yNFQxMDowOToxMiswMDowMGuojjIAAAAldEVYdGRhdGU6bW9kaWZ5 ADIwMjEtMDctMjRUMTA6MDk6MTIrMDA6MDAa9TaOAAAAAElFTkSuQmCC X-Now-Playing: Heidi Berry's _Heidi Berry_: "For the Rose" Date: Sat, 24 Jul 2021 12:26:30 +0200 In-Reply-To: (Glenn Morris's message of "Fri, 23 Jul 2021 11:01:03 -0400") Message-ID: <87czr8husp.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Glenn Morris writes: > Whilst that may happen to work as a kludge, it's against the intent of > declare-function, so personally I would prefer that it either remained > undocumented, or you do it properly and make FILE an [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 21466 Cc: Alan Mackenzie , Stefan Monnier , 21466@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: -3.3 (---) Glenn Morris writes: > Whilst that may happen to work as a kludge, it's against the intent of > declare-function, so personally I would prefer that it either remained > undocumented, or you do it properly and make FILE an optional argument > (I haven't checked if check-declare would need changes for that). I almost made it optional at the same time, but then changed my mind -- the nil case is abnormal and it probably almost always an error, so having an explicit nil parameter seemed a more productive alternative. But if others feel differently, go ahead and change it. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 23 16:14:00 2022 Received: (at 21466) by debbugs.gnu.org; 23 Mar 2022 20:14:01 +0000 Received: from localhost ([127.0.0.1]:46134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nX7Mm-0007up-BZ for submit@debbugs.gnu.org; Wed, 23 Mar 2022 16:14:00 -0400 Received: from quimby.gnus.org ([95.216.78.240]:50212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nX7Mi-0007uZ-PK for 21466@debbugs.gnu.org; Wed, 23 Mar 2022 16:13:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=apqPH2pEVYFqXlmIt59mUW7pTbNU+1pvHiL1Rx5dP0Q=; b=Oax2VhkFTwE0Xq9+Mmid6ERB/F D4AJM6T2KU9nZNAQSxq5fqstA6PyrcLdUIrMFTyEDmTSqMz0BSmCniTFA7cZs2HvqLqqeLGRTocys n55q2rJGf8R5A1MIOMKOqtDxNe1mkMmOt58SHHkgGJNBUS9wJ4SGwaPyECWjjXgasIok=; Received: from 109.179.236.69.tmi.telenormobil.no ([109.179.236.69] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nX7MT-0007qB-Rw; Wed, 23 Mar 2022 21:13:44 +0100 From: Lars Ingebrigtsen To: Alan Mackenzie Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions References: <87eeeestgu.fsf@gnus.org> Date: Wed, 23 Mar 2022 21:13:35 +0100 In-Reply-To: (Alan Mackenzie's message of "Tue, 11 May 2021 20:34:30 +0000") Message-ID: <87y2105swg.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alan Mackenzie writes: > So, I don't object on principle to the principle of the patch, just > there are these little irritations about it, and it will need me to > study it more closely to check nothing subtle would get lo [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 21466 Cc: Stefan Monnier , 21466@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: -3.3 (---) Alan Mackenzie writes: > So, I don't object on principle to the principle of the patch, just > there are these little irritations about it, and it will need me to > study it more closely to check nothing subtle would get lost (I doubt it > would). The patch no longer applied to Emacs 29, so I've respun it. diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el index 4b8154dafe..277ba29a89 100644 --- a/lisp/progmodes/cc-bytecomp.el +++ b/lisp/progmodes/cc-bytecomp.el @@ -75,12 +75,10 @@ (defvar cc-bytecomp-unbound-variables nil) (defvar cc-bytecomp-original-functions nil) -(defvar cc-bytecomp-original-properties nil) (defvar cc-bytecomp-loaded-files nil) (setq cc-bytecomp-unbound-variables nil) (setq cc-bytecomp-original-functions nil) -(setq cc-bytecomp-original-properties nil) (setq cc-bytecomp-loaded-files nil) (defvar cc-bytecomp-environment-set nil) @@ -177,16 +175,6 @@ cc-bytecomp-setup-environment (cc-bytecomp-debug-msg "cc-bytecomp-setup-environment: Covered function %s" fun)))) (setq p (cdr p))) - (setq p cc-bytecomp-original-properties) - (while p - (let ((sym (car (car (car p)))) - (prop (cdr (car (car p)))) - (tempdef (car (cdr (car p))))) - (put sym prop tempdef) - (cc-bytecomp-debug-msg - "cc-bytecomp-setup-environment: Bound property %s for %s to %s" - prop sym tempdef)) - (setq p (cdr p))) (setq cc-bytecomp-environment-set t) (cc-bytecomp-debug-msg "cc-bytecomp-setup-environment: Done")))) @@ -236,22 +224,6 @@ cc-bytecomp-restore-environment "cc-bytecomp-restore-environment: Not restoring function %s" fun)))) (setq p (cdr p))) - (setq p cc-bytecomp-original-properties) - (while p - (let ((sym (car (car (car p)))) - (prop (cdr (car (car p)))) - (tempdef (car (cdr (car p)))) - (origdef (cdr (cdr (car p))))) - (if (eq (get sym prop) tempdef) - (progn - (put sym prop origdef) - (cc-bytecomp-debug-msg - "cc-bytecomp-restore-environment: Restored property %s for %s to %s" - prop sym origdef)) - (cc-bytecomp-debug-msg - "cc-bytecomp-restore-environment: Not restoring property %s for %s" - prop sym))) - (setq p (cdr p))) (setq cc-bytecomp-environment-set nil) (cc-bytecomp-debug-msg "cc-bytecomp-restore-environment: Done")))) @@ -385,23 +357,26 @@ cc-bytecomp-defvar This can be used to silence the byte compiler. Don't use within `eval-when-compile'." (declare (debug nil)) - `(eval-when-compile - (if (boundp ',var) - (cc-bytecomp-debug-msg - "cc-bytecomp-defvar: %s bound already as variable" ',var) - (if (not (memq ',var cc-bytecomp-unbound-variables)) - (progn - (cc-bytecomp-debug-msg - "cc-bytecomp-defvar: Saving %s (as unbound)" ',var) - (setq cc-bytecomp-unbound-variables - (cons ',var cc-bytecomp-unbound-variables)))) - (if (cc-bytecomp-is-compiling) - (progn - (defvar ,var) - (set ',var (intern (concat "cc-bytecomp-ignore-var:" - (symbol-name ',var)))) - (cc-bytecomp-debug-msg - "cc-bytecomp-defvar: Covered variable %s" ',var)))))) + (if (not (featurep 'xemacs)) + `(defvar ,var) + ;; Not sure if XEmacs's `defvar' works in the same way. + `(eval-when-compile + (if (boundp ',var) + (cc-bytecomp-debug-msg + "cc-bytecomp-defvar: %s bound already as variable" ',var) + (if (not (memq ',var cc-bytecomp-unbound-variables)) + (progn + (cc-bytecomp-debug-msg + "cc-bytecomp-defvar: Saving %s (as unbound)" ',var) + (setq cc-bytecomp-unbound-variables + (cons ',var cc-bytecomp-unbound-variables)))) + (if (cc-bytecomp-is-compiling) + (progn + (defvar ,var) + (set ',var (intern (concat "cc-bytecomp-ignore-var:" + (symbol-name ',var)))) + (cc-bytecomp-debug-msg + "cc-bytecomp-defvar: Covered variable %s" ',var))))))) (defmacro cc-bytecomp-defun (fun) "Bind the symbol FUN as a function during compilation of the file. @@ -414,42 +389,25 @@ cc-bytecomp-defun existing functions since the byte compiler might need the definition at compile time, e.g. for macros and inline functions." (declare (debug nil)) - `(eval-when-compile - (if (fboundp ',fun) - (cc-bytecomp-debug-msg - "cc-bytecomp-defun: %s bound already as function" ',fun) - (if (not (assq ',fun cc-bytecomp-original-functions)) - (progn - (cc-bytecomp-debug-msg - "cc-bytecomp-defun: Saving %s (as unbound)" ',fun) - (setq cc-bytecomp-original-functions - (cons (list ',fun nil 'unbound) - cc-bytecomp-original-functions)))) - (if (cc-bytecomp-is-compiling) - (progn - (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:" - (symbol-name ',fun)))) - (cc-bytecomp-debug-msg - "cc-bytecomp-defun: Covered function %s" ',fun)))))) - -(defmacro cc-bytecomp-put (symbol propname value) - "Set a property on SYMBOL during compilation (and evaluation) of the file. -Don't use outside `eval-when-compile'." - (declare (debug t)) - `(eval-when-compile - (if (not (assoc (cons ,symbol ,propname) cc-bytecomp-original-properties)) - (progn + (if (fboundp 'declare-function) + `(declare-function ,fun nil) + `(eval-when-compile + (if (fboundp ',fun) (cc-bytecomp-debug-msg - "cc-bytecomp-put: Saving property %s for %s with value %s" - ,propname ,symbol (get ,symbol ,propname)) - (setq cc-bytecomp-original-properties - (cons (cons (cons ,symbol ,propname) - (cons ,value (get ,symbol ,propname))) - cc-bytecomp-original-properties)))) - (put ,symbol ,propname ,value) - (cc-bytecomp-debug-msg - "cc-bytecomp-put: Bound property %s for %s to %s" - ,propname ,symbol ,value))) + "cc-bytecomp-defun: %s bound already as function" ',fun) + (if (not (assq ',fun cc-bytecomp-original-functions)) + (progn + (cc-bytecomp-debug-msg + "cc-bytecomp-defun: Saving %s (as unbound)" ',fun) + (setq cc-bytecomp-original-functions + (cons (list ',fun nil 'unbound) + cc-bytecomp-original-functions)))) + (if (cc-bytecomp-is-compiling) + (progn + (fset ',fun (intern (concat "cc-bytecomp-ignore-fun:" + (symbol-name ',fun)))) + (cc-bytecomp-debug-msg + "cc-bytecomp-defun: Covered function %s" ',fun))))))) (defmacro cc-bytecomp-boundp (symbol) "Return non-nil if SYMBOL is bound as a variable outside the compilation. @@ -457,7 +415,8 @@ cc-bytecomp-boundp variables that have been bound during compilation with `cc-bytecomp-defvar'." (declare (debug t)) - (if (and (cc-bytecomp-is-compiling) + (if (and (featurep 'xemacs) + (cc-bytecomp-is-compiling) (memq (car (cdr symbol)) cc-bytecomp-unbound-variables)) nil `(boundp ,symbol))) @@ -469,7 +428,8 @@ cc-bytecomp-fboundp `cc-bytecomp-defun'." (declare (debug t)) (let (fun-elem) - (if (and (cc-bytecomp-is-compiling) + (if (and (not (fboundp 'declare-function)) + (cc-bytecomp-is-compiling) (setq fun-elem (assq (car (cdr symbol)) cc-bytecomp-original-functions)) (eq (elt fun-elem 2) 'unbound)) However, it leads to a number of warnings when compiling, so either my respin is faulty, or something's changed to make it not work any more? In c-fontify-recorded-types-and-refs: progmodes/cc-fonts.el:491:8: Warning: function `c-fontify-recorded-types-and-refs' defined multiple times in this file ELC progmodes/cc-styles.elc In c-font-lock-declarators: progmodes/cc-fonts.el:1063:8: Warning: function `c-font-lock-declarators' defined multiple times in this file progmodes/cc-fonts.el:2300:35: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2300:35: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2496:37: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2496:37: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2501:37: Warning: reference to free variable `c-reference-face-name' In c-font-lock-objc-method: progmodes/cc-fonts.el:2527:8: Warning: function `c-font-lock-objc-method' defined multiple times in this file progmodes/cc-fonts.el:2602:38: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2602:38: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2650:38: Warning: reference to free variable `c-reference-face-name' progmodes/cc-fonts.el:2678:37: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2678:37: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2683:37: Warning: reference to free variable `c-reference-face-name' progmodes/cc-fonts.el:2711:38: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2711:38: Warning: reference to free variable `c-preprocessor-face-name' progmodes/cc-fonts.el:2716:38: Warning: reference to free variable `c-reference-face-name' From debbugs-submit-bounces@debbugs.gnu.org Fri Mar 25 17:09:22 2022 Received: (at 21466) by debbugs.gnu.org; 25 Mar 2022 21:09:22 +0000 Received: from localhost ([127.0.0.1]:52638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nXrBR-0003QI-O5 for submit@debbugs.gnu.org; Fri, 25 Mar 2022 17:09:22 -0400 Received: from colin.muc.de ([193.149.48.1]:25628 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1nXrBP-0003Pw-C3 for 21466@debbugs.gnu.org; Fri, 25 Mar 2022 17:09:20 -0400 Received: (qmail 5525 invoked by uid 3782); 25 Mar 2022 21:09:12 -0000 Received: from acm.muc.de (p4fe15c1e.dip0.t-ipconnect.de [79.225.92.30]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 25 Mar 2022 22:09:12 +0100 Received: (qmail 15788 invoked by uid 1000); 25 Mar 2022 21:09:11 -0000 Date: Fri, 25 Mar 2022 21:09:11 +0000 To: Lars Ingebrigtsen Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions Message-ID: References: <87eeeestgu.fsf@gnus.org> <87y2105swg.fsf@gnus.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y2105swg.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 21466 Cc: Stefan Monnier , 21466@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 (-) Hello, Lars. On Wed, Mar 23, 2022 at 21:13:35 +0100, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > > So, I don't object on principle to the principle of the patch, just > > there are these little irritations about it, and it will need me to > > study it more closely to check nothing subtle would get lost (I doubt it > > would). > The patch no longer applied to Emacs 29, so I've respun it. [ .... ] I'll take a look at it, hopefully over the weekend. > However, it leads to a number of warnings when compiling, so either my > respin is faulty, or something's changed to make it not work any more? > In c-fontify-recorded-types-and-refs: > progmodes/cc-fonts.el:491:8: Warning: function `c-fontify-recorded-types-and-refs' defined multiple times in this file > ELC progmodes/cc-styles.elc > In c-font-lock-declarators: > progmodes/cc-fonts.el:1063:8: Warning: function `c-font-lock-declarators' defined multiple times in this file > progmodes/cc-fonts.el:2300:35: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2300:35: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2496:37: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2496:37: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2501:37: Warning: reference to free variable `c-reference-face-name' > In c-font-lock-objc-method: > progmodes/cc-fonts.el:2527:8: Warning: function `c-font-lock-objc-method' defined multiple times in this file > progmodes/cc-fonts.el:2602:38: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2602:38: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2650:38: Warning: reference to free variable `c-reference-face-name' > progmodes/cc-fonts.el:2678:37: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2678:37: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2683:37: Warning: reference to free variable `c-reference-face-name' > progmodes/cc-fonts.el:2711:38: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2711:38: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2716:38: Warning: reference to free variable `c-reference-face-name' -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 26 10:45:50 2022 Received: (at 21466) by debbugs.gnu.org; 26 Mar 2022 14:45:50 +0000 Received: from localhost ([127.0.0.1]:54479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nY7fp-0007du-VB for submit@debbugs.gnu.org; Sat, 26 Mar 2022 10:45:50 -0400 Received: from colin.muc.de ([193.149.48.1]:19826 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1nY7fo-0007dd-39 for 21466@debbugs.gnu.org; Sat, 26 Mar 2022 10:45:48 -0400 Received: (qmail 20127 invoked by uid 3782); 26 Mar 2022 14:45:41 -0000 Received: from acm.muc.de (p2e5d5498.dip0.t-ipconnect.de [46.93.84.152]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 26 Mar 2022 15:45:40 +0100 Received: (qmail 6063 invoked by uid 1000); 26 Mar 2022 14:45:40 -0000 Date: Sat, 26 Mar 2022 14:45:40 +0000 To: Lars Ingebrigtsen Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions Message-ID: References: <87eeeestgu.fsf@gnus.org> <87y2105swg.fsf@gnus.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y2105swg.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 21466 Cc: acm@muc.de, Stefan Monnier , 21466@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 (-) Hello again, Lars. On Wed, Mar 23, 2022 at 21:13:35 +0100, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > > So, I don't object on principle to the principle of the patch, just > > there are these little irritations about it, and it will need me to > > study it more closely to check nothing subtle would get lost (I doubt it > > would). > The patch no longer applied to Emacs 29, so I've respun it. [ .... ] > However, it leads to a number of warnings when compiling, so either my > respin is faulty, or something's changed to make it not work any more? Maybe it didn't work properly back in 2015, I didn't actually get around to trying it out, then. > In c-fontify-recorded-types-and-refs: > progmodes/cc-fonts.el:491:8: Warning: function `c-fontify-recorded-types-and-refs' defined multiple times in this file > ELC progmodes/cc-styles.elc > In c-font-lock-declarators: > progmodes/cc-fonts.el:1063:8: Warning: function `c-font-lock-declarators' defined multiple times in this file > progmodes/cc-fonts.el:2300:35: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2300:35: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2496:37: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2496:37: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2501:37: Warning: reference to free variable `c-reference-face-name' > In c-font-lock-objc-method: > progmodes/cc-fonts.el:2527:8: Warning: function `c-font-lock-objc-method' defined multiple times in this file > progmodes/cc-fonts.el:2602:38: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2602:38: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2650:38: Warning: reference to free variable `c-reference-face-name' > progmodes/cc-fonts.el:2678:37: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2678:37: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2683:37: Warning: reference to free variable `c-reference-face-name' > progmodes/cc-fonts.el:2711:38: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2711:38: Warning: reference to free variable `c-preprocessor-face-name' > progmodes/cc-fonts.el:2716:38: Warning: reference to free variable `c-reference-face-name' The patch is essentially replacing cc-bytecomp-defvar by (defvar foo), and cc-bytecomp-defun by (declare-function 'foo nil). These are only approximately similar. cc-bytecomp-def{var,fun} are like C's extern. They say "this variable/function will be defined somewhere else". By contrast, (defvar foo) doesn't really do anything (?except marking any possible foo as a special variable). (declare-function 'foo nil) says "This function HAS ALREADY been defined somewhere else (and don't you dare redefine it!)." These explain the "free variable" warnings for the variables and the "defined multiple times" warnings for the functions. To sort out this bug properly, we really need Lisp functions equivalent to C's extern. (defvar foo) and (declare-function 'foo nil) currently don't fill this need. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 26 12:47:36 2022 Received: (at 21466) by debbugs.gnu.org; 26 Mar 2022 16:47:36 +0000 Received: from localhost ([127.0.0.1]:54621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nY9Zf-0004WI-PT for submit@debbugs.gnu.org; Sat, 26 Mar 2022 12:47:36 -0400 Received: from quimby.gnus.org ([95.216.78.240]:55004) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nY9Zd-0004SH-W9 for 21466@debbugs.gnu.org; Sat, 26 Mar 2022 12:47:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=6NbM2jarYjj0kfdQh2gyofzwhO2RYWOcreS+kWEYSL8=; b=ToA/Ikk3cCoouyeNHx0x1Qolkn ksl5fdYgOPsAYxF2CScUVpfSaOXkCeGRLlhbl/glN4ObhesMUKRq9FU/Y58p/iMRwBWrNcg/ZZSVA 0/hY4ITT/ZO38VhZnU1Es68rtMG8/vAvQSybb6lXTOU74O3ZTDYVf/MDmEPZ3Cfg0yEk=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nY9ZV-00018Q-7E; Sat, 26 Mar 2022 17:47:27 +0100 From: Lars Ingebrigtsen To: Alan Mackenzie Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions References: <87eeeestgu.fsf@gnus.org> <87y2105swg.fsf@gnus.org> Date: Sat, 26 Mar 2022 17:47:24 +0100 In-Reply-To: (Alan Mackenzie's message of "Sat, 26 Mar 2022 14:45:40 +0000") Message-ID: <877d8gd5k3.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alan Mackenzie writes: > These explain the "free variable" warnings for the variables and the > "defined multiple times" warnings for the functions. > > To sort out this bug properly, we really need Lisp functions equivalen [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 21466 Cc: Stefan Monnier , 21466@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: -3.3 (---) Alan Mackenzie writes: > These explain the "free variable" warnings for the variables and the > "defined multiple times" warnings for the functions. > > To sort out this bug properly, we really need Lisp functions equivalent > to C's extern. (defvar foo) and (declare-function 'foo nil) currently > don't fill this need. I had a brief look at a couple of the warnings (after the patch), and it looks like the warnings could be resolved by just removing the cc-bytecomp-deffun (and rearranging the code order). -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 26 15:51:46 2022 Received: (at 21466) by debbugs.gnu.org; 26 Mar 2022 19:51:46 +0000 Received: from localhost ([127.0.0.1]:54718 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nYCRu-0002p5-DP for submit@debbugs.gnu.org; Sat, 26 Mar 2022 15:51:46 -0400 Received: from colin.muc.de ([193.149.48.1]:27813 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1nYCRr-0002oq-Rk for 21466@debbugs.gnu.org; Sat, 26 Mar 2022 15:51:44 -0400 Received: (qmail 26377 invoked by uid 3782); 26 Mar 2022 19:51:36 -0000 Received: from acm.muc.de (p2e5d5498.dip0.t-ipconnect.de [46.93.84.152]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 26 Mar 2022 20:51:36 +0100 Received: (qmail 9046 invoked by uid 1000); 26 Mar 2022 19:51:35 -0000 Date: Sat, 26 Mar 2022 19:51:35 +0000 To: Lars Ingebrigtsen Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions Message-ID: References: <87eeeestgu.fsf@gnus.org> <87y2105swg.fsf@gnus.org> <877d8gd5k3.fsf@gnus.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877d8gd5k3.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 21466 Cc: Stefan Monnier , 21466@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 (-) Hello, Lars. On Sat, Mar 26, 2022 at 17:47:24 +0100, Lars Ingebrigtsen wrote: > Alan Mackenzie writes: > > These explain the "free variable" warnings for the variables and the > > "defined multiple times" warnings for the functions. > > To sort out this bug properly, we really need Lisp functions equivalent > > to C's extern. (defvar foo) and (declare-function 'foo nil) currently > > don't fill this need. > I had a brief look at a couple of the warnings (after the patch), and it > looks like the warnings could be resolved by just removing the > cc-bytecomp-deffun (and rearranging the code order). The whole patch was predicated on: >>>> It might have made sense back in the days when the >>>> byte-compiler did not offer built-in ways to silence those >>>> warnings, but nowadays we can do better. I'm not convinced that what the byte compiler currently offers is "better", if that involves having to rearrange things in a source file. And even then, that would only resolve two of the ~15 warning messages. By contrast, leaving things alone is not causing any trouble, and seems unlikely to cause trouble in the near future. There is currently no clean way of declaring a symbol's variable or function cell as bound for the byte compiler. Perhaps there should be. > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 29 08:26:43 2022 Received: (at 21466) by debbugs.gnu.org; 29 Mar 2022 12:26:43 +0000 Received: from localhost ([127.0.0.1]:60083 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZAvr-0008AH-70 for submit@debbugs.gnu.org; Tue, 29 Mar 2022 08:26:43 -0400 Received: from quimby.gnus.org ([95.216.78.240]:59706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZAvo-00089y-J6 for 21466@debbugs.gnu.org; Tue, 29 Mar 2022 08:26:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Fw5j+kEdNdtwZhK31PXZ7Ca3SgrN6oX8GuT89bHec/Q=; b=QoShYFfqinkCDAx8kyV5iy9UZr YNcc8W66R8UEed4TDpchFVU97StdnelWne900U2kwaKOOuLtEjJt2GbFMSYWT8RQ5anzjRigCo+pq h+OnvRCrX3mmWftzEnochh9NwX4wPMr0A7s7RgGVC7n1ueg9dL0wuChorAANiMjhFSUw=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZAve-0002lj-TL; Tue, 29 Mar 2022 14:26:33 +0200 From: Lars Ingebrigtsen To: Alan Mackenzie Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions References: <87eeeestgu.fsf@gnus.org> <87y2105swg.fsf@gnus.org> <877d8gd5k3.fsf@gnus.org> Date: Tue, 29 Mar 2022 14:26:28 +0200 In-Reply-To: (Alan Mackenzie's message of "Sat, 26 Mar 2022 19:51:35 +0000") Message-ID: <87mth9aqrv.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Alan Mackenzie writes: > By contrast, leaving things alone is not causing any trouble, and seems > unlikely to cause trouble in the near future. OK, I guess the conclusion here is that we're not going to apply this patch, so I'm closing this bug report. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 21466 Cc: Stefan Monnier , 21466@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: -3.3 (---) Alan Mackenzie writes: > By contrast, leaving things alone is not causing any trouble, and seems > unlikely to cause trouble in the near future. OK, I guess the conclusion here is that we're not going to apply this patch, so I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 29 08:26:50 2022 Received: (at control) by debbugs.gnu.org; 29 Mar 2022 12:26:50 +0000 Received: from localhost ([127.0.0.1]:60086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZAvy-0008Ac-Eu for submit@debbugs.gnu.org; Tue, 29 Mar 2022 08:26:50 -0400 Received: from quimby.gnus.org ([95.216.78.240]:59722) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZAvw-0008AI-J6 for control@debbugs.gnu.org; Tue, 29 Mar 2022 08:26:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xAFz5+QCphUvAw730cF9o7XkLq2VAqt1tdnrrH17FG4=; b=hxVyRHzia5pj8wGj7oHGgOoO1S YZwEP07H5CbbTEixb159QnkreaoSX11bBXBV6rPkdKWnArtIUOXV0Xskt9ep8jm3tADzVq8WnnkLN TqpxQ/lZidoVTaTsiDh75VHeMpKg8kEDA9urlShzKOZZ7FXPHLkdA7OQOmEcjVuSZeio=; Received: from [84.212.220.105] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZAvp-0002lx-98 for control@debbugs.gnu.org; Tue, 29 Mar 2022 14:26:43 +0200 Date: Tue, 29 Mar 2022 14:26:38 +0200 Message-Id: <87lewtaqrl.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #21466 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 21466 wontfix close 21466 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control 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: -3.3 (---) tags 21466 wontfix close 21466 quit From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 29 17:02:16 2022 Received: (at 21466) by debbugs.gnu.org; 29 Mar 2022 21:02:16 +0000 Received: from localhost ([127.0.0.1]:33749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZIym-00070w-BK for submit@debbugs.gnu.org; Tue, 29 Mar 2022 17:02:16 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36235) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZIyk-00070X-2z for 21466@debbugs.gnu.org; Tue, 29 Mar 2022 17:02:14 -0400 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 666D110025F; Tue, 29 Mar 2022 17:02:08 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id F3C1E10019F; Tue, 29 Mar 2022 17:02:06 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1648587727; bh=E78DxuVSd8wCbCeUgDYdk3PhQ7KPtoeIsiKobYyfsw0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=lBgvk0JbJ2vlGYCE08BTFB5mAA+UiUM3xi9sW1kIrpbSGWpNvGuVl1ASp8puJAAnh CTsJIRsfz74p0kKRgl6MTnBl6yyLmlROxbEOQOuQ1hD6boa+/MClWrX2YZ9xtBQkA/ FpnaBE206O8Vc4IBSsHkRZmYXkTZiq2aaOI1/cvaWrUkQLcHykil85zcRY6pvKfmcb hf1VhOQoeXd/a0UU67eVdd74IZI414XyxdRM5RCqb7ttQCM+EtnAk7onP09mx/EuDm 05ShfBgR+/Cbqunc2BNcQ5iBbuT87mrimJTg9Qi5nLkst82k5JsvhxP1vWXJCoajxF xg2Ya4GfGbxcg== Received: from ceviche (dyn.144-85-153-166.dsl.vtx.ch [144.85.153.166]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2227412020A; Tue, 29 Mar 2022 17:02:06 -0400 (EDT) From: Stefan Monnier To: Alan Mackenzie Subject: Re: bug#21466: [PATCH] Avoid defining (temporarily) vars and functions Message-ID: References: <87eeeestgu.fsf@gnus.org> <87y2105swg.fsf@gnus.org> <877d8gd5k3.fsf@gnus.org> Date: Tue, 29 Mar 2022 17:02:04 -0400 In-Reply-To: (Alan Mackenzie's message of "Sat, 26 Mar 2022 19:51:35 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.327 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain T_SCC_BODY_TEXT_LINE -0.01 - X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 21466 Cc: Lars Ingebrigtsen , 21466@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: -3.3 (---) > There is currently no clean way of declaring a symbol's variable or > function cell as bound for the byte compiler. I think there is: (defvar ) and (declare-function ) is used for that by all other ELisp packages. Stefan From unknown Fri Aug 15 20:53:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 27 Apr 2022 11:24:11 +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