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
#include <stdio.h>

#define TEST_1  "This is a test!\n"
#define TEST_2  "This" " is" " a" " test!\n"
#define HALF_1  "This is"
#define HALF_2  " a test!\n"

int main ( int argc, char **argv ) {
	// These 9 printf lines are all legal syntax, because the
	// compiler converts "one " "TWO" to "one TWO"
	printf( "Test 0:             This is a test!\n" );
	printf( "Test 0:             " "This" " is" " a" " test!\n" );

	printf( "Test 1 (formatted): %s", TEST_1 );
	printf( "Test 1:             "    TEST_1 );

	printf( "Test 2 (formatted): %s", TEST_2 );
	printf( "Test 2:             "    TEST_2 );

	printf( "Halves (formatted): %s%s", HALF_1, HALF_2 ); // note commas
	printf( "Halves (formatted): %s",   HALF_1  HALF_2 ); // note commas
	printf( "Halves:             "      HALF_1  HALF_2 ); // note commas

	// legal syntax, but should at least produce a warning.  I hope
	// LibreOffice is not suppressing warnings ...
	printf( __PRETTY_FUNCTION__ );

	// Legal, because treating __PRETTY_FUNCTION__ as
	// a variable
	printf( "\n__PRETTY_FUNCTION__: %s\n", __PRETTY_FUNCTION__ );

	// Not legal, because __PRETTY_FUNCTION__ doesn't get preprocessed
	// to an inline string: it's a /language/ identifier:
	printf( "__PRETTY_FUNCTION__: " __PRETTY_FUNCTION__ "\n" );

	return( 0 );
}
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to