[Libreoffice] [PATCH] easy hacks replace DBG_ASSERT with OSL_ASSERT in writer (partially)

Jacek Wolszczak shutdownrunner at gmail.com
Thu Oct 7 10:52:25 PDT 2010


Dnia 2010-10-07, czw o godzinie 11:06 +0100, Caolán McNamara pisze:
> On Wed, 2010-10-06 at 21:23 +0200, Jacek Wolszczak wrote:
> > Hi,
> > 
> > A patch replacing some DBG_ASSERT with OSL_ASSERT in writer folder, with
> > some DE->EN translations. Expect more to come.
> 
> a) Little stray "H" near the end of the patch, so I removed that
> b) OSL_ASSERT takes only one argument, the test condition, and
> DBG_ASSERT takes two, the text condition and some assert text. For those
> two argument ones the member of the OSL_ family that fits as easiest
> replacement is OSL_ENSURE. A quick search and replace of OSL_ASSERT to
> OSL_ENSURE in the patch was sufficient.
> c) Sometimes need to explicitly add #include <osl/diagnose.h> to pull
> the defines in. 

Thanks for advice. I only thought about going through header files after
sending my last email. I considered easy hacks as simple find & replace
thing but it does require some reading.

> Final result then looks good to me, Committed and pushed.
> 
> > Just a side question. If I come across something like:
> > 
> > #if OSL_DEBUG_LEVEL > 1
> >         OSL_ASSERT(aStyles.GetEntryCount() > 0, "Sm : no styles
> > available");
> > #endif
> > 
> > can I replace it with since the OSL family of macros are enabled when
> > you build with debug ( --enable-debug configure option ) : ??
> 
> Remove the "#if OSL_DEBUG_LEVEL > 1" "#endif" lines ?, I'd say leave
> them because there are (potentially) different debugging levels, and the
> above only kicks in at level 2 and above, and not level 1.
> 
> This is the original idea for the different OSL_DEBUG_LEVELs
> http://www.openoffice.org/servlets/ReadMsg?list=interface-discuss&msgNo=330
> 
> In sal/inc/osl/diagnose.h OSL_ASSERT forwards to _OSL_ASSERT, and
> _OSL_ASSERT is enabled when OSL_DEBUG_LEVEL is > 0
> 
> --enable-debug sets the "debug" env variable (in set_soenv) to "true",
> and in solenv/inc/settings.mk you can see where OSL_DEBUG_LEVEL gets
> defined, and it defaults to 0 for normal builds, and defaults to 2 for
> "debugging" (i.e. --enable-debug)
> 
> But there is support for OSL_DEBUG_LEVEL=1 as a half-way house, and the
> above assert is set to not be checked for that OSL_DEBUG_LEVEL=1 level
> (e.g. dmake/build dbglevel=1).
> 
> C.

Just had to be sure whether there might be more debug levels.

Regards,

Jacek




More information about the LibreOffice mailing list