[Libreoffice] ucb/source/ucb compilation error
wiz at NetBSD.org
Thu Oct 21 05:17:37 PDT 2010
On Thu, Oct 21, 2010 at 10:12:24AM +0100, Michael Meeks wrote:
> /* 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.
Why do you think this affects 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.
At least that last definitely won't happen, since I added parentheses
around the whole right hand side of the macro. And the code did
compile for me, but since there probably are other compilers used on
this code, I asked for more testing :)
> 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
> /* Provide a string identifying the current code position */
> #if defined(__GNUC__) && (__GNUC__ < 3) && !defined(__cplusplus)
> # define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()"
> # define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
I don't imagine we're much interested in gcc2 nowadays, so this really
# define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__)
> #if defined (__GNUC__)
> # define G_STRFUNC ((const char*) (__PRETTY_FUNCTION__))
> #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L
> # define G_STRFUNC ((const char*) (__func__))
> # define G_STRFUNC ((const char*) ("???"))
That's perhaps a good replacement for the issue Tor mentioned in his
email on this subject. It should have a case for _MSC_VER though.
More information about the LibreOffice