bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36445: Byte-compilation does not warn about variables undefined at r


From: Wilfred Hughes
Subject: bug#36445: Byte-compilation does not warn about variables undefined at runtime
Date: Sun, 30 Jun 2019 14:20:16 +0100

The byte-compiler warns about functions that are defined at
compile-time but not at runtime. However, it doesn't warn about
variables that are only defined at compile-time.

As a result, this program produces incorrect bytecode without any warnings:

(eval-when-compile
  (defconst demo-one 1))

(defvar demo-some-var
  `(foo bar ,demo-one))

Produces the following .elc file:

;ELC
;;; Compiled
;;; in Emacs version 26.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.

;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(defvar demo-some-var (list 'foo 'bar demo-one))

Could Emacs warn about variables in this situation, to match the logic
with functions?

Originally discussed in
https://emacs.stackexchange.com/questions/51075/how-do-i-get-byte-compilation-warnings-about-undefined-variables/51127





reply via email to

[Prev in Thread] Current Thread [Next in Thread]