From 531042cb79ca69ad0599c77da9e5bfe4edbbde05 Mon Sep 17 00:00:00 2001 From: Patrick McCarty Date: Tue, 7 Jul 2009 11:31:06 -0700 Subject: [PATCH] Make -dwarning-as-error more general * 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 | 9 ++++++++- lily/input.cc | 14 +++++++++++--- scm/backend-library.scm | 4 +--- scm/lily.scm | 9 +++++++-- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/lily/grob.cc b/lily/grob.cc index a3f41a856d..cb6948e32c 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -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); } diff --git a/lily/input.cc b/lily/input.cc index 084b1f3b64..f2ddedd4e8 100644 --- a/lily/input.cc +++ b/lily/input.cc @@ -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 diff --git a/scm/backend-library.scm b/scm/backend-library.scm index 40f2030300..a985cbb487 100644 --- a/scm/backend-library.scm +++ b/scm/backend-library.scm @@ -193,9 +193,7 @@ (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) diff --git a/scm/lily.scm b/scm/lily.scm index c8f99d6737..9420744d64 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -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) -- 2.39.5