You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by hd...@apache.org on 2013/03/20 17:33:52 UTC

svn commit: r1458932 - in /openoffice/trunk/main/cppuhelper/source: bootstrap.cxx makefile.mk primeweak.cxx

Author: hdu
Date: Wed Mar 20 16:33:52 2013
New Revision: 1458932

URL: http://svn.apache.org/r1458932
Log:
Workaround bootstrap needing "comprehensive" type descriptions for stuff used in bootstrapping

Cppumaker and its brethren emit different implementations for
the same symbol by design (!) which is quite... unfortunate
and can confuse the heck out of dynamic linkers, debuggers, etc.

For bootstrapping the so-called "comprehensive" type descriptions are needed.
The workaround compels these descriptions to be registered in the so-called "WeakMap"
before they are needed by the bootstrap operation.

The proper and un-hacky solution would be to change cppumaker and its brethren
to use different symbol names for different implementations. In particular
"cppu_detail_getUnoType" should be divided into full, weak and mini implementations.
For now there is no time to risk such a major overhaul of this system.

Types that are candidates for this special workaround are the ones mentioned
by the exceptions thrown from implbase_ex.cxx's __queryDeepNoXInterface() method.
They also need to added to the makefile's UNOTYPES define so that the build magic
requests the full type descriptions to be generated and used.

Added:
    openoffice/trunk/main/cppuhelper/source/primeweak.cxx
Modified:
    openoffice/trunk/main/cppuhelper/source/bootstrap.cxx
    openoffice/trunk/main/cppuhelper/source/makefile.mk

Modified: openoffice/trunk/main/cppuhelper/source/bootstrap.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/cppuhelper/source/bootstrap.cxx?rev=1458932&r1=1458931&r2=1458932&view=diff
==============================================================================
--- openoffice/trunk/main/cppuhelper/source/bootstrap.cxx (original)
+++ openoffice/trunk/main/cppuhelper/source/bootstrap.cxx Wed Mar 20 16:33:52 2013
@@ -48,6 +48,8 @@
 #include "cppuhelper/access_control.hxx"
 #include "cppuhelper/findsofficepath.h"
 
+#include <cppuhelper/com/sun/star/container/XElementAccess.hpp>
+
 #include "com/sun/star/uno/XComponentContext.hpp"
 #include "com/sun/star/uno/XCurrentContext.hpp"
 
@@ -67,6 +69,7 @@
 #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
 #define ARLEN(x) sizeof (x) / sizeof *(x)
 
+void primeWeakMap( void); // as defined in primeweak.cxx
 
 using namespace ::rtl;
 using namespace ::osl;
@@ -376,6 +379,8 @@ SAL_CALL defaultBootstrap_InitialCompone
     Bootstrap const & bootstrap )
     SAL_THROW( (Exception) )
 {
+    primeWeakMap();
+
     OUString bootstrapPath;
     if (!bootstrap.getFrom(
             rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URE_INTERNAL_LIB_DIR")),

Modified: openoffice/trunk/main/cppuhelper/source/makefile.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/cppuhelper/source/makefile.mk?rev=1458932&r1=1458931&r2=1458932&view=diff
==============================================================================
--- openoffice/trunk/main/cppuhelper/source/makefile.mk (original)
+++ openoffice/trunk/main/cppuhelper/source/makefile.mk Wed Mar 20 16:33:52 2013
@@ -78,6 +78,7 @@ UNOTYPES= \
 		com.sun.star.lang.XServiceInfo \
 		com.sun.star.lang.XSingleComponentFactory \
 		com.sun.star.lang.XSingleServiceFactory \
+		com.sun.star.lang.XUnoTunnel \
 		com.sun.star.lang.XTypeProvider \
 		com.sun.star.loader.XImplementationLoader \
 		com.sun.star.reflection.XArrayTypeDescription \
@@ -123,6 +124,7 @@ SLOFILES= \
 		$(SLO)$/exc_thrower.obj 	\
 		$(SLO)$/servicefactory.obj 	\
 		$(SLO)$/bootstrap.obj 		\
+		$(SLO)$/primeweak.obj 		\
 		$(SLO)$/implbase.obj 		\
 		$(SLO)$/implbase_ex.obj 	\
 		$(SLO)$/propshlp.obj 		\
@@ -174,7 +176,8 @@ SHL1VERSIONMAP=msvc_win32_intel.map
 SHL1VERSIONMAP=cc5_solaris_sparc.map
 .ELIF "$(GUI)$(COMNAME)"=="OS2gcc3"
 SHL1VERSIONMAP=gcc3os2.map
-.ELIF "$(COMNAME)"=="gcc3"
+#.ELIF "$(COMNAME)"=="gcc3" || "$(COMNAME)"=="Clang"
+.ELSE
 SHL1VERSIONMAP=gcc3.map
 .ENDIF
 

Added: openoffice/trunk/main/cppuhelper/source/primeweak.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/cppuhelper/source/primeweak.cxx?rev=1458932&view=auto
==============================================================================
--- openoffice/trunk/main/cppuhelper/source/primeweak.cxx (added)
+++ openoffice/trunk/main/cppuhelper/source/primeweak.cxx Wed Mar 20 16:33:52 2013
@@ -0,0 +1,128 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_cppuhelper.hxx"
+
+// The only purpose of this file is to workaround a problem in UNO:
+// Cppumaker and its brethren emit different implementations for
+// the same symbol by design (!) which is quite... unfortunate
+// and can confuse the heck out of dynamic linkers, debuggers, etc.
+//
+// For bootstrapping comprehensive descriptions of some UNO types are needed.
+// The mechanism in this file makes sure that these comprehensive type
+// descriptions are used to prime the so-called "WeakMap".
+//
+// TODO: change cppumaker and its brethren to use different symbol names
+//       for different implementations. In particular "cppu_detail_getUnoType"
+//       should be divided into full, weak and mini implementations.
+
+// Types that are candidates for this special workaround are the ones mentioned
+// by the exceptions thrown from implbase_ex.cxx's __queryDeepNoXInterface()
+// that also need to added to the makefile's UNOTYPES define
+
+#define cppu_detail_getUnoType cppu_full_getUnoType
+#define InitTypeDesc(T) {(void)cppu_full_getUnoType(static_cast< T * >(NULL));}
+
+#include "cppuhelper/com/sun/star/lang/XComponent.hpp"
+#include "cppuhelper/com/sun/star/lang/XInitialization.hpp"
+#include "cppuhelper/com/sun/star/lang/XSingleServiceFactory.hpp"
+#include "cppuhelper/com/sun/star/lang/XSingleComponentFactory.hpp"
+#include "cppuhelper/com/sun/star/lang/XMultiServiceFactory.hpp"
+#include "cppuhelper/com/sun/star/lang/XMulticomponentFactory.hpp"
+#include "cppuhelper/com/sun/star/lang/XServiceInfo.hpp"
+#include "cppuhelper/com/sun/star/lang/XEventListener.hpp"
+#include "cppuhelper/com/sun/star/lang/XTypeProvider.hpp"
+#include "cppuhelper/com/sun/star/lang/XUnoTunnel.hpp"
+#include "cppuhelper/com/sun/star/uno/DeploymentException.hpp"
+#include "cppuhelper/com/sun/star/uno/XWeak.hpp"
+#include "cppuhelper/com/sun/star/uno/XCurrentContext.hpp"
+#include "cppuhelper/com/sun/star/uno/XComponentContext.hpp"
+#include "cppuhelper/com/sun/star/uno/RuntimeException.hpp"
+#include "cppuhelper/com/sun/star/beans/PropertyValue.hpp"
+#include "cppuhelper/com/sun/star/beans/XPropertySet.hpp"
+#include "cppuhelper/com/sun/star/beans/XMultiPropertySet.hpp"
+#include "cppuhelper/com/sun/star/container/XEnumerationAccess.hpp"
+#include "cppuhelper/com/sun/star/container/XEnumeration.hpp"
+#include "cppuhelper/com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "cppuhelper/com/sun/star/container/XSet.hpp"
+#include "cppuhelper/com/sun/star/bridge/XUnoUrlResolver.hpp"
+#include "cppuhelper/com/sun/star/bridge/XUnoUrlResolver.hpp"
+#include "cppuhelper/com/sun/star/io/IOException.hpp"
+#include "cppuhelper/com/sun/star/io/FilePermission.hpp"
+#include "cppuhelper/com/sun/star/security/RuntimePermission.hpp"
+#include "cppuhelper/com/sun/star/loader/XImplementationLoader.hpp"
+#include "cppuhelper/com/sun/star/security/XAccessController.hpp"
+#include "cppuhelper/com/sun/star/registry/XRegistryKey.hpp"
+#include "cppuhelper/com/sun/star/registry/XSimpleRegistry.hpp"
+#include "cppuhelper/com/sun/star/reflection/XTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XEnumTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XArrayTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XStructTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XUnionTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XCompoundTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XIndirectTypeDescription.hpp"
+#include "cppuhelper/com/sun/star/reflection/XMethodParameter.hpp"
+
+void primeWeakMap( void)
+{
+	InitTypeDesc( com::sun::star::lang::XComponent );
+	InitTypeDesc( com::sun::star::lang::XInitialization );
+	InitTypeDesc( com::sun::star::lang::XSingleServiceFactory );
+	InitTypeDesc( com::sun::star::lang::XSingleComponentFactory );
+	InitTypeDesc( com::sun::star::lang::XMultiServiceFactory );
+	InitTypeDesc( com::sun::star::lang::XMultiComponentFactory );
+	InitTypeDesc( com::sun::star::lang::XServiceInfo );
+	InitTypeDesc( com::sun::star::lang::XEventListener );
+	InitTypeDesc( com::sun::star::lang::XTypeProvider );
+	InitTypeDesc( com::sun::star::lang::XUnoTunnel );
+	InitTypeDesc( com::sun::star::uno::XWeak );
+	InitTypeDesc( com::sun::star::uno::DeploymentException );
+	InitTypeDesc( com::sun::star::uno::XCurrentContext );
+	InitTypeDesc( com::sun::star::uno::XComponentContext );
+	InitTypeDesc( com::sun::star::uno::RuntimeException );
+	InitTypeDesc( com::sun::star::beans::PropertyState );
+	InitTypeDesc( com::sun::star::beans::PropertyValue );
+	InitTypeDesc( com::sun::star::beans::XPropertySet );
+	InitTypeDesc( com::sun::star::beans::XMultiPropertySet );
+	InitTypeDesc( com::sun::star::container::XElementAccess );
+	InitTypeDesc( com::sun::star::container::XEnumeration );
+	InitTypeDesc( com::sun::star::container::XEnumerationAccess );
+	InitTypeDesc( com::sun::star::container::XHierarchicalNameAccess );
+	InitTypeDesc( com::sun::star::container::XSet );
+	InitTypeDesc( com::sun::star::io::IOException );
+	InitTypeDesc( com::sun::star::io::FilePermission );
+	InitTypeDesc( com::sun::star::security::XAccessController );
+	InitTypeDesc( com::sun::star::security::RuntimePermission);
+	InitTypeDesc( com::sun::star::loader::XImplementationLoader );
+	InitTypeDesc( com::sun::star::bridge::XUnoUrlResolver );
+	InitTypeDesc( com::sun::star::registry::XRegistryKey );
+	InitTypeDesc( com::sun::star::registry::XSimpleRegistry );
+	InitTypeDesc( com::sun::star::reflection::XTypeDescription );
+	InitTypeDesc( com::sun::star::reflection::XEnumTypeDescription );
+	InitTypeDesc( com::sun::star::reflection::XArrayTypeDescription );
+	InitTypeDesc( com::sun::star::reflection::XStructTypeDescription );
+	InitTypeDesc( com::sun::star::reflection::XUnionTypeDescription );
+	InitTypeDesc( com::sun::star::reflection::XCompoundTypeDescription );
+	InitTypeDesc( com::sun::star::reflection::XIndirectTypeDescription );
+	InitTypeDesc( com::sun::star::reflection::XMethodParameter );
+}
+