[Libreoffice] ucb/source/ucb compilation error

Michael Meeks michael.meeks at novell.com
Thu Oct 21 02:12:24 PDT 2010


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 at novell.com  <><, Pseudo Engineer, itinerant idiot




More information about the LibreOffice mailing list