Hi guys,
On Thu, 2010-10-21 at 09:40 +0200, Thomas Klausner wrote:
The attached patch makes compilation for this file work for me. I
still haven't finished a complete build, so I hope it doesn't trip up
somewhere else. Could someone please test it on a complete build?
/* the macro OSL_LOG_PREFIX is intended to be an office internal macro
for now */
-#define OSL_LOG_PREFIX OSL_THIS_FILE ":" OSL_THIS_FUNC ":" OSL_MACRO_VALUE_TO_STRING( __LINE__ )
"; "
+#define OSL_LOG_PREFIX (OSL_THIS_FILE, ":", OSL_THIS_FUNC, ":", OSL_MACRO_VALUE_TO_STRING(
__LINE__ ), "; ")
If this code is actually going to be compiled in a lot of places, there
is probably some benefit to thinking this through carefully - pwrt.
issues of code size.
Also; I can't see this code:
:rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) )
compiling with all those ',' in there - except that of course the comma
operator will be compiled in and we will get it to evaluate only to a ";
" at the end ;-) so this turns into:
#define OSL_LOG_PREFIX " ;"
;-) probably not what we want.
If these things are not string constants that we can concatenate, then
we need to find another compiler built-in that is a string constant that
we can use, I don't see another way here really. Glib has things like
this:
/* Provide a string identifying the current code position */
#if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus)
# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()"
#else
# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
#endif
#if defined (__GNUC__)
# define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L
# define G_STRFUNC ((const char*) (__func__))
#else
# define G_STRFUNC ((const char*) ("???"))
#endif
I imagine we should do something similar, sad as it seems - it looks
like having the pretty function is a problem with modern gcc's.
I would love a patch to adapt to the string constants that we have.
HTH,
Michael.
--
michael.meeks@novell.com <><, Pseudo Engineer, itinerant idiot
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.