unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Make byte-compile-error-on-warn a safe variable for file compilation
@ 2018-01-04  9:40 Robert Cochran
  2018-01-04 13:22 ` Noam Postavsky
  0 siblings, 1 reply; 22+ messages in thread
From: Robert Cochran @ 2018-01-04  9:40 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1578 bytes --]

Greetings emacs-devel,

Attached is a patch that adds the variable `byte-compile-error-on-warn'
to the safe variable list temporarily during calls to
`byte-compile-file`, so that individual files can easily and simply
include "byte-compile-error-on-warn: t" in their file local variables.

This allows programmers to be able to ensure thoroughly that there are
no warnings in their code, which theoretically leads to better
correctness.

It is my eventual hope that this is accepted so that
`byte-compile-error-on-warn' can be enable on files in the core Emacs
Git repository, extending the aforementioned correctness potential to
files in the core.

For example, something that is bothering me right now
is that there are quite a few 'foo is obsolete' warnings during the byte
compilation portion of the build phase. Enabling error on warning means
that trying to byte compile files that reference stale
functions/variables/what have you will fail, prompting patches that
obsolete Lisp objects to also fix usage of it in the core with the
appropriate recommended replacement.

I ran the full test suite (`make check-expensive`), and got the same
results pre- and post-patch. Unless there are already files that have
`byte-compile-error-on-warn' set in their local variables (which
wouldn't have worked prior to this), nothing should have suddenly
broken as a result of this patch.

Suggestions, comments, concerns, and all those other things are welcomed
and requested.

Thanks,
-- 
~Robert Cochran

GPG Fingerprint - BD0C 5F8B 381C 64F0 F3CE  E7B9 EC9A 872C 41B2 77C2

-----


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to make byte-compile-error-on-warn a safe file local variable --]
[-- Type: text/x-patch, Size: 1549 bytes --]

From d36eccbc8fe6c1737c02a11dce1d845b3e3e5211 Mon Sep 17 00:00:00 2001
From: Robert Cochran <robert-git@cochranmail.com>
Date: Thu, 4 Jan 2018 01:09:50 -0800
Subject: [PATCH] Make byte-compile-error-on-warn a safe variable for file
 compilation

This allows individual files to easily specify whether or not byte
compilation should error on encountering warnings, ala -Werror from
GCC.

* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Make
  `byte-compiler-error-on-warn' a safe local variable for file
  compliation.
---
 lisp/emacs-lisp/bytecomp.el | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 2f5f9f8c05..3c43ab21a5 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1874,6 +1874,11 @@ byte-compile-file
       ;; If they change the file name, then change it for the output also.
       (let ((buffer-file-name filename)
             (dmm (default-value 'major-mode))
+            ;; Ensure that byte-compile-error-on-warn is recognized as
+            ;; safe, even if it's not in safe-local-variable-values.
+            (safe-local-variable-values (append (list '(byte-compile-error-on-warn . t)
+                                                      '(byte-compile-error-on-warn . nil))
+                                                safe-local-variable-values))
             ;; Ignore unsafe local variables.
             ;; We only care about a few of them for our purposes.
             (enable-local-variables :safe)
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2018-02-16 15:53 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-04  9:40 [PATCH] Make byte-compile-error-on-warn a safe variable for file compilation Robert Cochran
2018-01-04 13:22 ` Noam Postavsky
2018-01-05  3:51   ` Stefan Monnier
2018-01-05  6:17   ` Robert Cochran
2018-01-05 12:05     ` Noam Postavsky
2018-01-06 22:42       ` Robert Cochran
2018-01-08 12:25         ` Noam Postavsky
2018-01-08 18:50           ` Eli Zaretskii
2018-01-09  3:42           ` Robert Cochran
2018-01-09 13:24             ` Stefan Monnier
2018-01-10  6:28               ` Robert Cochran
2018-01-10 15:26                 ` Eli Zaretskii
2018-01-10 15:57                   ` Noam Postavsky
2018-01-10 16:17                     ` Eli Zaretskii
2018-01-10 16:29                       ` Noam Postavsky
2018-01-10 19:36                         ` Eli Zaretskii
2018-01-10 19:44                           ` Noam Postavsky
2018-01-10 20:22                             ` Eli Zaretskii
2018-02-12  8:21                               ` Robert Cochran
2018-02-12 17:57                                 ` Eli Zaretskii
2018-02-13  4:49                                   ` Robert Cochran
     [not found]                                   ` <87tvulmrkd.fsf@cochranmail.com>
2018-02-16 15:53                                     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).