]> git.donarmstrong.com Git - lilypond.git/commitdiff
Make -dwarning-as-error more general
authorPatrick McCarty <pnorcks@gmail.com>
Tue, 7 Jul 2009 18:31:06 +0000 (11:31 -0700)
committerPatrick McCarty <pnorcks@gmail.com>
Thu, 16 Jul 2009 06:20:48 +0000 (23:20 -0700)
* The following calls now issue errors
  with the option -dwarning-as-error:

  Grob::warning ()
  Grob::programming_error ()
  Input::warning ()
  Input::programming_error ()

  ly:warning
  ly:programming-error

lily/grob.cc
lily/input.cc
scm/backend-library.scm
scm/lily.scm

index a3f41a856d3a6c90a01bfb8e8dfd11354b24b3bc..cb6948e32c54c044609396936ad6242fe2b9463b 100644 (file)
@@ -19,6 +19,7 @@
 #include "music.hh"
 #include "output-def.hh"
 #include "pointer-group-interface.hh"
+#include "program-option.hh"
 #include "stencil.hh"
 #include "stream-event.hh"
 #include "system.hh"
@@ -533,6 +534,9 @@ Grob::fixup_refpoint ()
 void
 Grob::warning (string s) const
 {
+  if (get_program_option ("warning-as-error"))
+    error (s);
+
   SCM cause = self_scm ();
   while (Grob *g = unsmob_grob (cause))
     cause = g->get_property ("cause");
@@ -559,6 +563,9 @@ Grob::name () const
 void
 Grob::programming_error (string s) const
 {
+  if (get_program_option ("warning-as-error"))
+    error (s);
+
   SCM cause = self_scm ();
   while (Grob *g = unsmob_grob (cause))
     cause = g->get_property ("cause");
@@ -569,7 +576,7 @@ Grob::programming_error (string s) const
   if (Music *m = unsmob_music (cause))
     m->origin ()->message (s);
   else if (Stream_event *ev = unsmob_stream_event (cause))
-    ev->origin ()->warning (s);
+    ev->origin ()->message (s);
   else
     ::message (s);
 }
index 084b1f3b643dd4ff9d2802bd3219929f49bcb25a..f2ddedd4e8b619e61e45c933f8a8c25aa8170445 100644 (file)
@@ -12,6 +12,7 @@
 using namespace std;
 
 #include "international.hh"
+#include "program-option.hh"
 #include "source-file.hh"
 #include "sources.hh"
 #include "warn.hh"
@@ -79,15 +80,22 @@ Input::message (string s) const
 void
 Input::programming_error (string s) const
 {
-  message (_f ("programming error: %s", s.c_str ()));
-  message (_ ("continuing, cross fingers") + "\n");
+  if (get_program_option ("warning-as-error"))
+    ::error (s);
+  else {
+    message (_f ("programming error: %s", s.c_str ()));
+    message (_ ("continuing, cross fingers") + "\n");
+  }
 }
 
 
 void
 Input::warning (string s) const
 {
-  message (_f ("warning: %s", s));
+  if (get_program_option ("warning-as-error"))
+    ::error (s);
+  else
+    message (_f ("warning: %s", s));
 }
 
 void
index 40f20303007a3907db4ddaa2d022eff61e72fba0..a985cbb4874738c6cb84b818ff435ce2ef72ea0c 100644 (file)
 (define-public (backend-testing output-module)
   (define (missing-stencil-expression name)
     (begin
-      (apply
-       (if (ly:get-option 'warning-as-error) ly:error ly:warning)
-       (list (_ "missing stencil expression `~S'") name))
+      (ly:warning (_ "missing stencil expression `~S'") name)
       ""))
 
   (map (lambda (x)
index c8f99d6737a31b9271943190c046366749b4040e..9420744d64d34b68c0191911c8e8ea78e5d270d4 100644 (file)
@@ -153,8 +153,8 @@ second.  Dump results to `FILE.stacks' and
     (verbose ,(ly:command-line-verbose?)
 "Value of the --verbose flag (read-only).")
     (warning-as-error #f
-"Exit if an undefined stencil expression is
-found.")
+"Change all warning and programming_error
+messages into errors.")
     ))
 
 ;; Need to do this in the beginning.  Other parts of the Scheme
@@ -229,6 +229,11 @@ found.")
 (if (ly:get-option 'trace-scheme-coverage)
     (coverage:enable))
 
+(if (ly:get-option 'warning-as-error)
+    (begin
+      (set! ly:warning ly:error)
+      (set! ly:programming-error ly:error)))
+
 (define-public parser #f)