[libvirt] [PATCH 08/10] util: error: Use a more declarative approach in virErrorMsg

Peter Krempa pkrempa at redhat.com
Mon Dec 17 16:56:12 UTC 2018


On Mon, Dec 17, 2018 at 16:06:34 +0000, Daniel Berrange wrote:
> On Thu, Dec 06, 2018 at 11:42:44AM +0000, Daniel P. Berrangé wrote:
> > On Wed, Dec 05, 2018 at 05:47:49PM +0100, Peter Krempa wrote:
> > > Use a macro to declare how the strings for individual error codes. This
> > > unifies the used condition and will allow simplifying the code further.
> > > 
> > > Signed-off-by: Peter Krempa <pkrempa at redhat.com>

[...]

> >  #define MSG(msg, suffix) \
> >       msg, msg # suffix
> > 
> >   { VIR_ERR_NO_SUPPORT,
> >     MSG("this function is not supported by the connection driver", ": %s") },
> > 
> > Then, only a handful will need separate entries
> 
> I've unfortunately just realized this was an absolutely terrible
> suggestion of mine. We cannot use CPP string concatenation here
> as it breaks xgettext's ability to discover translatable strings.
> IOW we just lost all our error messages from the translations :-(
> 
> I've posted a patch that puts it back to roughly what you have in
> this v1 patch.

I was actually wondering whether gettext collects them after macro
processing or not, but it's very hard to google the answer so I gave up.

Actually after macro-processing it would possibly miss some as some
parts of the code could be disabled.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20181217/cf0e40f1/attachment-0001.sig>


More information about the libvir-list mailing list