Re: [allsvn] r271808 - cws/fwk103/sal/inc/osl

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [allsvn] r271808 - cws/fwk103/sal/inc/osl

stephan.bergmann
On 05/12/09 11:43, [hidden email] wrote:

> Author: mav
> Date: Tue May 12 09:39:38 2009
> New Revision: 271808
>
> Log:
> #i101356# allow to generate a small log if a document can not be stored
>
> Modified:
>    cws/fwk103/sal/inc/osl/diagnose.h
>
> Modified: cws/fwk103/sal/inc/osl/diagnose.h
> ==============================================================================
> --- cws/fwk103/sal/inc/osl/diagnose.h Tue May 12 09:38:00 2009 (r271807)
> +++ cws/fwk103/sal/inc/osl/diagnose.h Tue May 12 09:39:38 2009 (r271808)
> @@ -80,6 +80,23 @@
>  
>  #define OSL_THIS_FILE       __FILE__
>  
> +#ifdef __func__
> +#define OSL_THIS_FUNC __func__
> +#elifdef __PRETTY_FUNCTION__
> +#define OSL_THIS_FUNC __PRETTY_FUNCTION__
> +#elifdef __FUNCTION__
> +#define OSL_THIS_FUNC __FUNCTION__
> +#else
> +#define OSL_THIS_FUNC " "
> +#endif
> +
> +#define OSL_TO_STRING( x ) #x
> +#define OSL_MACRO_VALUE_TO_STRING( x ) OSL_TO_STRING( x )
> +#define OSL_STRING_LINE OSL_MACRO_VALUE_TO_STRING( __LINE__ )
> +
> +#define OSL_LOG_PREFIX OSL_THIS_FILE ":" OSL_THIS_FUNC ":" OSL_STRING_LINE
> +#define OSL_LOG_CONSTSTRING( m ) OSL_LOG_PREFIX "; " m

It should be document which of those new macros are part of the stable
URE interface (including @since tags) and which are private.

This is especially true for OSL_TO_STRING and OSL_MACRO_VALUE_TO_STRING,
which are useful in various places, but if added to the stable URE
interface should probably go into a more general header than osl/diagnose.h.

 From the "crusade to eliminate every excess macro" camp point of view:
  1 The use of OSL_STRING_LINE could be inlined in OSL_LOG_PREFIX, and
OSL_STRING_LINE dropped.  2 Would it work to move the "; " from
OSL_LOG_CONSTSTRING to OSL_LOG_PREFIX, and drop OSL_LOG_CONSTSTRING?

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [allsvn] r271808 - cws/fwk103/sal/inc/osl

Mikhail Voytenko
Hi Stephan,

Please see my comments inline.

On 05/12/09 17:30, Stephan Bergmann wrote:

> On 05/12/09 11:43, [hidden email] wrote:
>> Author: mav
>> Date: Tue May 12 09:39:38 2009
>> New Revision: 271808
>>
>> Log:
>> #i101356# allow to generate a small log if a document can not be stored
>>
>> Modified:
>>    cws/fwk103/sal/inc/osl/diagnose.h
>>
>> Modified: cws/fwk103/sal/inc/osl/diagnose.h
>> ==============================================================================
>>
>> --- cws/fwk103/sal/inc/osl/diagnose.h    Tue May 12 09:38:00 2009    
>> (r271807)
>> +++ cws/fwk103/sal/inc/osl/diagnose.h    Tue May 12 09:39:38 2009    
>> (r271808)
>> @@ -80,6 +80,23 @@
>>  
>>  #define OSL_THIS_FILE       __FILE__
>>  
>> +#ifdef __func__
>> +#define OSL_THIS_FUNC __func__
>> +#elifdef __PRETTY_FUNCTION__
>> +#define OSL_THIS_FUNC __PRETTY_FUNCTION__
>> +#elifdef __FUNCTION__
>> +#define OSL_THIS_FUNC __FUNCTION__
>> +#else
>> +#define OSL_THIS_FUNC " "
>> +#endif
>> +
>> +#define OSL_TO_STRING( x ) #x
>> +#define OSL_MACRO_VALUE_TO_STRING( x ) OSL_TO_STRING( x )
>> +#define OSL_STRING_LINE OSL_MACRO_VALUE_TO_STRING( __LINE__ )
>> +
>> +#define OSL_LOG_PREFIX OSL_THIS_FILE ":" OSL_THIS_FUNC ":"
>> OSL_STRING_LINE
>> +#define OSL_LOG_CONSTSTRING( m ) OSL_LOG_PREFIX "; " m
>
> It should be document which of those new macros are part of the stable
> URE interface (including @since tags) and which are private.
>
> This is especially true for OSL_TO_STRING and
> OSL_MACRO_VALUE_TO_STRING, which are useful in various places, but if
> added to the stable URE interface should probably go into a more
> general header than osl/diagnose.h.
I will move the mentioned two macros to sal/macros.h ( with using SAL_
prefix ) then and document all the new macros with @since tag.

I must confess, I am not familiar with URE interface handling process,
how can I declare a macro private? I see no similar declaration for
other macros.

>
>
> From the "crusade to eliminate every excess macro" camp point of view:
>  1 The use of OSL_STRING_LINE could be inlined in OSL_LOG_PREFIX, and
> OSL_STRING_LINE dropped.
Yes, you are right, OSL_MACRO_VALUE_TO_STRING is probably enough. I
shall change it.

> 2 Would it work to move the "; " from OSL_LOG_CONSTSTRING to
> OSL_LOG_PREFIX, and drop OSL_LOG_CONSTSTRING?
The pattern 'OSL_LOG_PREFIX "Message"' looked not so readable for me
than 'OSL_LOG_CONSTSTRING( "Message" )'.
The last one looks very similar to the very common one
RTL_CONSTASCII_USTRINGPARAM().

But from other side, it could be treated as excess macro and if somebody
needs it we can add it later. I shall remove it as well.

Thanks,
Mikhail.
>
> -Stephan



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Re: [allsvn] r271808 - cws/fwk103/sal/inc/osl

Mikhail Voytenko
Hi,

On 05/13/09 10:34, Mikhail Voytenko wrote:

>>
>> It should be document which of those new macros are part of the
>> stable URE interface (including @since tags) and which are private.
>>
>> This is especially true for OSL_TO_STRING and
>> OSL_MACRO_VALUE_TO_STRING, which are useful in various places, but if
>> added to the stable URE interface should probably go into a more
>> general header than osl/diagnose.h.
> I will move the mentioned two macros to sal/macros.h ( with using SAL_
> prefix ) then and document all the new macros with @since tag.
>
> I must confess, I am not familiar with URE interface handling process,
> how can I declare a macro private? I see no similar declaration for
> other macros.
As we have discussed per phone, I will declare all the new macros as
private for now, since they are intended to be used in the office only.
The move of the macros is also not necessary in this case.

If there will be a necessity to publish the macros in future we still
can do it.

Best regards,
Mikhail.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Re: [allsvn] r271808 - cws/fwk103/sal/inc/osl

frank.schoenheit
Hi Mikhail,

>> I must confess, I am not familiar with URE interface handling process,
>> how can I declare a macro private? I see no similar declaration for
>> other macros.
> As we have discussed per phone, I will declare all the new macros as
> private

Hey, if you ask such interesting questions in public, please also put
the answer here :)
How is a macro declared as private?

Ciao
Frank

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Re: [allsvn] r271808 - cws/fwk103/sal/inc/osl

stephan.bergmann
On 05/13/09 12:13, Frank Schönheit - Sun Microsystems Germany wrote:
> How is a macro declared as private?

By documenting it so.  ;)  (Preferably with a plain C/C++ comment, not a
autodoc-style one, so that it does not show up in the autodoc-generated
documentation at all.)

-Stephan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]