[Libreoffice] ucb/source/ucb compilation error
Thomas Klausner
wiz at NetBSD.org
Thu Oct 21 08:16:32 PDT 2010
On Thu, Oct 21, 2010 at 04:08:16AM -0600, Tor Lillqvist wrote:
> By the way, note that the OSL_THIS_FUNC currently is quite broken. (Unless somebody has fixed it recently in the LibreOffice repo.) See http://www.openoffice.org/issues/show_bug.cgi?id=114290 , fixing it is trivialish (an EasyHack?, yeah, I need to add it there).
My problem really is related to this macro.
For some reason, my preprocessor thinks __PRETTY_FUNCTION__ is defined
and I end up with the error in this thread.
For Caolan (and I guess most everyone else), OSL_THIS_FUNC is just
expanded to " " and this problem doesn't appear.
I've prepared a patch like you suggest in the bug report in the hope
that this will make my problem more visible for everyone :)
The attached patch changes my error message in
ucb/source/ucp/file/prov.cxx to:
Compiling: ucb/source/ucp/file/prov.cxx
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx: In member function 'virtual com::sun::star::uno::Reference<com::sun::star::ucb::XContent> fileaccess::FileProvider::queryContent(const com::sun::star::uno::Reference<com::sun::star::ucb::XContentIdentifier>&)':
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: expected primary-expression before '(' token
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: expected primary-expression before '(' token
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: expected primary-expression before ')' token
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: '"..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:"' cannot be used as a function
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: expected `)' before string constant
..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: expected `)' before ';' token
(same error in lines 533 and 615)
g++ -E gives me for line 342:
throw IllegalIdentifierException( ::rtl::OUString( "..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx" ":" ((const char*) (__PRETTY_FUNCTION__)) ":" "342" "; ", ((sal_Int32)(sizeof("..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx" ":" ((const char*) (__PRETTY_FUNCTION__)) ":" "342" "; ")-1)), (((rtl_TextEncoding) 11)) ), uno::Reference< uno::XInterface >() );
The patch is attached, but as you see it will need further changes all
around the codebase.
I'll switch diagnose.h (locally) to give " " for OSL_THIS_FUNC, as it
currently seems to do for everyone else.
Tell me what, if anything, of this I shall push.
Thomas
-------------- next part --------------
diff --git a/sal/inc/osl/diagnose.h b/sal/inc/osl/diagnose.h
index cbfabf3..424897b 100644
--- a/sal/inc/osl/diagnose.h
+++ b/sal/inc/osl/diagnose.h
@@ -78,14 +78,14 @@ 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 */
-#ifdef __func__
-#define OSL_THIS_FUNC __func__
-#elif defined (__PRETTY_FUNCTION__)
-#define OSL_THIS_FUNC __PRETTY_FUNCTION__
-#elif defined (__FUNCTION__)
-#define OSL_THIS_FUNC __FUNCTION__
+#if defined (__GNUC__)
+# define OSL_THIS_FUNC ((const char*) (__PRETTY_FUNCTION__))
+#elif defined (_MSC_VER)
+# define OSL_THIS_FUNC ((const char*) (__FUNCTION__))
+#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 19901L
+# define OSL_THIS_FUNC ((const char*) (__func__))
#else
-#define OSL_THIS_FUNC " "
+# define OSL_THIS_FUNC ((const char*) (" "))
#endif
/* the macro OSL_TO_STRING is intended to be an office internal macro for now */
More information about the LibreOffice
mailing list