[dev] debug macros in tools and trailing ";"

2008-08-29 Thread Caolán McNamara
If we look at the debug macros in tools, e.g.

#ifdef DBG_UTIL

#define DBG_ASSERT( sCon, aError )  \
if ( DbgIsAssert() )\
{   \
if ( !( sCon ) )\
{   \
DbgError( aError,   \
  __FILE__, __LINE__ ); \
}   \
}

#else

#define DBG_ASSERT( sCon, aError )

#endif

It's clear that the original intent was that they were to be used
without any trailing ";"

e.g. 

DBG_ASSERT (something)
not
DBG_ASSERT (something);

but the OSL set of assert *is* intended to be followed with a trailing ;

e.g.

#define OSL_ASSERT(c)   _OSL_ASSERT(c, OSL_THIS_FILE, __LINE__)
#if OSL_DEBUG_LEVEL > 0

#define _OSL_ASSERT(c, f, l) \
do \
{  \
if (!(c) && _OSL_GLOBAL osl_assertFailedLine(f, l, 0)) \
_OSL_GLOBAL osl_breakDebug(); \
} while (0)

#else

#define _OSL_ASSERT(c, f, l)((void)0)

#endif

Needless to say there's a mix of usages in OOo of the DBG_ASSERT and
friends, with a trailing ";" the most commonplace, giving us loads of
bare ";" about the place which gives the "empty body in an else
statement" etc. warnings.

Do we want to fix this, or ignore it entirely :-). If it gets fixed,
which do we want, change the DBG_ set of macros to follow what people
are generally doing with them, i.e. make them expect a trailing ";", or
fix the usages to remove the ";". 

C.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [dev] debug macros in tools and trailing ";"

2008-08-29 Thread Thorsten Behrens
On Fri, Aug 29, 2008 at 04:17:09PM +0100, Caolán McNamara wrote:
> Do we want to fix this, or ignore it entirely :-). If it gets fixed,
> which do we want, change the DBG_ set of macros to follow what people
> are generally doing with them, i.e. make them expect a trailing ";", or
> fix the usages to remove the ";". 
> 
Hi Caolan,

personally, I'd change all DBG_* usage to OSL_*, but I admit that's
huge. Failing that, I'd make the DBG_ macros follow the OSL_ way. 

Cheers,

-- Thorsten

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [dev] debug macros in tools and trailing ";"

2008-08-29 Thread Frank Schönheit - Sun Microsystems Germany
Hi Caolán,

> Do we want to fix this, or ignore it entirely :-). If it gets fixed,
> which do we want, change the DBG_ set of macros to follow what people
> are generally doing with them, i.e. make them expect a trailing ";", or
> fix the usages to remove the ";". 

make them expect a trailing ";". Everything else is prone to future
breakage for all those people not working on a platform where the
compiler issues the warning.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer [EMAIL PROTECTED] -
- Sun Microsystems  http://www.sun.com/staroffice -
- OpenOffice.org Base   http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [dev] debug macros in tools and trailing ";"

2008-09-01 Thread Juergen Schmidt

Thorsten Behrens wrote:

On Fri, Aug 29, 2008 at 04:17:09PM +0100, Caolán McNamara wrote:

Do we want to fix this, or ignore it entirely :-). If it gets fixed,
which do we want, change the DBG_ set of macros to follow what people
are generally doing with them, i.e. make them expect a trailing ";", or
fix the usages to remove the ";". 


Hi Caolan,

personally, I'd change all DBG_* usage to OSL_*, but I admit that's
huge. Failing that, I'd make the DBG_ macros follow the OSL_ way. 
that would be nice, using the same macros everywhere and have only one 
set of macros.


Anyway i would at least making the macros to expect a trailing ";". It 
seems that people naturally use it this way.


Juergen



Cheers,

-- Thorsten

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]