* Makefile.in (lick-fail-on-warning): New rule to compile with warnings
authorDavid Engster <dengste@eml.cc>
Wed, 6 Apr 2011 15:52:53 +0000 (17:52 +0200)
committerDavid Engster <dengste@eml.cc>
Wed, 6 Apr 2011 15:52:53 +0000 (17:52 +0200)
as errors.
(fail-on-warning): Use it.

* lisp/Makefile.in (fail-on-warning): New rule to compile with warnings as
errors.

* dgnushack.el (dgnushack-compile-error-on-warn): New function to call
dgnushack-compile with error-on-warn enabled, and to signal an error if
clean compilation failed.
(dgnushack-compile): New argument 'error-on-warn'.  If non-nil, compile
with `byte-compile-error-on-warn'.  Return nil if errors occured.

ChangeLog
Makefile.in
lisp/ChangeLog
lisp/Makefile.in
lisp/dgnushack.el

index 15bedb2..a0ac18a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-04-06  David Engster  <dengste@eml.cc>
+
+       * Makefile.in (lick-fail-on-warning): New rule to compile with warnings
+       as errors.
+       (fail-on-warning): Use it.
+
 2011-03-17  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * Makefile.in (warn): Add a dummy "warn" target.
index 83d7bfb..b0d335a 100644 (file)
@@ -44,11 +44,14 @@ COMMIT_STRING = $(CODENAME)Gnus v$(VERSION) is released.
 
 all: lick info
 
-fail-on-warning: all
+fail-on-warning: lick-fail-on-warning info
 
 lick:
        cd lisp && $(MAKE) EMACS="$(EMACS)" lispdir="$(lispdir)" all
 
+lick-fail-on-warning:
+       cd lisp && $(MAKE) EMACS="$(EMACS)" lispdir="$(lispdir)" fail-on-warning
+
 install:
        cd lisp && $(MAKE) EMACS="$(EMACS)" lispdir="$(lispdir)" install
        cd texi && $(MAKE) EMACS="$(EMACS)" install
index c6566df..480969b 100644 (file)
@@ -1,3 +1,14 @@
+2011-04-06  David Engster  <dengste@eml.cc>
+
+       * Makefile.in (fail-on-warning): New rule to compile with warnings as
+       errors.
+
+       * dgnushack.el (dgnushack-compile-error-on-warn): New function to call
+       dgnushack-compile with error-on-warn enabled, and to signal an error if
+       clean compilation failed.
+       (dgnushack-compile): New argument 'error-on-warn'.  If non-nil, compile
+       with `byte-compile-error-on-warn'.  Return nil if errors occured.
+
 2011-04-06  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * gnus-registry.el: Don't use ERT if it's not available.  Load it
index 97b5cc2..3d6f7f5 100644 (file)
@@ -25,6 +25,9 @@ clean-some:
 warn: clean-some gnus-load.el
        $(EMACS_COMP) --eval '(dgnushack-compile t)' 2>&1 | egrep -v "variable G|inhibit-point-motion-hooks|coding-system|temp-results|variable gnus|variable nn|scroll-in-place|deactivate-mark|filladapt-mode|byte-code-function-p|print-quoted|ps-right-header|ps-left-header|article-inhibit|print-escape|ssl-program-arguments|message-log-max"
 
+fail-on-warning: clean-some gnus-load.el
+       $(EMACS_COMP) -f dgnushack-compile-error-on-warn
+
 # The "clever" rule is unsafe, since redefined macros are loaded from
 # .elc files, and not the .el file.
 clever some l: gnus-load.el
index d758100..ee14ff2 100644 (file)
@@ -272,12 +272,19 @@ dgnushack-compile-verbosely.  All other users should continue to use
 dgnushack-compile."
   (dgnushack-compile t))
 
-(defun dgnushack-compile (&optional warn)
+(defun dgnushack-compile-error-on-warn ()
+  "Call dgnushack-compile with minimal warnings, but with error-on-warn ENABLED.
+This means that every warning will be reported as an error."
+  (unless (dgnushack-compile nil t)
+    (error "Error during byte compilation (warnings were reported as errors!).")))
+
+(defun dgnushack-compile (&optional warn error-on-warn)
   ;;(setq byte-compile-dynamic t)
   (unless warn
     (setq byte-compile-warnings
          '(free-vars unresolved callargs redefine suspicious)))
   (let ((files (directory-files srcdir nil "^[^=].*\\.el$"))
+       (compilesuccess t)
        ;;(byte-compile-generate-call-tree t)
        file elc)
     ;; Avoid barfing (from gnus-xmas) because the etc directory is not yet
@@ -330,8 +337,14 @@ dgnushack-compile."
       (when (or (not (file-exists-p
                      (setq elc (concat (file-name-nondirectory file) "c"))))
                (file-newer-than-file-p file elc))
-       (ignore-errors
-         (byte-compile-file file))))))
+       (if error-on-warn
+           (let ((byte-compile-error-on-warn t))
+             (unless (ignore-errors
+                       (byte-compile-file file))
+               (setq compilesuccess nil)))
+         (ignore-errors
+           (byte-compile-file file)))))
+    compilesuccess))
 
 (defun dgnushack-recompile ()
   (require 'gnus)