[Libreoffice] ucb/source/ucb compilation error

Kevin Hunter hunteke at earlham.edu
Wed Oct 20 22:11:22 PDT 2010


On 10/20/2010 04:58 PM, Thomas Klausner wrote:
> On Tue, Oct 19, 2010 at 02:44:17PM +0200, Thomas Klausner wrote:
>> With up-to-date git, I now see:
>> ..../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: expected primary-expression before '(' token
>> ..../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: expected `)' before '__PRETTY_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: expected `)' before '__PRETTY_FUNCTION__'
>> ..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: expected `)' before ';' token
>> ..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx:342: error: expected `)' before ';' token
>>
>> Line 342 is:
>>      throw IllegalIdentifierException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ), uno::Reference<  uno::XInterface>() );
>
> Looking with g++ -E, this expands to:
>          throw IllegalIdentifierException( ::rtl::OUString( "..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx" ":" __PRETTY_FUNCTION__ ":" "342" "; ", ((sal_Int32)(sizeof("..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx" ":" __PRETTY_FUNCTION__ ":" "342" "; ")-1)), (((rtl_TextEncoding) 11)) ), uno::Reference<  uno::XInterface>() );

I can't finish a compile, or get your error right now, but I've three 
thoughts:

1. Macro use?
============
LibreOffice is using macros.  They aren't bad per se, but can lead to 
/really/ obscure (difficult!) to find errors.  In this case, I don't 
think the macro is the problem; however, since the bug is in a line that 
contains a one, my "spidey sense" went all haywire.  There went 10 minutes.

2. Extra parentheses?
=====================
I'm grasping at straws here, but I broke the long line into parts:

throw IllegalIdentifierException(
   ::rtl::OUString(
     "..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx" ":" 
__PRETTY_FUNCTION__ ":" "342" "; ",
     (   // <--- 1
 
(sal_Int32)(sizeof("..../build/libreoffice-3.2.99.2/ucb/source/ucp/file/prov.cxx" 
":" __PRETTY_FUNCTION__ ":" "342" "; ") -1)
     ),  // <--- 1
     (   // <--- 2
       ( // <--- 3
         (rtl_TextEncoding) 11
       ) // <--- 3
     )   // <--- 2
   ),
   uno::Reference< uno::XInterface >()
);

Are any of those parenthesis pairs a problem?  (1, 2, or 3)

3. Misinterpretation of __PRETTY_FUNCTION__?
============================================
What is __PRETTY_FUNCTION__?  It changed in GCC 3.4, I believe.  Now, 
contrary to the implicit understanding from its all caps nature, it is 
*not* a macro; it's a language identifier:

http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html

The clue that it's not a macro (aside from reading the documentation) is 
that it does not get processed out by the -E flag to g++.  Thus, the 
trip up is that it can't be concatenated as if it were an inline string. 
  See the attached example CPP code.  Note that to make it compile, 
you'll need to comment out line 37.

So, I believe the issue *is* with the macro definition, but, as is usual 
with macros, not where one expects.

Cheers,

Kevin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pretty_test.cpp
Type: text/x-c++src
Size: 1287 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20101021/d2cdbced/attachment.cpp>


More information about the LibreOffice mailing list