lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

logging an optional input location


From: Dan Eble
Subject: logging an optional input location
Date: Sat, 12 May 2018 15:48:58 -0400

There’s this repetition in context.cc:

  if (origin)
    {
      origin->warning (_f ("cannot find or create `%s' called `%s'",
                           ly_symbol2string (n).c_str (), id));
    }
  else
    {
      warning (_f ("cannot find or create `%s' called `%s'",
                   ly_symbol2string (n).c_str (), id));
    }

I put up with this when it was just one instance, but it’s starting to multiply 
in my work in progress.

I see that ::warning already accepts a location string as an optional second 
parameter, so I am thinking of using that rather than creating yet another 
interface.  I am thinking of defining a helper function message_location(const 
Input*) to be used like this:

  warning (_f (. . .), message_location (origin));

Are there any strong objections to this?  If so, what would you prefer?
— 
Dan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]