[Libreoffice] Move DBG_ERROR[1-9] to OSL_TRACE

David Tardon dtardon at redhat.com
Mon Mar 21 01:07:08 PDT 2011


On Fri, Mar 18, 2011 at 08:53:36PM +0100, Thomas Arnhold wrote:
> Hi,
> 
> some days ago I converted all DBG_ERROR[1-9], which had a printf like
> format string, to OSL_TRACE. David Tardon pointed me out that this
> slightly changed the behavior, because the according OSL variant of
> DBG_ERROR is OSL_FAIL (which is _OSL_ENSURE), which therefore breaks the
> debug if OSL_FAIL got called.

This is not exactly true: OSL_FAIL expands to (simplified)

if (osl_assertFailedLine())
    osl_breakDebug();

The return value of osl_assertFailedLine is always true on OS/2, always
false on Unix and variable on Windows (see sal/osl/*/diagnose.c). So
what happens when an assertion is encountered depends on which platform
the code runs on.

On the other side, the behaviour of the old DBG_ assertions is
configurable by user: it may show a msg box, abort, start a debugger...
(presumably not every one of the options works on all platforms).
Default is to show a msg box.

> OSL_TRACE doesn't, it only prints a
> message about this.

As shown above, OSL_FAIL may "only print a message" too. But my argument
was against changing an assertion to a trace, because, at least to me,
assertion means "there is a problem", but trace is "just a debugging
stuff, to be ignored".

D.


More information about the LibreOffice mailing list