[Libreoffice] ucb/source/ucb compilation error

Miklos Vajna vmiklos at frugalware.org
Wed Nov 24 07:08:03 PST 2010


Hi,

I would like to revisit this topic.

So far what we have is:

- our change:
  http://cgit.freedesktop.org/libreoffice/ure/commit/?id=311cae41f2f94f00f4a417ad2ac9f07e1ce37ea7
- OOo change:
  http://hg.services.openoffice.org/cws/sb132/rev/c3a67e297108

Both are just removing the __PRETTY_FUNCTION__ / etc expressions, which
is not that good, I think.

IMHO there are two issues here:

1) Need to use different exrepssions based on compiler. This is what
boost/current_function.hpp does, but it's C++ and diagnose.h is used in
C code as well. Given that the code is not that long, I just copied it
from there.

2) In case the compiler is recognized, OSL_THIS_FUNC won't be be
resolved to a string value, so "foo" OSL_THIS_FUNC "bar" won't work.
Given that right now the OSL_LOG_PREFIX just contains a " " instead of
the function name, I removed OSL_THIS_FUNC from there.

The attached patch tries to solve both problems, and of course
build-tested.

Does it look sane - may i push it?

Thanks.
-------------- next part --------------
From 701049efc7110cc69e78d9177028596956a5999a Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos at frugalware.org>
Date: Wed, 24 Nov 2010 12:28:07 +0100
Subject: [PATCH] OSL_THIS_FUNC: use logic from boot/current_function.hpp

Don't use it directly, as OSL_THIS_FUNC is used in C-only sources as
well. Also, remove OSL_THIS_FUNC from OSL_LOG_PREFIX as concatenation
does not work non-macros like __PRETTY_FUNCTION__. (The code actually
worked there only because it was defined to be " ", so we are not
removing any valuable information.)
---
 sal/inc/osl/diagnose.h |   26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/sal/inc/osl/diagnose.h b/sal/inc/osl/diagnose.h
index 59f921c..c65ff6a 100644
--- a/sal/inc/osl/diagnose.h
+++ b/sal/inc/osl/diagnose.h
@@ -79,21 +79,23 @@ pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc( pf
 #define OSL_THIS_FILE       __FILE__
 
 /* the macro OSL_THIS_FUNC is intended to be an office internal macro for now */
-/* as documented in http://www.openoffice.org/issues/show_bug.cgi?id=114290 ,
-   this cannot work, so disable it for now */
-#if 1
-#define OSL_THIS_FUNC " "
-#else
-#ifdef __func__
-#define OSL_THIS_FUNC __func__
-#elif defined (__PRETTY_FUNCTION__)
+/* copied from boost/current_function.hpp to make it usable from C
+ * sources as well */
+#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600))
 #define OSL_THIS_FUNC __PRETTY_FUNCTION__
-#elif defined (__FUNCTION__)
+#elif defined(__DMC__) && (__DMC__ >= 0x810)
+#define OSL_THIS_FUNC __PRETTY_FUNCTION__
+#elif defined(__FUNCSIG__)
+#define OSL_THIS_FUNC __FUNCSIG__
+#elif (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 600)) || (defined(__IBMCPP__) && (__IBMCPP__ >= 500))
 #define OSL_THIS_FUNC __FUNCTION__
+#elif defined(__BORLANDC__) && (__BORLANDC__ >= 0x550)
+#define OSL_THIS_FUNC __FUNC__
+#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
+#define OSL_THIS_FUNC __func__
 #else
-#define OSL_THIS_FUNC " "
+#define OSL_THIS_FUNC "(unknown)"
 #endif
-#endif /* 1 */
 
 /* the macro OSL_TO_STRING is intended to be an office internal macro for now */
 #define OSL_TO_STRING( x ) #x
@@ -102,7 +104,7 @@ pfunc_osl_printDetailedDebugMessage SAL_CALL osl_setDetailedDebugMessageFunc( pf
 #define OSL_MACRO_VALUE_TO_STRING( x ) OSL_TO_STRING( x )
 
 /* 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_MACRO_VALUE_TO_STRING( __LINE__ ) "; "
 
 #define OSL_DEBUG_ONLY(s)	_OSL_DEBUG_ONLY(s)
 #define OSL_TRACE           _OSL_TRACE
-- 
1.7.3.2

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101124/9f50aec9/attachment-0001.pgp>


More information about the LibreOffice mailing list