Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1746)

Unified Diff: lily/lyric-combine-music-iterator.cc

Issue 349740043: Issue 5366: Move warnings out of find/create context functions (Closed)
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lily/include/context.hh ('k') | lily/quote-iterator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lily/lyric-combine-music-iterator.cc
diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc
index 336b167f2e98cdf2d4179b687330d1913b6d21b9..cd874f8e02e98f8c0a715a1bc8873b746f397127 100644
--- a/lily/lyric-combine-music-iterator.cc
+++ b/lily/lyric-combine-music-iterator.cc
@@ -330,19 +330,23 @@ Lyric_combine_music_iterator::process (Moment /* when */)
void
Lyric_combine_music_iterator::do_quit ()
{
- if (!music_found_)
+ /* Don't print a warning for empty lyrics (in which case we don't try
+ to find the proper voice, so it will not be found) */
+ if (lyrics_found_ && !music_found_)
{
- SCM voice_name = get_music ()->get_property ("associated-context");
- SCM voice_type = get_music ()->get_property ("associated-context-type");
- string name, type;
- if (scm_is_string (voice_name))
- name = ly_scm2string (voice_name);
- type = robust_symbol2string (voice_type, "Voice");
- /* Don't print a warning for empty lyrics (in which case we don't try
- to find the proper voice, so it will not be found) */
- if (lyrics_found_)
- get_music ()->origin ()->warning (_f ("cannot find %s `%s'",
- type.c_str (), name.c_str ()) + "\n");
+ Music *m = get_music ();
+
+ // ugh: defaults are repeated elsewhere
+ SCM voice_type = m->get_property ("associated-context-type");
+ if (!scm_is_symbol (voice_type))
+ voice_type = ly_symbol2scm ("Voice");
+
+ string id = robust_scm2string (m->get_property ("associated-context"),
+ "");
+
+ Input *origin = m->origin ();
+ origin->warning (_f ("cannot find context: %s",
+ Context::diagnostic_id (voice_type, id).c_str ()));
}
if (lyric_iter_)
« no previous file with comments | « lily/include/context.hh ('k') | lily/quote-iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b