aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2019-06-19 10:47:55 -0400
committerStefan Monnier2019-06-19 10:47:55 -0400
commit416b83e90724f0026fb757362e113cd542fe3de6 (patch)
treed47577ce84a5fccc92b48b825ecc73b60ac80241
parent65b2faf6fa8d962cd2c4275d91406d66d95b5ca7 (diff)
downloademacs-416b83e90724f0026fb757362e113cd542fe3de6.tar.gz
emacs-416b83e90724f0026fb757362e113cd542fe3de6.zip
(with-suppressed-warnings): Make it apply to macro-expansion as well
* lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment): Change with-suppressed-warnings so it also affects the macro-expansion of the body.
-rw-r--r--lisp/emacs-lisp/bytecomp.el34
1 files changed, 14 insertions, 20 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index c01c74a4569..b7351481106 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -142,7 +142,6 @@ If you change this, you might want to set `byte-compile-dest-file-function'.
142\(Note that the assumption of a \".elc\" suffix for compiled files 142\(Note that the assumption of a \".elc\" suffix for compiled files
143is hard-coded in various places in Emacs.)" 143is hard-coded in various places in Emacs.)"
144 ;; Eg is_elc in Fload. 144 ;; Eg is_elc in Fload.
145 :group 'bytecomp
146 :type 'regexp) 145 :type 'regexp)
147 146
148(defcustom byte-compile-dest-file-function nil 147(defcustom byte-compile-dest-file-function nil
@@ -152,7 +151,6 @@ file name, and return the name of the compiled file.
152\(Note that the assumption that the source and compiled files 151\(Note that the assumption that the source and compiled files
153are found in the same directory is hard-coded in various places in Emacs.)" 152are found in the same directory is hard-coded in various places in Emacs.)"
154 ;; Eg load-prefer-newer, documentation lookup IIRC. 153 ;; Eg load-prefer-newer, documentation lookup IIRC.
155 :group 'bytecomp
156 :type '(choice (const nil) function) 154 :type '(choice (const nil) function)
157 :version "23.2") 155 :version "23.2")
158 156
@@ -206,7 +204,6 @@ otherwise adds \".elc\"."
206(defcustom byte-compile-verbose 204(defcustom byte-compile-verbose
207 (and (not noninteractive) (> baud-rate search-slow-speed)) 205 (and (not noninteractive) (> baud-rate search-slow-speed))
208 "Non-nil means print messages describing progress of byte-compiler." 206 "Non-nil means print messages describing progress of byte-compiler."
209 :group 'bytecomp
210 :type 'boolean) 207 :type 'boolean)
211 208
212(defcustom byte-optimize t 209(defcustom byte-optimize t
@@ -216,7 +213,6 @@ Possible values are:
216 t - all optimizations 213 t - all optimizations
217 `source' - source-level optimizations only 214 `source' - source-level optimizations only
218 `byte' - code-level optimizations only" 215 `byte' - code-level optimizations only"
219 :group 'bytecomp
220 :type '(choice (const :tag "none" nil) 216 :type '(choice (const :tag "none" nil)
221 (const :tag "all" t) 217 (const :tag "all" t)
222 (const :tag "source-level" source) 218 (const :tag "source-level" source)
@@ -225,13 +221,11 @@ Possible values are:
225(defcustom byte-compile-delete-errors nil 221(defcustom byte-compile-delete-errors nil
226 "If non-nil, the optimizer may delete forms that may signal an error. 222 "If non-nil, the optimizer may delete forms that may signal an error.
227This includes variable references and calls to functions such as `car'." 223This includes variable references and calls to functions such as `car'."
228 :group 'bytecomp
229 :type 'boolean) 224 :type 'boolean)
230 225
231(defcustom byte-compile-cond-use-jump-table t 226(defcustom byte-compile-cond-use-jump-table t
232 "Compile `cond' clauses to a jump table implementation (using a hash-table)." 227 "Compile `cond' clauses to a jump table implementation (using a hash-table)."
233 :version "26.1" 228 :version "26.1"
234 :group 'bytecomp
235 :type 'boolean) 229 :type 'boolean)
236 230
237(defvar byte-compile-dynamic nil 231(defvar byte-compile-dynamic nil
@@ -267,7 +261,6 @@ in the source file. For example, add this to the first line:
267You can also set the variable globally. 261You can also set the variable globally.
268 262
269This option is enabled by default because it reduces Emacs memory usage." 263This option is enabled by default because it reduces Emacs memory usage."
270 :group 'bytecomp
271 :type 'boolean) 264 :type 'boolean)
272;;;###autoload(put 'byte-compile-dynamic-docstrings 'safe-local-variable 'booleanp) 265;;;###autoload(put 'byte-compile-dynamic-docstrings 'safe-local-variable 'booleanp)
273 266
@@ -279,7 +272,6 @@ This option is enabled by default because it reduces Emacs memory usage."
279If this is `source', then only source-level optimizations will be logged. 272If this is `source', then only source-level optimizations will be logged.
280If it is `byte', then only byte-level optimizations will be logged. 273If it is `byte', then only byte-level optimizations will be logged.
281The information is logged to `byte-compile-log-buffer'." 274The information is logged to `byte-compile-log-buffer'."
282 :group 'bytecomp
283 :type '(choice (const :tag "none" nil) 275 :type '(choice (const :tag "none" nil)
284 (const :tag "all" t) 276 (const :tag "all" t)
285 (const :tag "source-level" source) 277 (const :tag "source-level" source)
@@ -287,7 +279,6 @@ The information is logged to `byte-compile-log-buffer'."
287 279
288(defcustom byte-compile-error-on-warn nil 280(defcustom byte-compile-error-on-warn nil
289 "If true, the byte-compiler reports warnings with `error'." 281 "If true, the byte-compiler reports warnings with `error'."
290 :group 'bytecomp
291 :type 'boolean) 282 :type 'boolean)
292;; This needs to be autoloaded because it needs to be available to 283;; This needs to be autoloaded because it needs to be available to
293;; Emacs before the byte compiler is loaded, otherwise Emacs will not 284;; Emacs before the byte compiler is loaded, otherwise Emacs will not
@@ -325,7 +316,6 @@ Elements of the list may be:
325 316
326If the list begins with `not', then the remaining elements specify warnings to 317If the list begins with `not', then the remaining elements specify warnings to
327suppress. For example, (not mapcar) will suppress warnings about mapcar." 318suppress. For example, (not mapcar) will suppress warnings about mapcar."
328 :group 'bytecomp
329 :type `(choice (const :tag "All" t) 319 :type `(choice (const :tag "All" t)
330 (set :menu-tag "Some" 320 (set :menu-tag "Some"
331 ,@(mapcar (lambda (x) `(const ,x)) 321 ,@(mapcar (lambda (x) `(const ,x))
@@ -414,7 +404,6 @@ not reported.
414The call tree also lists those functions which are not known to be called 404The call tree also lists those functions which are not known to be called
415\(that is, to which no calls have been compiled). Functions which can be 405\(that is, to which no calls have been compiled). Functions which can be
416invoked interactively are excluded from this list." 406invoked interactively are excluded from this list."
417 :group 'bytecomp
418 :type '(choice (const :tag "Yes" t) (const :tag "No" nil) 407 :type '(choice (const :tag "Yes" t) (const :tag "No" nil)
419 (other :tag "Ask" lambda))) 408 (other :tag "Ask" lambda)))
420 409
@@ -432,7 +421,6 @@ FUNCTION.")
432 "If non-nil, sort the call tree. 421 "If non-nil, sort the call tree.
433The values `name', `callers', `calls', `calls+callers' 422The values `name', `callers', `calls', `calls+callers'
434specify different fields to sort on." 423specify different fields to sort on."
435 :group 'bytecomp
436 :type '(choice (const name) (const callers) (const calls) 424 :type '(choice (const name) (const callers) (const calls)
437 (const calls+callers) (const nil))) 425 (const calls+callers) (const nil)))
438 426
@@ -514,13 +502,20 @@ Return the compile-time value of FORM."
514 expanded))))) 502 expanded)))))
515 (with-suppressed-warnings 503 (with-suppressed-warnings
516 . ,(lambda (warnings &rest body) 504 . ,(lambda (warnings &rest body)
517 ;; This function doesn't exist, but is just a placeholder 505 ;; We let-bind `byte-compile--suppressed-warnings' here in order
518 ;; symbol to hook up with the 506 ;; to affect warnings emitted during macroexpansion.
519 ;; `byte-hunk-handler'/`byte-defop-compiler-1' machinery. 507 ;; Later `internal--with-suppressed-warnings' binds it again, this
520 `(internal--with-suppressed-warnings 508 ;; time in order to affect warnings emitted during the
521 ',warnings 509 ;; compilation itself.
522 ,(macroexpand-all `(progn ,@body) 510 (let ((byte-compile--suppressed-warnings
523 macroexpand-all-environment))))) 511 (append warnings byte-compile--suppressed-warnings)))
512 ;; This function doesn't exist, but is just a placeholder
513 ;; symbol to hook up with the
514 ;; `byte-hunk-handler'/`byte-defop-compiler-1' machinery.
515 `(internal--with-suppressed-warnings
516 ',warnings
517 ,(macroexpand-all `(progn ,@body)
518 macroexpand-all-environment))))))
524 "The default macro-environment passed to macroexpand by the compiler. 519 "The default macro-environment passed to macroexpand by the compiler.
525Placing a macro here will cause a macro to have different semantics when 520Placing a macro here will cause a macro to have different semantics when
526expanded by the compiler as when expanded by the interpreter.") 521expanded by the compiler as when expanded by the interpreter.")
@@ -1044,7 +1039,6 @@ we go into emacs-lisp-compilation-mode.")
1044 "Search path for byte-compile error messages. 1039 "Search path for byte-compile error messages.
1045Elements should be directory names, not file names of directories. 1040Elements should be directory names, not file names of directories.
1046The value nil as an element means to try the default directory." 1041The value nil as an element means to try the default directory."
1047 :group 'bytecomp
1048 :version "27.1" 1042 :version "27.1"
1049 :type '(repeat (choice (const :tag "Default" nil) 1043 :type '(repeat (choice (const :tag "Default" nil)
1050 (string :tag "Directory")))) 1044 (string :tag "Directory"))))