From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71805: master: New interpreted function format prevents native compilation. Date: Sat, 29 Jun 2024 17:30:46 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24906"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 71805@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 29 23:31:25 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sNffJ-0006L1-2O for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Jun 2024 23:31:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNff0-0007Gq-DE; Sat, 29 Jun 2024 17:31:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNfex-0007EP-Lj for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2024 17:31:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sNfex-0003ic-AQ for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2024 17:31:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sNfew-0001VO-P5 for bug-gnu-emacs@gnu.org; Sat, 29 Jun 2024 17:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Jun 2024 21:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71805 X-GNU-PR-Package: emacs Original-Received: via spool by 71805-submit@debbugs.gnu.org id=B71805.17196966595769 (code B ref 71805); Sat, 29 Jun 2024 21:31:02 +0000 Original-Received: (at 71805) by debbugs.gnu.org; 29 Jun 2024 21:30:59 +0000 Original-Received: from localhost ([127.0.0.1]:53820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNfet-0001Uz-3N for submit@debbugs.gnu.org; Sat, 29 Jun 2024 17:30:59 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:45642) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sNfeq-0001Uj-LP for 71805@debbugs.gnu.org; Sat, 29 Jun 2024 17:30:57 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E5ED8100061; Sat, 29 Jun 2024 17:30:49 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1719696648; bh=0M8CX9RW5o4T302+FgBtQ0AtzEy1zxuhQMkCmggVCIk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=L/nG/qnvb58cN3q6cebW2RdvWKBuQ5rS+pR+Hb15ZR1en/71Doc2RsTeAfZnPLGkf idhlaNooJsMX0nIDTW+v50sZdvgXikkJX4K3cwKROpxXk3PsD3WSt8FuYJq/2FRPg3 b8EYrIiPINFO7v1u0NIjDGVSV32vZhTWkBv7qIloiK/FwbppIbdPKPthyEiqHwZmbB +XPx4sYJuRdEZEPH11TVHb4Ad9ZyWtFGc/6Ybxze2zIwceRi8k5xxPaoCq1VA4onrw WTCdZRlsbV/9rpQzPazhSXC+fFC0x5xp0LtI6ArDatk8nKIFbqe0lLe9pbxDOFcc+f NzXmX4mO+o4lA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6AFA1100035; Sat, 29 Jun 2024 17:30:48 -0400 (EDT) Original-Received: from pastel (unknown [45.72.245.253]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 060241202A2; Sat, 29 Jun 2024 17:30:47 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Thu, 27 Jun 2024 16:00:58 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:288133 Archived-At: > With a recent master repo (likely also the emacs-30 branch): > (i) mkdir ~/cc-mode.hg. > (ii) chdir ~/cc-mode.hg. > (iii) Copy cc-mode.hg.tar.gz from this bug report to ~/cc-mode.hg. > (iv) tar -zxf cc-mode.tar.gz. > The CC Mode source files should now be in the current directory. > > (v) emacs -Q -batch -f batch-byte-compile *.el > The CC Mode .elc files should now be present. I haven't tried quite that command, instead I went straight for: emacs -Q --batch -L . \ --eval '(setq debug-on-error t byte-compile-debug t)' \ -f batch-byte-compile cc-fonts.el which gave me an error with the following backtrace: Debugger entered--Lisp error: (wrong-type-argument listp #f(lambda (for= m) :dynbind `(cdr (backquote-process ,form)))) car(#f(lambda (form) :dynbind `(cdr (backquote-process ,form)))) #f(compiled-function (evald func args flags) #)(nil defmacro (bq-process macro . #f(lambda (form) :dynbind `(cdr (= backquote-process ,form)))) nil) mapbacktrace(#f(compiled-function (evald func args flags) #) debug-early--handler) debug-early-backtrace(debug-early--handler) debug--early((wrong-type-argument listp #f(lambda (form) :dynbind `(c= dr (backquote-process ,form)))) debug-early--handler) debug-early--handler((wrong-type-argument listp #f(lambda (form) :dyn= bind `(cdr (backquote-process ,form))))) (defmacro bq-process macro . #f(lambda (form) :dynbind `(cdr (backquo= te-process ,form)))) eval((defmacro bq-process macro . #f(lambda (form) :dynbind `(cdr (ba= ckquote-process ,form))))) (progn (eval (cons 'defmacro (cons fun temp-macro))) nil) (if temp-macro (progn (eval (cons 'defmacro (cons fun temp-macro))) n= il) (fset fun (intern (concat "cc-bytecomp-ignore-fun:" (symbol-name fun)))= ) nil) (if (not (fboundp fun)) (if temp-macro (progn (eval (cons 'defmacro (= cons fun temp-macro))) nil) (fset fun (intern (concat "cc-bytecomp-ignore-f= un:" (symbol-name fun)))) nil)) (let ((fun (car (car p))) (temp-macro (car (cdr (car p))))) (if (not = (fboundp fun)) (if temp-macro (progn (eval (cons 'defmacro (cons fun temp-m= acro))) nil) (fset fun (intern (concat "cc-bytecomp-ignore-fun:" (symbol-na= me fun)))) nil))) (while p (message "(car p) =3D=3D %S" (car p)) (let ((fun (car (car p= ))) (temp-macro (car (cdr (car p))))) (if (not (fboundp fun)) (if temp-macr= o (progn (eval (cons 'defmacro (cons fun temp-macro))) nil) (fset fun (inte= rn (concat "cc-bytecomp-ignore-fun:" (symbol-name fun)))) nil))) (setq p (c= dr p))) (let (p) (if cc-bytecomp-environment-set (error "Byte compilation env= ironment already set - perhaps a `cc-bytecomp-restore-environment' is forgo= tten somewhere")) (setq p cc-bytecomp-unbound-variables) (while p (if (not = (boundp (car p))) (progn (eval (list 'defvar (car p))) (set (car p) (intern= (concat "cc-bytecomp-ignore-var:" (symbol-name ...)))) nil)) (setq p (cdr = p))) (setq p cc-bytecomp-original-functions) (while p (message "(car p) =3D= =3D %S" (car p)) (let ((fun (car (car p))) (temp-macro (car (cdr (car p))))= ) (if (not (fboundp fun)) (if temp-macro (progn (eval (cons ... ...)) nil) = (fset fun (intern (concat "cc-bytecomp-ignore-fun:" ...))) nil))) (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) nil) (setq p (cdr p))) (setq p (reverse cc-bytecomp-p= ush-vars)) (while p (let ((var (car (car p))) (setqd-val (car (cdr (cdr ...= ))))) (set var setqd-val) nil) (setq p (cdr p))) (setq cc-bytecomp-environm= ent-set t) nil) (if (not (cc-bytecomp-is-loading)) (let (p) (if cc-bytecomp-environme= nt-set (error "Byte compilation environment already set - perhaps a `cc-byt= ecomp-restore-environment' is forgotten somewhere")) (setq p cc-bytecomp-un= bound-variables) (while p (if (not (boundp (car p))) (progn (eval (list 'de= fvar (car p))) (set (car p) (intern (concat "cc-bytecomp-ignore-var:" ...))= ) nil)) (setq p (cdr p))) (setq p cc-bytecomp-original-functions) (while p = (message "(car p) =3D=3D %S" (car p)) (let ((fun (car (car p))) (temp-macro= (car (cdr ...)))) (if (not (fboundp fun)) (if temp-macro (progn (eval ...)= nil) (fset fun (intern ...)) nil))) (setq p (cdr p))) (setq p cc-bytecomp-= original-properties) (while p (let ((sym (car (car ...))) (prop (cdr (car .= ..))) (tempdef (car (cdr ...)))) (put sym prop tempdef) nil) (setq p (cdr p= ))) (setq p (reverse cc-bytecomp-push-vars)) (while p (let ((var (car (car = p))) (setqd-val (car (cdr ...)))) (set var setqd-val) nil) (setq p (cdr p))= ) (setq cc-bytecomp-environment-set t) nil)) cc-bytecomp-setup-environment() So I added some `message`s in the `while p` loop of `cc-bytecomp-setup-environment` where there's the funny (eval `(defmacro ,fun ,@temp-macro)) and tried again with an older version of Emacs, to see how that worked: /usr/bin/emacs -Q --batch -L . \ --eval '(setq debug-on-error t byte-compile-debug t)' \ -f batch-byte-compile cc-fonts.el (car p) =3D=3D (c-clear-char-property-fun nil unbound) [...] (car p) =3D=3D (bq-process (macro lambda (form) `(cdr (backquote-proces= s ,form))) unbound) [...] (car p) =3D=3D (bq-process (macro lambda (form) `(cdr (backquote-proces= s ,form))) unbound) evalling: (defmacro bq-process macro lambda (form) `(cdr (backquote-pro= cess ,form))) And indeed in Emacs-28, it seems that (eval '(defmacro bq-process macro lambda (form) `(cdr (backquote-proces= s ,form)))) did not signal an error (tho it resulted in an incorrect definition): ELISP> (eval '(defmacro bq-process macro lambda (form) `(cdr (backquote= -process ,form)))) bq-process ELISP> (symbol-function 'bq-process) (macro lambda macro lambda (form) `(cdr (backquote-process ,form))) =20=20=20=20 ELISP>=20 I don't know what your code intends to do but doing (eval `(defmacro ,fun ,@temp-macro)) when `temp-macro` comes from the output of `symbol-function` (apparently in `cc-bytecomp-defmacro`) doesn't seem to make much sense. Stefan