Hi Stephan,
Please see my comments inline.
On 05/12/09 17:30, Stephan Bergmann wrote:
On 05/12/09 11:43, [email protected] 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: [email protected]
For additional commands, e-mail: [email protected]