Remove MinGW support

In OOo times, there'd originally been efforts to allow building on Windows with
MinGW.  Later, in LO times, this has been shifted to an attempt of cross-
compiling for Windows on Linux.  That attempt can be considered abandoned, and
the relevant code rotting.

Due to this heritage, there are now three kinds of MinGW-specific code in LO:

* Code from the original OOo native Windows effort that is no longer relevant
  for the LO cross-compilation effort, but has never been removed properly.

* Code from the original OOo native Windows effort that is re-purposed for the
  LO cross-compilation effort.

* Code that has been added specifially for the LO cross-compilation effort.

All three kinds of code are removed.

(An unrelated, remaining use of MinGW is for --enable-build-unowinreg, utilizing
--with-mingw-cross-compiler, MINGWCXX, and MINGWSTRIP.)

Change-Id: I49daad8669b4cbe49fa923050c4a4a6ff7dda568
Reviewed-on: https://gerrit.libreoffice.org/34127
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2017-02-10 18:01:27 +00:00
parent 09e9274fc0
commit 8646ab97dc
218 changed files with 346 additions and 10129 deletions
-4
View File
@@ -794,10 +794,6 @@ $(eval $(call gb_Helper_register_packages, \
$(if $(filter DESKTOP,$(BUILD_TYPE)),desktop_scripts_install) \
extras_fonts \
extras_wordbook \
$(if $(filter WNTGCC,$(OS)$(COM)), \
mingw_dlls \
mingw_gccdlls \
) \
$(if $(filter MSC,$(COM)),msvc_dlls) \
more_fonts_conf \
instsetoo_native_setup \
+1 -20
View File
@@ -720,23 +720,6 @@ endif # SYSTEM_CMIS
ifeq ($(ENABLE_JAVA),TRUE)
ifeq ($(OS)$(COM),WNTGCC)
define gb_LinkTarget__use_jawt
$(call gb_LinkTarget_use_custom_headers,$(1),external/jawt)
$(call gb_LinkTarget_add_ldflags,$(1),\
-L$(call gb_CustomTarget_get_workdir,external/jawt) \
)
$(call gb_LinkTarget_add_libs,$(1),\
$(JAWTLIB) \
)
endef
else # $(OS)$(COM) != WNTGCC
define gb_LinkTarget__use_jawt
$(call gb_LinkTarget_add_libs,$(1),\
$(JAWTLIB) \
@@ -744,8 +727,6 @@ $(call gb_LinkTarget_add_libs,$(1),\
endef
endif # $(OS)$(COM) = WNTGCC
else # !ENABLE_JAVA
gb_LinkTarget__use_jawt :=
@@ -2986,7 +2967,7 @@ $(call gb_LinkTarget_add_libs,$(1),\
$(call gb_UnpackedTarball_get_dir,postgresql)/src/interfaces/libpq/libpq$(gb_StaticLibrary_PLAINEXT) \
)
ifeq ($(OS)$(COM),WNTMSC)
ifeq ($(OS),WNT)
$(call gb_LinkTarget_use_external,$(1),openssl)
$(call gb_LinkTarget_use_system_win32_libs,$(1),\
-17
View File
@@ -80,21 +80,6 @@ gb_Library_FILENAMES := $(patsubst rdf:rdf%,rdf:librdf%,$(gb_Library_FILENAMES))
# libpyuno_wrapper.dll => pyuno.pyd
gb_Library_FILENAMES := $(patsubst pyuno:pyuno.dll,pyuno:pyuno$(if $(MSVC_USE_DEBUG_RUNTIME),_d).pyd,$(gb_Library_FILENAMES))
ifeq ($(COM),GCC)
gb_Library_ILIBFILENAMES := $(patsubst libexttextcat:liblibext%,libexttextcat:libilibext%,$(gb_Library_ILIBFILENAMES))
gb_Library_ILIBFILENAMES := $(patsubst z:iz%,z:zlib%,$(gb_Library_ILIBFILENAMES))
# Libraries not provided by mingw(-w64), available only in the Windows
# SDK. So if these actually are liked with somewhere, we can't
# cross-compile that module then using MinGW. That needs to be fixed
# then, and we need to use these libraries through run-time lookup of
# APIs. Or something.
gb_Library_SDKLIBFILENAMES:=
gb_Library_FILENAMES := $(filter-out $(foreach lib,$(gb_Library_SDKLIBFILENAMES),$(lib):%),$(gb_Library_FILENAMES))
gb_Library_FILENAMES += $(foreach lib,$(gb_Library_SDKLIBFILENAMES),$(lib):$(WINDOWS_SDK_HOME)/lib/$(lib).lib)
else # $(COM) != GCC
gb_Library_ILIBFILENAMES := $(patsubst z:z%,z:zlib%,$(gb_Library_ILIBFILENAMES))
# these have prefix "lib" instead of "i"
@@ -110,8 +95,6 @@ gb_Library_ILIBFILENAMES += \
gb_Library_FILENAMES := $(filter-out $(foreach lib,$(gb_Library_LIBLIBFILENAMES),$(lib):%),$(gb_Library_FILENAMES))
gb_Library_FILENAMES += $(foreach lib,$(gb_Library_LIBLIBFILENAMES),$(lib):lib$(lib).dll)
endif # ifeq ($(COM),GCC)
endif # ifeq ($(OS),WNT)
# vim: set noet sw=4 ts=4:
-6
View File
@@ -25,9 +25,7 @@ extern "C" const IID IID_IMediaDet;
struct ISampleGrabber;
struct
#ifndef __MINGW32__
__declspec(uuid("65BD0710-24D2-4ff7-9324-ED2E5D3ABAFA")) __declspec(novtable)
#endif
IMediaDet : public IUnknown
{
public:
@@ -77,9 +75,7 @@ protected:
extern "C" const IID IID_ISampleGrabberCB;
struct
#ifndef __MINGW32__
__declspec(uuid("0579154A-2B53-4994-B0D0-E773148EFF85")) __declspec(novtable)
#endif
ISampleGrabberCB : public IUnknown
{
public:
@@ -97,9 +93,7 @@ protected:
extern "C" const IID IID_ISampleGrabber;
struct
#ifndef __MINGW32__
__declspec(uuid("6B652FFF-11FE-4fce-92AD-0266B5D7C78F")) __declspec(novtable)
#endif
ISampleGrabber : public IUnknown
{
public:
+3 -10
View File
@@ -144,6 +144,9 @@ ifeq ($(OS)$(CPUNAME),WNTINTEL)
$(eval $(call gb_Library_add_exception_objects,sb,\
basic/source/runtime/dllmgr-x86 \
))
$(eval $(call gb_Library_add_asmobjects,sb,\
basic/source/runtime/wnt-x86 \
))
else
ifeq ($(OS)$(CPUNAME),WNTX86_64)
$(eval $(call gb_Library_add_exception_objects,sb,\
@@ -155,16 +158,6 @@ $(eval $(call gb_Library_add_exception_objects,sb,\
))
endif
endif
ifeq ($(OS)$(COM)$(CPUNAME),WNTMSCINTEL)
$(eval $(call gb_Library_add_asmobjects,sb,\
basic/source/runtime/wnt-x86 \
))
endif
ifeq ($(OS)$(COM)$(CPUNAME),WNTGCCINTEL)
$(eval $(call gb_Library_add_asmobjects,sb,\
basic/source/runtime/wnt-mingw \
))
endif
# Runtime dependency for unit-tests
$(eval $(call gb_Library_use_restarget,sb,sb))
-44
View File
@@ -1,44 +0,0 @@
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This file incorporates work covered by the following license notice:
#
# 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 .
#
.intel_syntax
.globl _DllMgr_call32@12
.globl _DllMgr_callFp@12
_DllMgr_call32@12:
_DllMgr_callFp@12:
push ebp
mov ebp, esp
push esi
push edi
mov ecx, [ebp+16]
jecxz $1
sub esp, ecx
mov edi, esp
mov esi, [ebp+12]
shr ecx, 2
rep movsd
$1: call DWORD PTR [ebp+8]
# for extra safety, do not trust esp after call (in case the Basic Declare
# signature is wrong):
mov edi, [ebp-8]
mov esi, [ebp-4]
mov esp, ebp
pop ebp
ret 12
+1 -4
View File
@@ -24,13 +24,10 @@
#ifdef _WIN32
#include <prewin.h>
#include <postwin.h>
#ifndef __MINGW32__
#include <comutil.h>
#endif
#include <oleauto.h>
#endif
#endif
#include <basic/sbx.hxx>
+1 -15
View File
@@ -81,11 +81,6 @@ else ifeq ($(COM),MSC)
bridges_SELECTED_BRIDGE := msvc_win32_intel
bridge_exception_objects := cpp2uno dllinit uno2cpp
bridge_noopt_objects := except
else ifeq ($(OS)$(COM),WNTGCC)
bridges_SELECTED_BRIDGE := mingw_intel
bridge_asm_objects := call
bridge_noopt_objects := uno2cpp
bridge_exception_objects := callvirtualmethod cpp2uno dllinit except smallstruct
endif
else ifeq ($(CPUNAME),M68K)
@@ -182,11 +177,6 @@ bridges_SELECTED_BRIDGE := msvc_win32_x86-64
bridge_exception_objects := cpp2uno dllinit uno2cpp
bridge_noopt_objects := except
bridge_asm_objects := call
else ifeq ($(OS)$(COM),WNTGCC)
bridges_SELECTED_BRIDGE := mingw_x86-64
bridge_asm_objects := call
bridge_noncallexception_noopt_objects := callvirtualmethod
bridge_exception_objects := abi cpp2uno except uno2cpp
endif
endif
@@ -207,13 +197,9 @@ $(eval $(call gb_Library_add_defs,$(gb_CPPU_ENV)_uno,\
endif
ifeq ($(OS),WNT)
$(eval $(call gb_Library_add_defs,$(gb_CPPU_ENV)_uno,\
$(if $(filter GCC,$(COM)),\
$(if $(filter sjlj,$(EXCEPTIONS)),\
-DBROKEN_ALLOCA \
), \
$(if $(cppu_no_leak)$(bndchk),,\
-DLEAK_STATIC_DATA \
)) \
) \
))
endif
-8
View File
@@ -9,14 +9,6 @@
$(eval $(call gb_Library_Library,java_uno))
ifeq ($(OS)$(COM),WNTGCC)
ifeq ($(EXCEPTIONS),sjlj)
$(eval $(call gb_Library_add_defs,java_uno,\
-DBROKEN_ALLOCA \
))
endif
endif
$(eval $(call gb_Library_use_internal_comprehensive_api,java_uno,\
udkapi \
))
+1 -1
View File
@@ -32,7 +32,7 @@ namespace com { namespace sun { namespace star { namespace uno {
class XInterface;
} } } }
#if !defined __GNUG__ || defined __MINGW32__
#if !defined __GNUG__
void dso_init();
void dso_exit();
#endif
-279
View File
@@ -1,279 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
.text
.globl _privateSnippetExecutorGeneral
_privateSnippetExecutorGeneral:
.LFBg:
movl %esp,%ecx
pushl %ebp # proper stack frame needed for exception handling
.LCFIg0:
movl %esp,%ebp
.LCFIg1:
subl $0x4,%esp # 32bit returnValue
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
pushl %eax # 32bit nFunctionIndex
call _cpp_vtable_call
movl 16(%esp),%eax # 32bit returnValue
leave
ret
.LFEg:
.long .-_privateSnippetExecutorGeneral
.globl _privateSnippetExecutorVoid
_privateSnippetExecutorVoid:
.LFBv:
movl %esp,%ecx
pushl %ebp # proper stack frame needed for exception handling
.LCFIv0:
movl %esp,%ebp
.LCFIv1:
pushl $0 # 32bit null pointer (returnValue not used)
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
pushl %eax # 32bit nFunctionIndex
call _cpp_vtable_call
leave
ret
.LFEv:
.long .-_privateSnippetExecutorVoid
.globl _privateSnippetExecutorHyper
_privateSnippetExecutorHyper:
.LFBh:
movl %esp,%ecx
pushl %ebp # proper stack frame needed for exception handling
.LCFIh0:
movl %esp,%ebp
.LCFIh1:
subl $0x8,%esp # 64bit returnValue
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
pushl %eax # 32bit nFunctionIndex
call _cpp_vtable_call
movl 16(%esp),%eax # 64bit returnValue, lower half
movl 20(%esp),%edx # 64bit returnValue, upper half
leave
ret
.LFEh:
.long .-_privateSnippetExecutorHyper
.globl _privateSnippetExecutorFloat
_privateSnippetExecutorFloat:
.LFBf:
movl %esp,%ecx
pushl %ebp # proper stack frame needed for exception handling
.LCFIf0:
movl %esp,%ebp
.LCFIf1:
subl $0x4,%esp # 32bit returnValue
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
pushl %eax # 32bit nFunctionIndex
call _cpp_vtable_call
flds 16(%esp) # 32bit returnValue
leave
ret
.LFEf:
.long .-_privateSnippetExecutorFloat
.globl _privateSnippetExecutorDouble
_privateSnippetExecutorDouble:
.LFBd:
movl %esp,%ecx
pushl %ebp # proper stack frame needed for exception handling
.LCFId0:
movl %esp,%ebp
.LCFId1:
subl $0x8,%esp # 64bit returnValue
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
pushl %eax # 32bit nFunctionIndex
call _cpp_vtable_call
fldl 16(%esp) # 64bit returnValue
leave
ret
.LFEd:
.long .-_privateSnippetExecutorDouble
.globl _privateSnippetExecutorClass
_privateSnippetExecutorClass:
.LFBc:
movl %esp,%ecx
pushl %ebp # proper stack frame needed for exception handling
.LCFIc0:
movl %esp,%ebp
.LCFIc1:
subl $0x4,%esp # 32bit returnValue
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
pushl %eax # 32bit nFunctionIndex
call _cpp_vtable_call
movl 16(%esp),%eax # 32bit returnValue
leave
ret $4
.LFEc:
.long .-_privateSnippetExecutorClass
.section .eh_frame,"dr"
.Lframe1:
.long .LECIE1-.LSCIE1 # length
.LSCIE1:
.long 0 # CIE_ID
.byte 1 # version
.string "zR" # augmentation
.uleb128 1 # code_alignment_factor
.sleb128 -4 # data_alignment_factor
.byte 8 # return_address_register
.uleb128 1 # augmentation size 1:
.byte 0x1B # FDE Encoding (pcrel sdata4)
# initial_instructions:
.byte 0x0C # DW_CFA_def_cfa %esp, 4
.uleb128 4
.uleb128 4
.byte 0x88 # DW_CFA_offset ret, 1
.uleb128 1
.align 4
.LECIE1:
.LSFDEg:
.long .LEFDEg-.LASFDEg # length
.LASFDEg:
.long .LASFDEg-.Lframe1 # CIE_pointer
.long .LFBg-. # initial_location
.long .LFEg-.LFBg # address_range
.uleb128 0 # augmentation size 0
# instructions:
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIg0-.LFBg
.byte 0x0E # DW_CFA_def_cfa_offset 8
.uleb128 8
.byte 0x85 # DW_CFA_offset %ebp, 2
.uleb128 2
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIg1-.LCFIg0
.byte 0x0D # DW_CFA_def_cfa_register %ebp
.uleb128 5
.align 4
.LEFDEg:
.LSFDEv:
.long .LEFDEv-.LASFDEv # length
.LASFDEv:
.long .LASFDEv-.Lframe1 # CIE_pointer
.long .LFBv-. # initial_location
.long .LFEv-.LFBv # address_range
.uleb128 0 # augmentation size 0
# instructions:
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIv0-.LFBv
.byte 0x0E # DW_CFA_def_cfa_offset 8
.uleb128 8
.byte 0x85 # DW_CFA_offset %ebp, 2
.uleb128 2
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIv1-.LCFIv0
.byte 0x0D # DW_CFA_def_cfa_register %ebp
.uleb128 5
.align 4
.LEFDEv:
.LSFDEh:
.long .LEFDEh-.LASFDEh # length
.LASFDEh:
.long .LASFDEh-.Lframe1 # CIE_pointer
.long .LFBh-. # initial_location
.long .LFEh-.LFBh # address_range
.uleb128 0 # augmentation size 0
# instructions:
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIh0-.LFBh
.byte 0x0E # DW_CFA_def_cfa_offset 8
.uleb128 8
.byte 0x85 # DW_CFA_offset %ebp, 2
.uleb128 2
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIh1-.LCFIh0
.byte 0x0D # DW_CFA_def_cfa_register %ebp
.uleb128 5
.align 4
.LEFDEh:
.LSFDEf:
.long .LEFDEf-.LASFDEf # length
.LASFDEf:
.long .LASFDEf-.Lframe1 # CIE_pointer
.long .LFBf-. # initial_location
.long .LFEf-.LFBf # address_range
.uleb128 0 # augmentation size 0
# instructions:
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIf0-.LFBf
.byte 0x0E # DW_CFA_def_cfa_offset 8
.uleb128 8
.byte 0x85 # DW_CFA_offset %ebp, 2
.uleb128 2
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIf1-.LCFIf0
.byte 0x0D # DW_CFA_def_cfa_register %ebp
.uleb128 5
.align 4
.LEFDEf:
.LSFDEd:
.long .LEFDEd-.LASFDEd # length
.LASFDEd:
.long .LASFDEd-.Lframe1 # CIE_pointer
.long .LFBd-. # initial_location
.long .LFEd-.LFBd # address_range
.uleb128 0 # augmentation size 0
# instructions:
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFId0-.LFBd
.byte 0x0E # DW_CFA_def_cfa_offset 8
.uleb128 8
.byte 0x85 # DW_CFA_offset %ebp, 2
.uleb128 2
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFId1-.LCFId0
.byte 0x0D # DW_CFA_def_cfa_register %ebp
.uleb128 5
.align 4
.LEFDEd:
.LSFDEc:
.long .LEFDEc-.LASFDEc # length
.LASFDEc:
.long .LASFDEc-.Lframe1 # CIE_pointer
.long .LFBc-. # initial_location
.long .LFEc-.LFBc # address_range
.uleb128 0 # augmentation size 0
# instructions:
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIc0-.LFBc
.byte 0x0E # DW_CFA_def_cfa_offset 8
.uleb128 8
.byte 0x85 # DW_CFA_offset %ebp, 2
.uleb128 2
.byte 0x04 # DW_CFA_advance_loc4
.long .LCFIc1-.LCFIc0
.byte 0x0D # DW_CFA_def_cfa_register %ebp
.uleb128 5
.align 4
.LEFDEc:
@@ -1,137 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include "sal/config.h"
#include "cppu/macros.hxx"
#include "sal/types.h"
#include "typelib/typeclass.h"
#include "typelib/typedescription.h"
#include "callvirtualmethod.hxx"
#include "share.hxx"
#include "smallstruct.hxx"
// For some reason, callVirtualMethod needs to be in a source file of its own,
// so that stack unwinding upon a thrown exception from within the asm block
// call works, at least with GCC 4.7.0 and --enable-dbgutil.
// The call instruction within the asm section of callVirtualMethod may throw
// exceptions. So that the compiler handles this correctly, it is important
// that (a) callVirtualMethod might call dummy_can_throw_anything (although this
// never happens at runtime), which in turn can throw exceptions, and (b)
// callVirtualMethod is not inlined at its call site (so that any exceptions are
// caught which are thrown from the instruction calling callVirtualMethod). [It
// is unclear how much of this comment is still relevant -- see the above
// comment.]
void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
void * pAdjustedThisPtr, sal_Int32 nVtableIndex, void * pRegisterReturn,
typelib_TypeDescription const * returnType, sal_Int32 * pStackLongs,
sal_Int32 nStackLongs)
{
// parameter list is mixed list of * and values
// reference parameters are pointers
assert(pStackLongs && pAdjustedThisPtr);
static_assert( (sizeof(void *) == 4) && (sizeof(sal_Int32) == 4), "### unexpected size of int!");
assert(nStackLongs && pStackLongs && "### no stack in callVirtualMethod !");
// never called
if (! pAdjustedThisPtr) CPPU_CURRENT_NAMESPACE::dummy_can_throw_anything("xxx"); // address something
long edx, eax; // for register returns
void * stackptr;
asm volatile (
"mov %%esp, %2\n\t"
// copy values
"mov %3, %%eax\n\t"
"mov %%eax, %%edx\n\t"
"dec %%edx\n\t"
"shl $2, %%edx\n\t"
"add %4, %%edx\n"
"Lcopy:\n\t"
"pushl 0(%%edx)\n\t"
"sub $4, %%edx\n\t"
"dec %%eax\n\t"
"jne Lcopy\n\t"
// do the actual call
"mov %5, %%edx\n\t"
"mov 0(%%edx), %%edx\n\t"
"mov %6, %%eax\n\t"
"shl $2, %%eax\n\t"
"add %%eax, %%edx\n\t"
"mov 0(%%edx), %%edx\n\t"
"call *%%edx\n\t"
// save return registers
"mov %%eax, %0\n\t"
"mov %%edx, %1\n\t"
// cleanup stack
"mov %2, %%esp\n\t"
: "=m"(eax), "=m"(edx), "=m"(stackptr)
: "m"(nStackLongs), "m"(pStackLongs), "m"(pAdjustedThisPtr), "m"(nVtableIndex)
: "eax", "ecx", "edx" );
switch( returnType->eTypeClass )
{
case typelib_TypeClass_VOID:
break;
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
((long*)pRegisterReturn)[1] = edx;
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_CHAR:
case typelib_TypeClass_ENUM:
((long*)pRegisterReturn)[0] = eax;
break;
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
*(unsigned short*)pRegisterReturn = eax;
break;
case typelib_TypeClass_BOOLEAN:
case typelib_TypeClass_BYTE:
*(unsigned char*)pRegisterReturn = eax;
break;
case typelib_TypeClass_FLOAT:
asm ( "fstps %0" : : "m"(*(char *)pRegisterReturn) );
break;
case typelib_TypeClass_DOUBLE:
asm ( "fstpl %0\n\t" : : "m"(*(char *)pRegisterReturn) );
break;
case typelib_TypeClass_STRUCT:
if (bridges::cpp_uno::shared::isSmallStruct(returnType)) {
if (returnType->nSize <= 1) {
*(unsigned char*)pRegisterReturn = eax;
}
else if (returnType->nSize <= 2) {
*(unsigned short*)pRegisterReturn = eax;
}
else if (returnType->nSize <= 8) {
((long*)pRegisterReturn)[0] = eax;
if (returnType->nSize > 4) {
((long*)pRegisterReturn)[1] = edx;
}
}
}
break;
default:
break;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,40 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_INTEL_CALLVIRTUALMETHOD_HXX
#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_INTEL_CALLVIRTUALMETHOD_HXX
#include "sal/config.h"
#include "cppu/macros.hxx"
#include "sal/types.h"
#include "typelib/typedescription.h"
namespace CPPU_CURRENT_NAMESPACE {
void callVirtualMethod(
void * pAdjustedThisPtr, sal_Int32 nVtableIndex, void * pRegisterReturn,
typelib_TypeDescription const * returnType, sal_Int32 * pStackLongs,
sal_Int32 nStackLongs);
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,507 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
#include <uno/data.h>
#include <typelib/typedescription.hxx>
#include <sal/alloca.h>
#include <sal/log.hxx>
#include "bridge.hxx"
#include "cppinterfaceproxy.hxx"
#include "types.hxx"
#include "vtablefactory.hxx"
#include "share.hxx"
#include "smallstruct.hxx"
using namespace ::com::sun::star::uno;
namespace
{
void cpp2uno_call(
bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
const typelib_TypeDescription * pMemberTypeDescr,
typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
sal_Int32 nParams, typelib_MethodParameter * pParams,
void ** pCallStack,
void * pReturnValue )
{
// pCallStack: ret, [return ptr], this, params
char * pCppStack = (char *)(pCallStack +1);
// return
typelib_TypeDescription * pReturnTypeDescr = 0;
if (pReturnTypeRef)
TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
void * pUnoReturn = 0;
void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
if (pReturnTypeDescr)
{
if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
{
pUnoReturn = pReturnValue; // direct way for simple types
}
else // complex return via ptr (pCppReturn)
{
if (!bridges::cpp_uno::shared::isSmallStruct(pReturnTypeDescr)) {
pCppReturn = *(void **)pCppStack;
pCppStack += sizeof(void *);
}
else {
pCppReturn = pReturnValue;
}
pUnoReturn = (bridges::cpp_uno::shared::relatesToInterfaceType(
pReturnTypeDescr )
? alloca( pReturnTypeDescr->nSize )
: pCppReturn); // direct way
}
}
// pop this
pCppStack += sizeof( void* );
// stack space
static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!");
// parameters
void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
void ** pCppArgs = pUnoArgs + nParams;
// indices of values this have to be converted (interface conversion cpp<=>uno)
sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams));
// type descriptions for reconversions
typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
sal_Int32 nTempIndices = 0;
for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
{
const typelib_MethodParameter & rParam = pParams[nPos];
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
if (!rParam.bOut
&& bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
// value
{
pCppArgs[nPos] = pCppStack;
pUnoArgs[nPos] = pCppStack;
switch (pParamTypeDescr->eTypeClass)
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
case typelib_TypeClass_DOUBLE:
pCppStack += sizeof(sal_Int32); // extra long
break;
default:
break;
}
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
else // ptr to complex value | ref
{
pCppArgs[nPos] = *(void **)pCppStack;
if (! rParam.bIn) // is pure out
{
// uno out is unconstructed mem!
pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
pTempIndices[nTempIndices] = nPos;
// will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
}
// is in/inout
else if (bridges::cpp_uno::shared::relatesToInterfaceType(
pParamTypeDescr ))
{
uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
*(void **)pCppStack, pParamTypeDescr,
pThis->getBridge()->getCpp2Uno() );
pTempIndices[nTempIndices] = nPos; // has to be reconverted
// will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
}
else // direct way
{
pUnoArgs[nPos] = *(void **)pCppStack;
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
}
pCppStack += sizeof(sal_Int32); // standard parameter length
}
// ExceptionHolder
uno_Any aUnoExc; // Any will be constructed by callee
uno_Any * pUnoExc = &aUnoExc;
// invoke uno dispatch call
(*pThis->getUnoI()->pDispatcher)(
pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
// in case an exception occurred...
if (pUnoExc)
{
// destruct temporary in/inout params
for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
if (pParams[nIndex].bIn) // is in/inout => was constructed
uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], 0 );
TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
}
if (pReturnTypeDescr)
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
CPPU_CURRENT_NAMESPACE::raiseException(
&aUnoExc, pThis->getBridge()->getUno2Cpp() );
// has to destruct the any
}
else // else no exception occurred...
{
// temporary params
for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
if (pParams[nIndex].bOut) // inout/out
{
// convert and assign
uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
pThis->getBridge()->getUno2Cpp() );
}
// destroy temp uno param
uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
// return
if (pCppReturn) // has complex return
{
if (pUnoReturn != pCppReturn) // needs reconversion
{
uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
pThis->getBridge()->getUno2Cpp() );
// destroy temp uno return
uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
}
if (pReturnValue != pCppReturn)
// complex return ptr is set to eax
*static_cast< void ** >(pReturnValue) = pCppReturn;
}
if (pReturnTypeDescr)
{
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
}
}
}
extern "C" void cpp_vtable_call(
int nFunctionIndex, int nVtableOffset, void** pCallStack,
void * pReturnValue )
{
static_assert(sizeof(sal_Int32)==sizeof(void *), "### unexpected!");
// pCallStack: ret adr, [ret *], this, params
void * pThis;
if( nFunctionIndex & 0x80000000 )
{
nFunctionIndex &= 0x7fffffff;
pThis = pCallStack[2];
}
else
{
pThis = pCallStack[1];
}
pThis = static_cast< char * >(pThis) - nVtableOffset;
bridges::cpp_uno::shared::CppInterfaceProxy * pCppI
= bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy(
pThis);
typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
if (nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex)
{
SAL_WARN(
"bridges",
"illegal " << OUString::unacquired(&pTypeDescr->aBase.pTypeName)
<< " vtable index " << nFunctionIndex << "/"
<< pTypeDescr->nMapFunctionIndexToMemberIndex);
throw RuntimeException(
("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName)
+ " vtable index " + OUString::number(nFunctionIndex) + "/"
+ OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)),
(XInterface *)pThis);
}
// determine called method
sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
assert(nMemberPos < pTypeDescr->nAllMembers);
TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
switch (aMemberDescr.get()->eTypeClass)
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
if (pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex)
{
// is GET method
cpp2uno_call(
pCppI, aMemberDescr.get(),
((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef,
0, 0, // no params
pCallStack, pReturnValue );
}
else
{
// is SET method
typelib_MethodParameter aParam;
aParam.pTypeRef =
((typelib_InterfaceAttributeTypeDescription *)aMemberDescr.get())->pAttributeTypeRef;
aParam.bIn = sal_True;
aParam.bOut = sal_False;
cpp2uno_call(
pCppI, aMemberDescr.get(),
0, // indicates void return
1, &aParam,
pCallStack, pReturnValue );
}
break;
}
case typelib_TypeClass_INTERFACE_METHOD:
{
// is METHOD
switch (nFunctionIndex)
{
case 1: // acquire()
pCppI->acquireProxy(); // non virtual call!
break;
case 2: // release()
pCppI->releaseProxy(); // non virtual call!
break;
case 0: // queryInterface() opt
{
typelib_TypeDescription * pTD = 0;
TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pCallStack[3] )->getTypeLibType() );
if (pTD)
{
XInterface * pInterface = 0;
(*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)(
pCppI->getBridge()->getCppEnv(),
(void **)&pInterface, pCppI->getOid().pData,
(typelib_InterfaceTypeDescription *)pTD );
if (pInterface)
{
::uno_any_construct(
reinterpret_cast< uno_Any * >( pCallStack[1] ),
&pInterface, pTD, cpp_acquire );
pInterface->release();
TYPELIB_DANGER_RELEASE( pTD );
*static_cast< void ** >(pReturnValue) = pCallStack[1];
break;
}
TYPELIB_DANGER_RELEASE( pTD );
}
} // else perform queryInterface()
default:
cpp2uno_call(
pCppI, aMemberDescr.get(),
((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pReturnTypeRef,
((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->nParams,
((typelib_InterfaceMethodTypeDescription *)aMemberDescr.get())->pParams,
pCallStack, pReturnValue );
}
break;
}
default:
{
throw RuntimeException( "no member description found!", (XInterface *)pThis );
}
}
}
extern "C" typedef void (*PrivateSnippetExecutor)();
int const codeSnippetSize = 16;
unsigned char * codeSnippet(
unsigned char * code, sal_Int32 functionIndex, sal_Int32 vtableOffset,
typelib_TypeDescriptionReference * returnType)
{
typelib_TypeDescription * returnTypeDescr = 0;
if (returnType)
TYPELIB_DANGER_GET( &returnTypeDescr, returnType );
typelib_TypeClass returnTypeClass = returnType ? returnType->eTypeClass : typelib_TypeClass_VOID;
if (!bridges::cpp_uno::shared::isSimpleType(returnTypeClass) &&
!bridges::cpp_uno::shared::isSmallStruct(returnTypeDescr)) {
functionIndex |= 0x80000000;
}
PrivateSnippetExecutor exec = privateSnippetExecutorGeneral;
switch (returnTypeClass) {
case typelib_TypeClass_VOID:
exec = privateSnippetExecutorVoid;
break;
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
exec = privateSnippetExecutorHyper;
break;
case typelib_TypeClass_FLOAT:
exec = privateSnippetExecutorFloat;
break;
case typelib_TypeClass_DOUBLE:
exec = privateSnippetExecutorDouble;
break;
case typelib_TypeClass_STRUCT:
if (bridges::cpp_uno::shared::isSmallStruct(returnTypeDescr)) {
if (returnType->pType->nSize <= 4) {
exec = privateSnippetExecutorGeneral;
}
else if (returnType->pType->nSize <= 8) {
exec = privateSnippetExecutorHyper;
}
}
else {
exec = privateSnippetExecutorClass;
}
break;
case typelib_TypeClass_STRING:
case typelib_TypeClass_TYPE:
case typelib_TypeClass_ANY:
case typelib_TypeClass_SEQUENCE:
case typelib_TypeClass_INTERFACE:
exec = privateSnippetExecutorClass;
break;
default:
exec = privateSnippetExecutorGeneral;
break;
}
if (returnType)
TYPELIB_DANGER_RELEASE( returnTypeDescr );
unsigned char * p = code;
static_assert(sizeof (sal_Int32) == 4, "boo");
// mov function_index, %eax:
*p++ = 0xB8;
*reinterpret_cast< sal_Int32 * >(p) = functionIndex;
p += sizeof (sal_Int32);
// mov vtable_offset, %edx:
*p++ = 0xBA;
*reinterpret_cast< sal_Int32 * >(p) = vtableOffset;
p += sizeof (sal_Int32);
// jmp privateSnippetExecutor:
*p++ = 0xE9;
*reinterpret_cast< sal_Int32 * >(p)
= ((unsigned char *) exec) - p - sizeof (sal_Int32);
p += sizeof (sal_Int32);
assert(p - code <= codeSnippetSize);
return code + codeSnippetSize;
}
}
struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
bridges::cpp_uno::shared::VtableFactory::Slot *
bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
{
return static_cast< Slot * >(block) + 2;
}
std::size_t bridges::cpp_uno::shared::VtableFactory::getBlockSize(
sal_Int32 slotCount)
{
return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
}
bridges::cpp_uno::shared::VtableFactory::Slot *
bridges::cpp_uno::shared::VtableFactory::initializeBlock(
void * block, sal_Int32 slotCount, sal_Int32,
typelib_InterfaceTypeDescription *)
{
Slot * slots = mapBlockToVtable(block);
slots[-2].fn = 0;
slots[-1].fn = 0;
return slots + slotCount;
}
unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
Slot ** slots, unsigned char * code,
typelib_InterfaceTypeDescription const * type, sal_Int32 functionOffset,
sal_Int32 functionCount, sal_Int32 vtableOffset)
{
(*slots) -= functionCount;
Slot * s = *slots;
for (sal_Int32 i = 0; i < type->nMembers; ++i) {
typelib_TypeDescription * member = 0;
TYPELIB_DANGER_GET(&member, type->ppMembers[i]);
assert(member != 0);
switch (member->eTypeClass) {
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
// Getter:
(s++)->fn = code;
code = codeSnippet(
code, functionOffset++, vtableOffset,
reinterpret_cast< typelib_InterfaceAttributeTypeDescription * >(
member)->pAttributeTypeRef);
// Setter:
if (!reinterpret_cast<
typelib_InterfaceAttributeTypeDescription * >(
member)->bReadOnly)
{
(s++)->fn = code;
code = codeSnippet(
code, functionOffset++, vtableOffset,
NULL);
}
break;
case typelib_TypeClass_INTERFACE_METHOD:
(s++)->fn = code;
code = codeSnippet(
code, functionOffset++, vtableOffset,
reinterpret_cast< typelib_InterfaceMethodTypeDescription * >(
member)->pReturnTypeRef);
break;
default:
assert(false);
break;
}
TYPELIB_DANGER_RELEASE(member);
}
return code;
}
void bridges::cpp_uno::shared::VtableFactory::flushCode(
unsigned char const *, unsigned char const *)
{}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,45 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include <windows.h>
void dso_init();
void dso_exit();
extern "C" BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpvReserved)
{
switch(dwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hModule);
dso_init();
break;
case DLL_PROCESS_DETACH:
if (!lpvReserved)
dso_exit();
break;
}
return TRUE;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,293 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include <stdio.h>
#include <string.h>
#include <cxxabi.h>
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
#define _GLIBCXX_CDTOR_CALLABI
#endif
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <osl/mutex.hxx>
#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
#include <typelib/typedescription.hxx>
#include <uno/any2.h>
#include <unordered_map>
#include "share.hxx"
using namespace ::std;
using namespace ::osl;
using namespace ::com::sun::star::uno;
using namespace ::__cxxabiv1;
namespace CPPU_CURRENT_NAMESPACE
{
void dummy_can_throw_anything( char const * )
{
}
static OUString toUNOname( char const * p )
{
#if OSL_DEBUG_LEVEL > 1
char const * start = p;
#endif
// example: N3com3sun4star4lang24IllegalArgumentExceptionE
OUStringBuffer buf( 64 );
assert( 'N' == *p );
++p; // skip N
while ('E' != *p)
{
// read chars count
long n = (*p++ - '0');
while ('0' <= *p && '9' >= *p)
{
n *= 10;
n += (*p++ - '0');
}
buf.appendAscii( p, n );
p += n;
if ('E' != *p)
buf.append( '.' );
}
#if OSL_DEBUG_LEVEL > 1
OUString ret( buf.makeStringAndClear() );
OString c_ret( OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US ) );
fprintf( stderr, "> toUNOname(): %s => %s\n", start, c_ret.getStr() );
return ret;
#else
return buf.makeStringAndClear();
#endif
}
class RTTI
{
typedef std::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
t_rtti_map m_generatedRttis;
public:
RTTI();
~RTTI();
type_info * getRTTI( typelib_CompoundTypeDescription * );
};
RTTI::RTTI()
{
}
RTTI::~RTTI()
{
}
type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
{
type_info * rtti;
OUString const & unoName = *(OUString const *)&pTypeDescr->aBase.pTypeName;
MutexGuard guard( m_mutex );
t_rtti_map::const_iterator iRttiFind( m_rttis.find( unoName ) );
if (iRttiFind == m_rttis.end())
{
// RTTI symbol
OStringBuffer buf( 64 );
buf.append( "__ZTIN" );
sal_Int32 index = 0;
do
{
OUString token( unoName.getToken( 0, '.', index ) );
buf.append( token.getLength() );
OString c_token( OUStringToOString( token, RTL_TEXTENCODING_ASCII_US ) );
buf.append( c_token );
}
while (index >= 0);
buf.append( 'E' );
OString symName( buf.makeStringAndClear() );
// try to lookup the symbol in the generated rtti map
t_rtti_map::const_iterator iFind( m_generatedRttis.find( unoName ) );
if (iFind == m_generatedRttis.end())
{
// we must generate it !
// symbol and rtti-name is nearly identical,
// the symbol is prefixed with __ZTI
char const * rttiName = symName.getStr() +5;
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr,"generated rtti for %s\n", rttiName );
#endif
if (pTypeDescr->pBaseTypeDescription)
{
// ensure availability of base
type_info * base_rtti = getRTTI(
(typelib_CompoundTypeDescription *)pTypeDescr->pBaseTypeDescription );
rtti = new __si_class_type_info(
strdup( rttiName ), (__class_type_info *)base_rtti );
}
else
{
// this class has no base class
rtti = new __class_type_info( strdup( rttiName ) );
}
pair< t_rtti_map::iterator, bool > insertion(
m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
assert(insertion.second && "### inserting new generated rtti failed?!");
}
else // taking already generated rtti
{
rtti = iFind->second;
}
}
else
{
rtti = iRttiFind->second;
}
return rtti;
}
extern "C" {
static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
{
__cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
typelib_TypeDescription * pTD = 0;
OUString unoName( toUNOname( header->exceptionType->name() ) );
::typelib_typedescription_getByName( &pTD, unoName.pData );
assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
if (pTD)
{
::uno_destructData( pExc, pTD, cpp_release );
::typelib_typedescription_release( pTD );
}
}
}
void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
{
#if OSL_DEBUG_LEVEL > 1
OString cstr(
OUStringToOString(
OUString::unacquired( &pUnoExc->pType->pTypeName ),
RTL_TEXTENCODING_ASCII_US ) );
fprintf( stderr, "> uno exception occurred: %s\n", cstr.getStr() );
#endif
void * pCppExc;
type_info * rtti;
{
// construct cpp exception object
typelib_TypeDescription * pTypeDescr = 0;
TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType );
assert(pTypeDescr);
if (! pTypeDescr)
{
throw RuntimeException(
OUString("cannot get typedescription for type ") +
OUString::unacquired( &pUnoExc->pType->pTypeName ) );
}
pCppExc = __cxa_allocate_exception( pTypeDescr->nSize );
::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp );
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
static RTTI * s_rtti = 0;
if (! s_rtti)
{
MutexGuard guard( Mutex::getGlobalMutex() );
if (! s_rtti)
{
#ifdef LEAK_STATIC_DATA
s_rtti = new RTTI();
#else
static RTTI rtti_data;
s_rtti = &rtti_data;
#endif
}
}
rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
{
throw RuntimeException(
OUString("no rtti for type ") +
OUString::unacquired( &pUnoExc->pType->pTypeName ) );
}
}
__cxa_throw( pCppExc, rtti, deleteException );
}
void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno )
{
if (! header)
{
RuntimeException aRE( "no exception header!" );
Type const & rType = cppu::UnoType<decltype(aRE)>::get();
uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
SAL_WARN("bridges", aRE.Message);
return;
}
typelib_TypeDescription * pExcTypeDescr = 0;
OUString unoName( toUNOname( header->exceptionType->name() ) );
#if OSL_DEBUG_LEVEL > 1
OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) );
fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() );
#endif
typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
if (0 == pExcTypeDescr)
{
RuntimeException aRE( OUString("exception type not found: ") + unoName );
Type const & rType = cppu::UnoType<decltype(aRE)>::get();
uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
SAL_WARN("bridges", aRE.Message);
}
else
{
// construct uno exception any
uno_any_constructAndConvert( pUnoExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
typelib_typedescription_release( pExcTypeDescr );
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,95 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_INTEL_SHARE_HXX
#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_INTEL_SHARE_HXX
#include "uno/mapping.h"
#include <typeinfo>
#include <exception>
#include <cstddef>
#include "cppu/macros.hxx"
#include "uno/any2.h"
namespace CPPU_CURRENT_NAMESPACE
{
void dummy_can_throw_anything( char const * );
// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
struct _Unwind_Exception
{
unsigned exception_class __attribute__((__mode__(__DI__)));
void * exception_cleanup;
unsigned private_1 __attribute__((__mode__(__word__)));
unsigned private_2 __attribute__((__mode__(__word__)));
} __attribute__((__aligned__));
struct __cxa_exception
{
::std::type_info *exceptionType;
void (*exceptionDestructor)(void *);
::std::unexpected_handler unexpectedHandler;
::std::terminate_handler terminateHandler;
__cxa_exception *nextException;
int handlerCount;
int handlerSwitchValue;
const unsigned char *actionRecord;
const unsigned char *languageSpecificData;
void *catchTemp;
void *adjustedPtr;
_Unwind_Exception unwindHeader;
};
struct __cxa_eh_globals
{
__cxa_exception *caughtExceptions;
unsigned int uncaughtExceptions;
};
}
extern "C" void privateSnippetExecutorGeneral();
extern "C" void privateSnippetExecutorVoid();
extern "C" void privateSnippetExecutorHyper();
extern "C" void privateSnippetExecutorFloat();
extern "C" void privateSnippetExecutorDouble();
extern "C" void privateSnippetExecutorClass();
extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw();
namespace CPPU_CURRENT_NAMESPACE
{
void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
void fillUnoException(
__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,71 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include "types.hxx"
#include "typelib/typeclass.h"
#include "typelib/typedescription.h"
namespace bridges { namespace cpp_uno { namespace shared {
namespace {
bool isSimpleStruct(typelib_TypeDescription const * type) {
switch (type->eTypeClass) {
case typelib_TypeClass_STRUCT:
{
typelib_CompoundTypeDescription const * p
= reinterpret_cast< typelib_CompoundTypeDescription const * >(
type);
for (sal_Int32 i = 0; i < p->nMembers; ++i) {
switch (p->ppTypeRefs[i]->eTypeClass) {
case typelib_TypeClass_STRUCT:
{
typelib_TypeDescription * t = 0;
TYPELIB_DANGER_GET(&t, p->ppTypeRefs[i]);
bool b = isSimpleStruct(t);
TYPELIB_DANGER_RELEASE(t);
if (!b) {
return false;
}
}
break;
default:
if (!isSimpleType(p->ppTypeRefs[i]->eTypeClass))
return false;
break;
}
}
}
return true;
default:
return false;
}
}
}
bool isSmallStruct(typelib_TypeDescription const * type) {
return (type->nSize <= 8 && isSimpleStruct(type));
}
} } }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,32 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_INTEL_SMALLSTRUCT_HXX
#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_INTEL_SMALLSTRUCT_HXX
#include "typelib/typeclass.h"
#include "typelib/typedescription.h"
namespace bridges { namespace cpp_uno { namespace shared {
bool isSmallStruct(typelib_TypeDescription const * type);
} } }
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,378 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
#include <uno/data.h>
#include <sal/alloca.h>
#include "bridge.hxx"
#include "types.hxx"
#include "unointerfaceproxy.hxx"
#include "vtables.hxx"
#include "callvirtualmethod.hxx"
#include "share.hxx"
#include "smallstruct.hxx"
using namespace ::com::sun::star::uno;
namespace
{
static void cpp_call(
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
bridges::cpp_uno::shared::VtableSlot aVtableSlot,
typelib_TypeDescriptionReference * pReturnTypeRef,
sal_Int32 nParams, typelib_MethodParameter * pParams,
void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
{
// max space for: [complex ret ptr], values|ptr ...
char * pCppStack =
#ifdef BROKEN_ALLOCA
(char *)malloc( sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64)) );
#else
(char *)alloca( sizeof(sal_Int32) + ((nParams+2) * sizeof(sal_Int64)) );
#endif
char * pCppStackStart = pCppStack;
// return
typelib_TypeDescription * pReturnTypeDescr = 0;
TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
assert(pReturnTypeDescr);
void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion
if (pReturnTypeDescr)
{
if (bridges::cpp_uno::shared::isSimpleType( pReturnTypeDescr ))
{
pCppReturn = pUnoReturn; // direct way for simple types
}
else
{
// complex return via ptr
pCppReturn
= (bridges::cpp_uno::shared::relatesToInterfaceType(
pReturnTypeDescr )
#ifdef BROKEN_ALLOCA
? malloc( pReturnTypeDescr->nSize )
#else
? alloca( pReturnTypeDescr->nSize )
#endif
: pUnoReturn); // direct way
if (!bridges::cpp_uno::shared::isSmallStruct(pReturnTypeDescr)) {
*(void **)pCppStack = pCppReturn;
pCppStack += sizeof(void *);
}
}
}
// push this
void * pAdjustedThisPtr = reinterpret_cast< void ** >(pThis->getCppI())
+ aVtableSlot.offset;
*(void**)pCppStack = pAdjustedThisPtr;
pCppStack += sizeof( void* );
// stack space
static_assert(sizeof(void *) == sizeof(sal_Int32), "### unexpected size!");
// args
#ifdef BROKEN_ALLOCA
void ** pCppArgs = (void **)malloc( 3 * sizeof(void *) * nParams );
#else
void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams );
#endif
// indices of values this have to be converted (interface conversion cpp<=>uno)
sal_Int32 * pTempIndices = (sal_Int32 *)(pCppArgs + nParams);
// type descriptions for reconversions
typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
sal_Int32 nTempIndices = 0;
for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
{
const typelib_MethodParameter & rParam = pParams[nPos];
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
if (!rParam.bOut
&& bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
{
uno_copyAndConvertData( pCppArgs[nPos] = pCppStack, pUnoArgs[nPos], pParamTypeDescr,
pThis->getBridge()->getUno2Cpp() );
switch (pParamTypeDescr->eTypeClass)
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
case typelib_TypeClass_DOUBLE:
pCppStack += sizeof(sal_Int32); // extra long
break;
default:
break;
}
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
else // ptr to complex value | ref
{
if (! rParam.bIn) // is pure out
{
// cpp out is constructed mem, uno out is not!
uno_constructData(
#ifdef BROKEN_ALLOCA
*(void **)pCppStack = pCppArgs[nPos] = malloc( pParamTypeDescr->nSize ),
#else
*(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
#endif
pParamTypeDescr );
pTempIndices[nTempIndices] = nPos; // default constructed for cpp call
// will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
}
// is in/inout
else if (bridges::cpp_uno::shared::relatesToInterfaceType(
pParamTypeDescr ))
{
uno_copyAndConvertData(
#ifdef BROKEN_ALLOCA
*(void **)pCppStack = pCppArgs[nPos] = malloc( pParamTypeDescr->nSize ),
#else
*(void **)pCppStack = pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
#endif
pUnoArgs[nPos], pParamTypeDescr,
pThis->getBridge()->getUno2Cpp() );
pTempIndices[nTempIndices] = nPos; // has to be reconverted
// will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
}
else // direct way
{
*(void **)pCppStack = pCppArgs[nPos] = pUnoArgs[nPos];
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
}
pCppStack += sizeof(sal_Int32); // standard parameter length
}
try
{
assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" );
CPPU_CURRENT_NAMESPACE::callVirtualMethod(
pAdjustedThisPtr, aVtableSlot.index,
pCppReturn, pReturnTypeDescr,
(sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) );
// NO exception occurred...
*ppUnoExc = 0;
// reconvert temporary params
for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
if (pParams[nIndex].bIn)
{
if (pParams[nIndex].bOut) // inout
{
uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
pThis->getBridge()->getCpp2Uno() );
}
}
else // pure out
{
uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
pThis->getBridge()->getCpp2Uno() );
}
// destroy temp cpp param => cpp: every param was constructed
uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
#ifdef BROKEN_ALLOCA
free( pCppArgs[nIndex] );
#endif
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
// return value
if (pCppReturn && pUnoReturn != pCppReturn)
{
uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr,
pThis->getBridge()->getCpp2Uno() );
uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release );
}
}
catch (...)
{
// fill uno exception
fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
// temporary params
for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
// destroy temp cpp param => cpp: every param was constructed
uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndices], cpp_release );
TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
#ifdef BROKEN_ALLOCA
free( pCppArgs[nIndex] );
#endif
}
// return type
if (pReturnTypeDescr)
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
}
if (pCppReturn && pUnoReturn != pCppReturn)
{
#ifdef BROKEN_ALLOCA
free( pCppReturn );
#endif
}
#ifdef BROKEN_ALLOCA
free( pCppStackStart );
#endif
}
}
namespace bridges { namespace cpp_uno { namespace shared {
void unoInterfaceProxyDispatch(
uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
void * pReturn, void * pArgs[], uno_Any ** ppException )
{
// is my surrogate
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
= static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * >(pUnoI);
switch (pMemberDescr->eTypeClass)
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
VtableSlot aVtableSlot(
getVtableSlot(
reinterpret_cast<
typelib_InterfaceAttributeTypeDescription const * >(
pMemberDescr)));
if (pReturn)
{
// dependent dispatch
cpp_call(
pThis, aVtableSlot,
((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
0, 0, // no params
pReturn, pArgs, ppException );
}
else
{
// is SET
typelib_MethodParameter aParam;
aParam.pTypeRef =
((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
aParam.bIn = sal_True;
aParam.bOut = sal_False;
typelib_TypeDescriptionReference * pReturnTypeRef = 0;
OUString aVoidName("void");
typelib_typedescriptionreference_new(
&pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
// dependent dispatch
aVtableSlot.index += 1; // get, then set method
cpp_call(
pThis, aVtableSlot,
pReturnTypeRef,
1, &aParam,
pReturn, pArgs, ppException );
typelib_typedescriptionreference_release( pReturnTypeRef );
}
break;
}
case typelib_TypeClass_INTERFACE_METHOD:
{
VtableSlot aVtableSlot(
getVtableSlot(
reinterpret_cast<
typelib_InterfaceMethodTypeDescription const * >(
pMemberDescr)));
switch (aVtableSlot.index)
{
// standard calls
case 1: // acquire uno interface
(*pUnoI->acquire)( pUnoI );
*ppException = 0;
break;
case 2: // release uno interface
(*pUnoI->release)( pUnoI );
*ppException = 0;
break;
case 0: // queryInterface() opt
{
typelib_TypeDescription * pTD = 0;
TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
if (pTD)
{
uno_Interface * pInterface = 0;
(*pThis->pBridge->getUnoEnv()->getRegisteredInterface)(
pThis->pBridge->getUnoEnv(),
(void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
if (pInterface)
{
::uno_any_construct(
reinterpret_cast< uno_Any * >( pReturn ),
&pInterface, pTD, 0 );
(*pInterface->release)( pInterface );
TYPELIB_DANGER_RELEASE( pTD );
*ppException = 0;
break;
}
TYPELIB_DANGER_RELEASE( pTD );
}
} // else perform queryInterface()
default:
// dependent dispatch
cpp_call(
pThis, aVtableSlot,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
pReturn, pArgs, ppException );
}
break;
}
default:
{
::com::sun::star::uno::RuntimeException aExc(
OUString("illegal member type description!"),
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
// binary identical null reference
::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
}
}
}
} } }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-327
View File
@@ -1,327 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
// This is an implementation of the x86-64 ABI as described in 'System V
// Application Binary Interface, AMD64 Architecture Processor Supplement'
// (http://www.x86-64.org/documentation/abi-0.95.pdf)
//
// The code in this file is a modification of src/x86/ffi64.c from libffi
// (http://sources.redhat.com/libffi/) which is under the following license:
/* -----------------------------------------------------------------------
ffi.c - Copyright (c) 2002 Bo Thorsen <bo@suse.de>
x86-64 Foreign Function Interface
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------- */
#include "sal/config.h"
#include "abi.hxx"
#include <sal/log.hxx>
using namespace x86_64;
/* Register class used for passing given 64bit part of the argument.
These represent classes as documented by the PS ABI, with the exception
of SSESF, SSEDF classes, that are basically SSE class, just gcc will
use SF or DFmode move instead of DImode to avoid reformating penalties.
Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves
whenever possible (upper half does contain padding).
*/
enum x86_64_reg_class
{
X86_64_NO_CLASS,
X86_64_INTEGER_CLASS,
X86_64_INTEGERSI_CLASS,
X86_64_SSE_CLASS,
X86_64_SSESF_CLASS,
X86_64_SSEDF_CLASS,
X86_64_SSEUP_CLASS,
X86_64_X87_CLASS,
X86_64_X87UP_CLASS,
X86_64_MEMORY_CLASS
};
#define MAX_CLASSES 4
/* x86-64 register passing implementation. See x86-64 ABI for details. Goal
of this code is to classify each 8bytes of incoming argument by the register
class and assign registers accordingly. */
/* Return the union class of CLASS1 and CLASS2.
See the x86-64 PS ABI for details. */
static enum x86_64_reg_class
merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2)
throw ()
{
/* Rule #1: If both classes are equal, this is the resulting class. */
if (class1 == class2)
return class1;
/* Rule #2: If one of the classes is NO_CLASS, the resulting class is
the other class. */
if (class1 == X86_64_NO_CLASS)
return class2;
if (class2 == X86_64_NO_CLASS)
return class1;
/* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */
if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS)
return X86_64_MEMORY_CLASS;
/* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */
if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS)
|| (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS))
return X86_64_INTEGERSI_CLASS;
if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS
|| class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS)
return X86_64_INTEGER_CLASS;
/* Rule #5: If one of the classes is X87 or X87UP class, MEMORY is used. */
if (class1 == X86_64_X87_CLASS || class1 == X86_64_X87UP_CLASS
|| class2 == X86_64_X87_CLASS || class2 == X86_64_X87UP_CLASS)
return X86_64_MEMORY_CLASS;
/* Rule #6: Otherwise class SSE is used. */
return X86_64_SSE_CLASS;
}
/* Classify the argument of type TYPE and mode MODE.
CLASSES will be filled by the register class used to pass each word
of the operand. The number of words is returned. In case the parameter
should be passed in memory, 0 is returned. As a special case for zero
sized containers, classes[0] will be NO_CLASS and 1 is returned.
See the x86-64 PS ABI for details.
*/
static int
classify_argument( typelib_TypeDescriptionReference *pTypeRef, enum x86_64_reg_class classes[], int byteOffset ) throw ()
{
switch ( pTypeRef->eTypeClass )
{
case typelib_TypeClass_VOID:
classes[0] = X86_64_NO_CLASS;
return 1;
case typelib_TypeClass_CHAR:
case typelib_TypeClass_BOOLEAN:
case typelib_TypeClass_BYTE:
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
case typelib_TypeClass_ENUM:
if ( ( byteOffset % 8 + pTypeRef->pType->nSize ) <= 4 )
classes[0] = X86_64_INTEGERSI_CLASS;
else
classes[0] = X86_64_INTEGER_CLASS;
return 1;
case typelib_TypeClass_FLOAT:
if ( ( byteOffset % 8 ) == 0 )
classes[0] = X86_64_SSESF_CLASS;
else
classes[0] = X86_64_SSE_CLASS;
return 1;
case typelib_TypeClass_DOUBLE:
classes[0] = X86_64_SSEDF_CLASS;
return 1;
/*case LONGDOUBLE:
classes[0] = X86_64_X87_CLASS;
classes[1] = X86_64_X87UP_CLASS;
return 2;*/
case typelib_TypeClass_STRING:
case typelib_TypeClass_TYPE:
case typelib_TypeClass_ANY:
case typelib_TypeClass_TYPEDEF:
case typelib_TypeClass_SEQUENCE:
case typelib_TypeClass_INTERFACE:
return 0;
case typelib_TypeClass_STRUCT:
case typelib_TypeClass_EXCEPTION:
{
typelib_TypeDescription * pTypeDescr = 0;
TYPELIB_DANGER_GET( &pTypeDescr, pTypeRef );
const int UNITS_PER_WORD = 8;
int words = ( pTypeDescr->nSize + UNITS_PER_WORD - 1 ) / UNITS_PER_WORD;
enum x86_64_reg_class subclasses[MAX_CLASSES];
/* If the struct is larger than 16 bytes, pass it on the stack. */
if ( pTypeDescr->nSize > 16 )
{
TYPELIB_DANGER_RELEASE( pTypeDescr );
return 0;
}
for ( int i = 0; i < words; i++ )
classes[i] = X86_64_NO_CLASS;
const typelib_CompoundTypeDescription *pStruct = reinterpret_cast<const typelib_CompoundTypeDescription*>( pTypeDescr );
/* Merge the fields of structure. */
for ( sal_Int32 nMember = 0; nMember < pStruct->nMembers; ++nMember )
{
typelib_TypeDescriptionReference *pTypeInStruct = pStruct->ppTypeRefs[ nMember ];
int offset = byteOffset + pStruct->pMemberOffsets[ nMember ];
int num = classify_argument( pTypeInStruct, subclasses, offset );
if ( num == 0 )
{
TYPELIB_DANGER_RELEASE( pTypeDescr );
return 0;
}
for ( int i = 0; i < num; i++ )
{
int pos = offset / 8;
classes[i + pos] = merge_classes( subclasses[i], classes[i + pos] );
}
}
TYPELIB_DANGER_RELEASE( pTypeDescr );
/* Final merger cleanup. */
for ( int i = 0; i < words; i++ )
{
/* If one class is MEMORY, everything should be passed in
memory. */
if ( classes[i] == X86_64_MEMORY_CLASS )
return 0;
/* The X86_64_SSEUP_CLASS should be always preceded by
X86_64_SSE_CLASS. */
if ( classes[i] == X86_64_SSEUP_CLASS
&& ( i == 0 || classes[i - 1] != X86_64_SSE_CLASS ) )
classes[i] = X86_64_SSE_CLASS;
/* X86_64_X87UP_CLASS should be preceded by X86_64_X87_CLASS. */
if ( classes[i] == X86_64_X87UP_CLASS
&& ( i == 0 || classes[i - 1] != X86_64_X87_CLASS ) )
classes[i] = X86_64_SSE_CLASS;
}
return words;
}
default:
SAL_WARN("bridges", "Unhandled case: pType->eTypeClass == "
<< pTypeRef->eTypeClass);
assert(false);
}
return 0; /* Never reached. */
}
/* Examine the argument and return set number of register required in each
class. Return 0 iff parameter should be passed in memory. */
bool x86_64::examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE ) throw ()
{
enum x86_64_reg_class classes[MAX_CLASSES];
int n;
n = classify_argument( pTypeRef, classes, 0 );
if ( n == 0 )
return false;
nUsedGPR = 0;
nUsedSSE = 0;
for ( n--; n >= 0; n-- )
switch ( classes[n] )
{
case X86_64_INTEGER_CLASS:
case X86_64_INTEGERSI_CLASS:
nUsedGPR++;
break;
case X86_64_SSE_CLASS:
case X86_64_SSESF_CLASS:
case X86_64_SSEDF_CLASS:
nUsedSSE++;
break;
case X86_64_NO_CLASS:
case X86_64_SSEUP_CLASS:
break;
case X86_64_X87_CLASS:
case X86_64_X87UP_CLASS:
if ( !bInReturn )
return false;
break;
default:
SAL_WARN("bridges", "Unhandled case: classes[n] == " << classes[n]);
assert(false);
}
return true;
}
bool x86_64::return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef ) throw ()
{
int g, s;
return examine_argument( pTypeRef, true, g, s ) == 0;
}
void x86_64::fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64 *pGPR, const double *pSSE, void *pStruct ) throw ()
{
enum x86_64_reg_class classes[MAX_CLASSES];
int n;
n = classify_argument( pTypeRef, classes, 0 );
sal_uInt64 *pStructAlign = reinterpret_cast<sal_uInt64 *>( pStruct );
for ( n--; n >= 0; n-- )
switch ( classes[n] )
{
case X86_64_INTEGER_CLASS:
case X86_64_INTEGERSI_CLASS:
*pStructAlign++ = *pGPR++;
break;
case X86_64_SSE_CLASS:
case X86_64_SSESF_CLASS:
case X86_64_SSEDF_CLASS:
*pStructAlign++ = *reinterpret_cast<const sal_uInt64 *>( pSSE++ );
break;
default:
break;
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,61 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_X86_64_ABI_HXX
#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_X86_64_ABI_HXX
// This is an implementation of the x86-64 ABI as described in 'System V
// Application Binary Interface, AMD64 Architecture Processor Supplement'
// (http://www.x86-64.org/documentation/abi-0.95.pdf)
#include <typelib/typedescription.hxx>
namespace x86_64
{
/* 6 general purpose registers are used for parameter passing */
const sal_uInt32 MAX_GPR_REGS = 6;
/* 8 SSE registers are used for parameter passing */
const sal_uInt32 MAX_SSE_REGS = 8;
/* Count number of required registers.
Examine the argument and return set number of register required in each
class.
Return false iff parameter should be passed in memory.
*/
bool examine_argument( typelib_TypeDescriptionReference *pTypeRef, bool bInReturn, int &nUsedGPR, int &nUsedSSE ) throw ();
/** Does function that returns this type use a hidden parameter, or registers?
The value can be returned either in a hidden 1st parameter (which is a
pointer to a structure allocated by the caller), or in registers (rax, rdx
for the integers, xmm0, xmm1 for the floating point numbers).
*/
bool return_in_hidden_param( typelib_TypeDescriptionReference *pTypeRef ) throw ();
void fill_struct( typelib_TypeDescriptionReference *pTypeRef, const sal_uInt64* pGPR, const double* pSSE, void *pStruct ) throw ();
} // namespace x86_64
#endif // INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_X86_64_ABI_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-115
View File
@@ -1,115 +0,0 @@
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
.text
.align 2
.globl privateSnippetExecutor
privateSnippetExecutor:
.LFB3:
pushq %rbp
.LCFI0:
movq %rsp, %rbp
.LCFI1:
subq $160, %rsp
.LCFI2:
movq %r10, -152(%rbp) # Save (nVtableOffset << 32) + nFunctionIndex
movq %rdi, -112(%rbp) # Save GP registers
movq %rsi, -104(%rbp)
movq %rdx, -96(%rbp)
movq %rcx, -88(%rbp)
movq %r8 , -80(%rbp)
movq %r9 , -72(%rbp)
movsd %xmm0, -64(%rbp) # Save FP registers
movsd %xmm1, -56(%rbp)
movsd %xmm2, -48(%rbp)
movsd %xmm3, -40(%rbp)
movsd %xmm4, -32(%rbp)
movsd %xmm5, -24(%rbp)
movsd %xmm6, -16(%rbp)
movsd %xmm7, -8(%rbp)
leaq -144(%rbp), %r9 # 6th param: sal_uInt64 * pRegisterReturn
leaq 16(%rbp), %r8 # 5rd param: void ** ovrflw
leaq -64(%rbp), %rcx # 4th param: void ** fpreg
leaq -112(%rbp), %rdx # 3rd param: void ** gpreg
movl -148(%rbp), %esi # 2nd param: sal_int32 nVtableOffset
movl -152(%rbp), %edi # 1st param: sal_int32 nFunctionIndex
call cpp_vtable_call
cmp $10, %rax # typelib_TypeClass_FLOAT
je .Lfloat
cmp $11, %rax # typelib_TypeClass_DOUBLE
je .Lfloat
movq -144(%rbp), %rax # Return value (int case)
movq -136(%rbp), %rdx # Return value (int case)
movq -144(%rbp), %xmm0 # Return value (int case)
movq -136(%rbp), %xmm1 # Return value (int case)
jmp .Lfinish
.Lfloat:
movlpd -144(%rbp), %xmm0 # Return value (float/double case)
.Lfinish:
leave
ret
.LFE3:
.long .-privateSnippetExecutor
# see http://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
# for details of the .eh_frame, the "Common Information Entry" and "Frame Description Entry" formats
# and http://mentorembedded.github.io/cxx-abi/exceptions.pdf for more info
.section .eh_frame,"a"
.Lframe1:
.long .LECIE1-.LSCIE1
.LSCIE1:
.long 0x0
.byte 0x1
.string "zR"
.uleb128 0x1
.sleb128 -8
.byte 0x10
.uleb128 0x1
.byte 0x1b
.byte 0xc
.uleb128 0x7
.uleb128 0x8
.byte 0x90
.uleb128 0x1
.align 8
.LECIE1:
.LSFDE1:
.long .LEFDE1-.LASFDE1
.LASFDE1:
.long .LASFDE1-.Lframe1
.long .LFB3-.
.long .LFE3-.LFB3
.uleb128 0x0
.byte 0x4
.long .LCFI0-.LFB3
.byte 0xe
.uleb128 0x10
.byte 0x86
.uleb128 0x2
.byte 0x4
.long .LCFI1-.LCFI0
.byte 0xd
.uleb128 0x6
.align 8
.LEFDE1:
@@ -1,166 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include "sal/config.h"
#include <cstring>
#include "cppu/macros.hxx"
#include "sal/types.h"
#include "typelib/typeclass.h"
#include "typelib/typedescription.h"
#include "abi.hxx"
#include "callvirtualmethod.hxx"
// The call instruction within the asm block of callVirtualMethod may throw
// exceptions. At least GCC 4.7.0 with -O0 would create (unnecessary)
// .gcc_exception_table call-site table entries around all other calls in this
// function that can throw, leading to std::terminate if the asm call throws an
// exception and the unwinding C++ personality routine finds the unexpected hole
// in the .gcc_exception_table. Therefore, make sure this function explicitly
// only calls nothrow-functions (so GCC 4.7.0 with -O0 happens to not create a
// .gcc_exception_table section at all for this function). For some reason,
// this also needs to be in a source file of its own.
//
// Also, this file should be compiled with -fnon-call-exceptions, and ideally
// there would be a way to tell the compiler that the asm block contains calls
// to functions that can potentially throw; see the mail thread starting at
// <http://gcc.gnu.org/ml/gcc/2012-03/msg00454.html> "C++: Letting compiler know
// asm block can call function that can throw?"
void CPPU_CURRENT_NAMESPACE::callVirtualMethod(
void * pThis, sal_uInt32 nVtableIndex, void * pRegisterReturn,
typelib_TypeDescriptionReference * pReturnTypeRef, bool bSimpleReturn,
sal_uInt64 *pStack, sal_uInt32 nStack, sal_uInt64 *pGPR, sal_uInt32 nGPR,
double * pFPR, sal_uInt32 nFPR)
{
// Should not happen, but...
if ( nFPR > x86_64::MAX_SSE_REGS )
nFPR = x86_64::MAX_SSE_REGS;
if ( nGPR > x86_64::MAX_GPR_REGS )
nGPR = x86_64::MAX_GPR_REGS;
// Get pointer to method
sal_uInt64 pMethod = *((sal_uInt64 *)pThis);
pMethod += 8 * nVtableIndex;
pMethod = *((sal_uInt64 *)pMethod);
// Load parameters to stack, if necessary
sal_uInt64* pCallStack = NULL;
if ( nStack )
{
// 16-bytes aligned
sal_uInt32 nStackBytes = ( ( nStack + 1 ) >> 1 ) * 16;
pCallStack = (sal_uInt64 *) __builtin_alloca( nStackBytes );
std::memcpy( pCallStack, pStack, nStackBytes );
}
// Return values
sal_uInt64 rax;
sal_uInt64 rdx;
double xmm0;
double xmm1;
asm volatile (
// Fill the xmm registers
"movq %6, %%rax\n\t"
"movsd (%%rax), %%xmm0\n\t"
"movsd 8(%%rax), %%xmm1\n\t"
"movsd 16(%%rax), %%xmm2\n\t"
"movsd 24(%%rax), %%xmm3\n\t"
"movsd 32(%%rax), %%xmm4\n\t"
"movsd 40(%%rax), %%xmm5\n\t"
"movsd 48(%%rax), %%xmm6\n\t"
"movsd 56(%%rax), %%xmm7\n\t"
// Fill the general purpose registers
"movq %5, %%rax\n\t"
"movq (%%rax), %%rdi\n\t"
"movq 8(%%rax), %%rsi\n\t"
"movq 16(%%rax), %%rdx\n\t"
"movq 24(%%rax), %%rcx\n\t"
"movq 32(%%rax), %%r8\n\t"
"movq 40(%%rax), %%r9\n\t"
// Perform the call
"movq %4, %%r11\n\t"
"movq %7, %%rax\n\t"
"call *%%r11\n\t"
// Fill the return values
"movq %%rax, %0\n\t"
"movq %%rdx, %1\n\t"
"movsd %%xmm0, %2\n\t"
"movsd %%xmm1, %3\n\t"
: "=m" ( rax ), "=m" ( rdx ), "=m" ( xmm0 ), "=m" ( xmm1 )
: "m" ( pMethod ), "m" ( pGPR ), "m" ( pFPR ), "m" ( nFPR ),
"m" ( pCallStack ) // dummy input to prevent the compiler from optimizing the alloca out
: "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r10", "r11",
"xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7",
"xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15"
);
switch (pReturnTypeRef->eTypeClass)
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
*reinterpret_cast<sal_uInt64 *>( pRegisterReturn ) = rax;
break;
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM:
*reinterpret_cast<sal_uInt32 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt32*>( &rax );
break;
case typelib_TypeClass_CHAR:
case typelib_TypeClass_SHORT:
case typelib_TypeClass_UNSIGNED_SHORT:
*reinterpret_cast<sal_uInt16 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt16*>( &rax );
break;
case typelib_TypeClass_BOOLEAN:
case typelib_TypeClass_BYTE:
*reinterpret_cast<sal_uInt8 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt8*>( &rax );
break;
case typelib_TypeClass_FLOAT:
case typelib_TypeClass_DOUBLE:
*reinterpret_cast<double *>( pRegisterReturn ) = xmm0;
break;
default:
{
sal_Int32 const nRetSize = pReturnTypeRef->pType->nSize;
if (bSimpleReturn && nRetSize <= 16 && nRetSize > 0)
{
sal_uInt64 longs[2];
longs[0] = rax;
longs[1] = rdx;
double doubles[2];
doubles[0] = xmm0;
doubles[1] = xmm1;
x86_64::fill_struct( pReturnTypeRef, &longs[0], &doubles[0], pRegisterReturn);
}
break;
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,41 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_X86_64_CALLVIRTUALMETHOD_HXX
#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_X86_64_CALLVIRTUALMETHOD_HXX
#include "sal/config.h"
#include "cppu/macros.hxx"
#include "sal/types.h"
#include "typelib/typedescription.h"
namespace CPPU_CURRENT_NAMESPACE {
void callVirtualMethod(
void * pThis, sal_uInt32 nVtableIndex, void * pRegisterReturn,
typelib_TypeDescriptionReference * pReturnTypeRef, bool bSimpleReturn,
sal_uInt64 *pStack, sal_uInt32 nStack, sal_uInt64 *pGPR, sal_uInt32 nGPR,
double * pFPR, sal_uInt32 nFPR);
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,512 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include <stdio.h>
#include <stdlib.h>
#include <rtl/alloc.h>
#include <sal/log.hxx>
#include <osl/mutex.hxx>
#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
#include <uno/data.h>
#include <typelib/typedescription.hxx>
#include "bridge.hxx"
#include "cppinterfaceproxy.hxx"
#include "types.hxx"
#include "vtablefactory.hxx"
#include "abi.hxx"
#include "share.hxx"
using namespace ::osl;
using namespace ::com::sun::star::uno;
// Perform the UNO call
//
// We must convert the parameters stored in gpreg, fpreg and ovrflw to UNO
// arguments and call pThis->getUnoI()->pDispatcher.
//
// gpreg: [ret *], this, [gpr params]
// fpreg: [fpr params]
// ovrflw: [gpr or fpr params (properly aligned)]
//
// [ret *] is present when we are returning a structure bigger than 16 bytes
// Simple types are returned in rax, rdx (int), or xmm0, xmm1 (fp).
// Similarly structures <= 16 bytes are in rax, rdx, xmm0, xmm1 as necessary.
static typelib_TypeClass cpp2uno_call(
bridges::cpp_uno::shared::CppInterfaceProxy * pThis,
const typelib_TypeDescription * pMemberTypeDescr,
typelib_TypeDescriptionReference * pReturnTypeRef, // 0 indicates void return
sal_Int32 nParams, typelib_MethodParameter * pParams,
void ** gpreg, void ** fpreg, void ** ovrflw,
sal_uInt64 * pRegisterReturn /* space for register return */ )
{
unsigned int nr_gpr = 0; //number of gpr registers used
unsigned int nr_fpr = 0; //number of fpr registers used
// return
typelib_TypeDescription * pReturnTypeDescr = 0;
if (pReturnTypeRef)
TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
void * pUnoReturn = 0;
void * pCppReturn = 0; // complex return ptr: if != 0 && != pUnoReturn, reconversion need
if ( pReturnTypeDescr )
{
if ( x86_64::return_in_hidden_param( pReturnTypeRef ) )
{
pCppReturn = *gpreg++;
nr_gpr++;
pUnoReturn = ( bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )
? alloca( pReturnTypeDescr->nSize )
: pCppReturn ); // direct way
}
else
pUnoReturn = pRegisterReturn; // direct way for simple types
}
// pop this
gpreg++;
nr_gpr++;
// stack space
// parameters
void ** pUnoArgs = (void **)alloca( 4 * sizeof(void *) * nParams );
void ** pCppArgs = pUnoArgs + nParams;
// indices of values this have to be converted (interface conversion cpp<=>uno)
sal_Int32 * pTempIndices = (sal_Int32 *)(pUnoArgs + (2 * nParams));
// type descriptions for reconversions
typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pUnoArgs + (3 * nParams));
sal_Int32 nTempIndices = 0;
for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
{
const typelib_MethodParameter & rParam = pParams[nPos];
int nUsedGPR = 0;
int nUsedSSE = 0;
#if OSL_DEBUG_LEVEL > 0
bool bFitsRegisters =
#endif
x86_64::examine_argument( rParam.pTypeRef, false, nUsedGPR, nUsedSSE );
if ( !rParam.bOut && bridges::cpp_uno::shared::isSimpleType( rParam.pTypeRef ) ) // value
{
// Simple types must fit exactly one register on x86_64
assert( bFitsRegisters && ( ( nUsedSSE == 1 && nUsedGPR == 0 ) || ( nUsedSSE == 0 && nUsedGPR == 1 ) ) );
if ( nUsedSSE == 1 )
{
if ( nr_fpr < x86_64::MAX_SSE_REGS )
{
pCppArgs[nPos] = pUnoArgs[nPos] = fpreg++;
nr_fpr++;
}
else
pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw++;
}
else if ( nUsedGPR == 1 )
{
if ( nr_gpr < x86_64::MAX_GPR_REGS )
{
pCppArgs[nPos] = pUnoArgs[nPos] = gpreg++;
nr_gpr++;
}
else
pCppArgs[nPos] = pUnoArgs[nPos] = ovrflw++;
}
}
else // struct <= 16 bytes || ptr to complex value || ref
{
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
void *pCppStack;
if ( nr_gpr < x86_64::MAX_GPR_REGS )
{
pCppArgs[nPos] = pCppStack = *gpreg++;
nr_gpr++;
}
else
pCppArgs[nPos] = pCppStack = *ovrflw++;
if (! rParam.bIn) // is pure out
{
// uno out is unconstructed mem!
pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize );
pTempIndices[nTempIndices] = nPos;
// will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
}
else if ( bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ) ) // is in/inout
{
uno_copyAndConvertData( pUnoArgs[nPos] = alloca( pParamTypeDescr->nSize ),
pCppStack, pParamTypeDescr,
pThis->getBridge()->getCpp2Uno() );
pTempIndices[nTempIndices] = nPos; // has to be reconverted
// will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
}
else // direct way
{
pUnoArgs[nPos] = pCppStack;
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
}
}
// ExceptionHolder
uno_Any aUnoExc; // Any will be constructed by callee
uno_Any * pUnoExc = &aUnoExc;
// invoke uno dispatch call
(*pThis->getUnoI()->pDispatcher)( pThis->getUnoI(), pMemberTypeDescr, pUnoReturn, pUnoArgs, &pUnoExc );
// in case an exception occurred...
if ( pUnoExc )
{
// destruct temporary in/inout params
for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
if (pParams[nIndex].bIn) // is in/inout => was constructed
uno_destructData( pUnoArgs[nIndex], ppTempParamTypeDescr[nTempIndices], 0 );
TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
}
if (pReturnTypeDescr)
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
CPPU_CURRENT_NAMESPACE::raiseException( &aUnoExc, pThis->getBridge()->getUno2Cpp() ); // has to destruct the any
// is here for dummy
return typelib_TypeClass_VOID;
}
else // else no exception occurred...
{
// temporary params
for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
if ( pParams[nIndex].bOut ) // inout/out
{
// convert and assign
uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
uno_copyAndConvertData( pCppArgs[nIndex], pUnoArgs[nIndex], pParamTypeDescr,
pThis->getBridge()->getUno2Cpp() );
}
// destroy temp uno param
uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 );
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
// return
if ( pCppReturn ) // has complex return
{
if ( pUnoReturn != pCppReturn ) // needs reconversion
{
uno_copyAndConvertData( pCppReturn, pUnoReturn, pReturnTypeDescr,
pThis->getBridge()->getUno2Cpp() );
// destroy temp uno return
uno_destructData( pUnoReturn, pReturnTypeDescr, 0 );
}
// complex return ptr is set to return reg
*(void **)pRegisterReturn = pCppReturn;
}
if ( pReturnTypeDescr )
{
typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
return eRet;
}
else
return typelib_TypeClass_VOID;
}
}
extern "C" typelib_TypeClass cpp_vtable_call(
sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
void ** gpreg, void ** fpreg, void ** ovrflw,
sal_uInt64 * pRegisterReturn /* space for register return */ )
{
// gpreg: [ret *], this, [other gpr params]
// fpreg: [fpr params]
// ovrflw: [gpr or fpr params (properly aligned)]
void * pThis;
if ( nFunctionIndex & 0x80000000 )
{
nFunctionIndex &= 0x7fffffff;
pThis = gpreg[1];
}
else
{
pThis = gpreg[0];
}
pThis = static_cast<char *>( pThis ) - nVtableOffset;
bridges::cpp_uno::shared::CppInterfaceProxy * pCppI =
bridges::cpp_uno::shared::CppInterfaceProxy::castInterfaceToProxy( pThis );
typelib_InterfaceTypeDescription * pTypeDescr = pCppI->getTypeDescr();
if ( nFunctionIndex >= pTypeDescr->nMapFunctionIndexToMemberIndex )
{
SAL_WARN(
"bridges",
"illegal " << OUString::unacquired(&pTypeDescr->aBase.pTypeName)
<< " vtable index " << nFunctionIndex << "/"
<< pTypeDescr->nMapFunctionIndexToMemberIndex);
throw RuntimeException(
("illegal " + OUString::unacquired(&pTypeDescr->aBase.pTypeName)
+ " vtable index " + OUString::number(nFunctionIndex) + "/"
+ OUString::number(pTypeDescr->nMapFunctionIndexToMemberIndex)),
reinterpret_cast<XInterface *>( pCppI ) );
}
// determine called method
sal_Int32 nMemberPos = pTypeDescr->pMapFunctionIndexToMemberIndex[nFunctionIndex];
assert(nMemberPos < pTypeDescr->nAllMembers);
TypeDescription aMemberDescr( pTypeDescr->ppAllMembers[nMemberPos] );
typelib_TypeClass eRet;
switch ( aMemberDescr.get()->eTypeClass )
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
typelib_TypeDescriptionReference *pAttrTypeRef =
reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( aMemberDescr.get() )->pAttributeTypeRef;
if ( pTypeDescr->pMapMemberIndexToFunctionIndex[nMemberPos] == nFunctionIndex )
{
// is GET method
eRet = cpp2uno_call( pCppI, aMemberDescr.get(), pAttrTypeRef,
0, 0, // no params
gpreg, fpreg, ovrflw, pRegisterReturn );
}
else
{
// is SET method
typelib_MethodParameter aParam;
aParam.pTypeRef = pAttrTypeRef;
aParam.bIn = sal_True;
aParam.bOut = sal_False;
eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
0, // indicates void return
1, &aParam,
gpreg, fpreg, ovrflw, pRegisterReturn );
}
break;
}
case typelib_TypeClass_INTERFACE_METHOD:
{
// is METHOD
switch ( nFunctionIndex )
{
case 1: // acquire()
pCppI->acquireProxy(); // non virtual call!
eRet = typelib_TypeClass_VOID;
break;
case 2: // release()
pCppI->releaseProxy(); // non virtual call!
eRet = typelib_TypeClass_VOID;
break;
case 0: // queryInterface() opt
{
typelib_TypeDescription * pTD = 0;
TYPELIB_DANGER_GET( &pTD, reinterpret_cast<Type *>( gpreg[2] )->getTypeLibType() );
if ( pTD )
{
XInterface * pInterface = 0;
(*pCppI->getBridge()->getCppEnv()->getRegisteredInterface)
( pCppI->getBridge()->getCppEnv(),
(void **)&pInterface,
pCppI->getOid().pData,
reinterpret_cast<typelib_InterfaceTypeDescription *>( pTD ) );
if ( pInterface )
{
::uno_any_construct( reinterpret_cast<uno_Any *>( gpreg[0] ),
&pInterface, pTD, cpp_acquire );
pInterface->release();
TYPELIB_DANGER_RELEASE( pTD );
reinterpret_cast<void **>( pRegisterReturn )[0] = gpreg[0];
eRet = typelib_TypeClass_ANY;
break;
}
TYPELIB_DANGER_RELEASE( pTD );
}
} // else perform queryInterface()
default:
{
typelib_InterfaceMethodTypeDescription *pMethodTD =
reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( aMemberDescr.get() );
eRet = cpp2uno_call( pCppI, aMemberDescr.get(),
pMethodTD->pReturnTypeRef,
pMethodTD->nParams,
pMethodTD->pParams,
gpreg, fpreg, ovrflw, pRegisterReturn );
}
}
break;
}
default:
{
throw RuntimeException("no member description found!",
reinterpret_cast<XInterface *>( pCppI ) );
}
}
return eRet;
}
const int codeSnippetSize = 24;
// Generate a trampoline that redirects method calls to
// privateSnippetExecutor().
//
// privateSnippetExecutor() saves all the registers that are used for
// parameter passing on x86_64, and calls the cpp_vtable_call().
// When it returns, privateSnippetExecutor() sets the return value.
//
// Note: The code snippet we build here must not create a stack frame,
// otherwise the UNO exceptions stop working thanks to non-existing
// unwinding info.
unsigned char * codeSnippet( unsigned char * code,
sal_Int32 nFunctionIndex, sal_Int32 nVtableOffset,
bool bHasHiddenParam )
{
sal_uInt64 nOffsetAndIndex = ( ( (sal_uInt64) nVtableOffset ) << 32 ) | ( (sal_uInt64) nFunctionIndex );
if ( bHasHiddenParam )
nOffsetAndIndex |= 0x80000000;
// movq $<nOffsetAndIndex>, %r10
*reinterpret_cast<sal_uInt16 *>( code ) = 0xba49;
*reinterpret_cast<sal_uInt64 *>( code + 2 ) = nOffsetAndIndex;
// movq $<address of the privateSnippetExecutor>, %r11
*reinterpret_cast<sal_uInt16 *>( code + 10 ) = 0xbb49;
*reinterpret_cast<sal_uInt64 *>( code + 12 ) = reinterpret_cast<sal_uInt64>( privateSnippetExecutor );
// jmpq *%r11
*reinterpret_cast<sal_uInt32 *>( code + 20 ) = 0x00e3ff49;
#if OSL_DEBUG_LEVEL > 1
fprintf(stderr,
"==> codeSnippet, functionIndex=%d%s, vtableOffset=%d\n",
nFunctionIndex, (bHasHiddenParam ? "|0x80000000":""), nVtableOffset);
#endif
return code + codeSnippetSize;
}
struct bridges::cpp_uno::shared::VtableFactory::Slot { void * fn; };
bridges::cpp_uno::shared::VtableFactory::Slot *
bridges::cpp_uno::shared::VtableFactory::mapBlockToVtable(void * block)
{
return static_cast< Slot * >(block) + 2;
}
std::size_t bridges::cpp_uno::shared::VtableFactory::getBlockSize(
sal_Int32 slotCount)
{
return (slotCount + 2) * sizeof (Slot) + slotCount * codeSnippetSize;
}
bridges::cpp_uno::shared::VtableFactory::Slot *
bridges::cpp_uno::shared::VtableFactory::initializeBlock(
void * block, sal_Int32 slotCount, sal_Int32,
typelib_InterfaceTypeDescription *)
{
Slot * slots = mapBlockToVtable(block);
slots[-2].fn = 0;
slots[-1].fn = 0;
return slots + slotCount;
}
unsigned char * bridges::cpp_uno::shared::VtableFactory::addLocalFunctions(
Slot ** slots, unsigned char * code, typelib_InterfaceTypeDescription const * type,
sal_Int32 nFunctionOffset, sal_Int32 functionCount, sal_Int32 nVtableOffset )
{
(*slots) -= functionCount;
Slot * s = *slots;
for ( sal_Int32 nPos = 0; nPos < type->nMembers; ++nPos )
{
typelib_TypeDescription * pTD = 0;
TYPELIB_DANGER_GET( &pTD, type->ppMembers[ nPos ] );
assert(pTD);
if ( typelib_TypeClass_INTERFACE_ATTRIBUTE == pTD->eTypeClass )
{
typelib_InterfaceAttributeTypeDescription *pAttrTD =
reinterpret_cast<typelib_InterfaceAttributeTypeDescription *>( pTD );
// get method
(s++)->fn = code;
code = codeSnippet( code, nFunctionOffset++, nVtableOffset,
x86_64::return_in_hidden_param( pAttrTD->pAttributeTypeRef ) );
if ( ! pAttrTD->bReadOnly )
{
// set method
(s++)->fn = code;
code = codeSnippet( code, nFunctionOffset++, nVtableOffset, false );
}
}
else if ( typelib_TypeClass_INTERFACE_METHOD == pTD->eTypeClass )
{
typelib_InterfaceMethodTypeDescription *pMethodTD =
reinterpret_cast<typelib_InterfaceMethodTypeDescription *>( pTD );
(s++)->fn = code;
code = codeSnippet( code, nFunctionOffset++, nVtableOffset,
x86_64::return_in_hidden_param( pMethodTD->pReturnTypeRef ) );
}
else
assert(false);
TYPELIB_DANGER_RELEASE( pTD );
}
return code;
}
void bridges::cpp_uno::shared::VtableFactory::flushCode(
SAL_UNUSED_PARAMETER unsigned char const *,
SAL_UNUSED_PARAMETER unsigned char const * )
{}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,293 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include <stdio.h>
#include <string.h>
#include <cxxabi.h>
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
#define _GLIBCXX_CDTOR_CALLABI
#endif
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <osl/mutex.hxx>
#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
#include <typelib/typedescription.hxx>
#include <uno/any2.h>
#include <unordered_map>
#include "share.hxx"
using namespace ::std;
using namespace ::osl;
using namespace ::com::sun::star::uno;
using namespace ::__cxxabiv1;
namespace CPPU_CURRENT_NAMESPACE
{
void dummy_can_throw_anything( char const * )
{
}
static OUString toUNOname( char const * p )
{
#if OSL_DEBUG_LEVEL > 1
char const * start = p;
#endif
// example: N3com3sun4star4lang24IllegalArgumentExceptionE
OUStringBuffer buf( 64 );
assert( 'N' == *p );
++p; // skip N
while ('E' != *p)
{
// read chars count
long n = (*p++ - '0');
while ('0' <= *p && '9' >= *p)
{
n *= 10;
n += (*p++ - '0');
}
buf.appendAscii( p, n );
p += n;
if ('E' != *p)
buf.append( '.' );
}
#if OSL_DEBUG_LEVEL > 1
OUString ret( buf.makeStringAndClear() );
OString c_ret( OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US ) );
fprintf( stderr, "> toUNOname(): %s => %s\n", start, c_ret.getStr() );
return ret;
#else
return buf.makeStringAndClear();
#endif
}
class RTTI
{
typedef std::unordered_map< OUString, type_info *, OUStringHash > t_rtti_map;
Mutex m_mutex;
t_rtti_map m_rttis;
t_rtti_map m_generatedRttis;
public:
RTTI();
~RTTI();
type_info * getRTTI( typelib_CompoundTypeDescription * );
};
RTTI::RTTI()
{
}
RTTI::~RTTI()
{
}
type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
{
type_info * rtti;
OUString const & unoName = *(OUString const *)&pTypeDescr->aBase.pTypeName;
MutexGuard guard( m_mutex );
t_rtti_map::const_iterator iRttiFind( m_rttis.find( unoName ) );
if (iRttiFind == m_rttis.end())
{
// RTTI symbol
OStringBuffer buf( 64 );
buf.append( "__ZTIN" );
sal_Int32 index = 0;
do
{
OUString token( unoName.getToken( 0, '.', index ) );
buf.append( token.getLength() );
OString c_token( OUStringToOString( token, RTL_TEXTENCODING_ASCII_US ) );
buf.append( c_token );
}
while (index >= 0);
buf.append( 'E' );
OString symName( buf.makeStringAndClear() );
// try to lookup the symbol in the generated rtti map
t_rtti_map::const_iterator iFind( m_generatedRttis.find( unoName ) );
if (iFind == m_generatedRttis.end())
{
// we must generate it !
// symbol and rtti-name is nearly identical,
// the symbol is prefixed with __ZTI
char const * rttiName = symName.getStr() +5;
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr,"generated rtti for %s\n", rttiName );
#endif
if (pTypeDescr->pBaseTypeDescription)
{
// ensure availability of base
type_info * base_rtti = getRTTI(
(typelib_CompoundTypeDescription *)pTypeDescr->pBaseTypeDescription );
rtti = new __si_class_type_info(
strdup( rttiName ), (__class_type_info *)base_rtti );
}
else
{
// this class has no base class
rtti = new __class_type_info( strdup( rttiName ) );
}
pair< t_rtti_map::iterator, bool > insertion(
m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
assert(insertion.second && "### inserting new generated rtti failed?!");
}
else // taking already generated rtti
{
rtti = iFind->second;
}
}
else
{
rtti = iRttiFind->second;
}
return rtti;
}
extern "C" {
static void _GLIBCXX_CDTOR_CALLABI deleteException( void * pExc )
{
__cxa_exception const * header = ((__cxa_exception const *)pExc - 1);
typelib_TypeDescription * pTD = 0;
OUString unoName( toUNOname( header->exceptionType->name() ) );
::typelib_typedescription_getByName( &pTD, unoName.pData );
assert(pTD && "### unknown exception type! leaving out destruction => leaking!!!");
if (pTD)
{
::uno_destructData( pExc, pTD, cpp_release );
::typelib_typedescription_release( pTD );
}
}
}
void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
{
#if OSL_DEBUG_LEVEL > 1
OString cstr(
OUStringToOString(
OUString::unacquired( &pUnoExc->pType->pTypeName ),
RTL_TEXTENCODING_ASCII_US ) );
fprintf( stderr, "> uno exception occurred: %s\n", cstr.getStr() );
#endif
void * pCppExc;
type_info * rtti;
{
// construct cpp exception object
typelib_TypeDescription * pTypeDescr = 0;
TYPELIB_DANGER_GET( &pTypeDescr, pUnoExc->pType );
assert(pTypeDescr);
if (! pTypeDescr)
{
throw RuntimeException(
OUString("cannot get typedescription for type ") +
OUString::unacquired( &pUnoExc->pType->pTypeName ) );
}
pCppExc = __cxa_allocate_exception( pTypeDescr->nSize );
::uno_copyAndConvertData( pCppExc, pUnoExc->pData, pTypeDescr, pUno2Cpp );
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
static RTTI * s_rtti = 0;
if (! s_rtti)
{
MutexGuard guard( Mutex::getGlobalMutex() );
if (! s_rtti)
{
#ifdef LEAK_STATIC_DATA
s_rtti = new RTTI();
#else
static RTTI rtti_data;
s_rtti = &rtti_data;
#endif
}
}
rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
{
throw RuntimeException(
OUString("no rtti for type ") +
OUString::unacquired( &pUnoExc->pType->pTypeName ) );
}
}
__cxa_throw( pCppExc, rtti, deleteException );
}
void fillUnoException( __cxa_exception * header, uno_Any * pUnoExc, uno_Mapping * pCpp2Uno )
{
if (! header)
{
RuntimeException aRE( "no exception header!" );
Type const & rType = cppu::UnoType<decltype(aRE)>::get();
uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
SAL_WARN("bridges", aRE.Message);
return;
}
typelib_TypeDescription * pExcTypeDescr = 0;
OUString unoName( toUNOname( header->exceptionType->name() ) );
#if OSL_DEBUG_LEVEL > 1
OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) );
fprintf( stderr, "> c++ exception occurred: %s\n", cstr_unoName.getStr() );
#endif
typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
if (0 == pExcTypeDescr)
{
RuntimeException aRE( OUString("exception type not found: ") + unoName );
Type const & rType = cppu::UnoType<decltype(aRE)>::get();
uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
SAL_WARN("bridges", aRE.Message);
}
else
{
// construct uno exception any
uno_any_constructAndConvert( pUnoExc, header->adjustedPtr, pExcTypeDescr, pCpp2Uno );
typelib_typedescription_release( pExcTypeDescr );
}
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,90 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#ifndef INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_X86_64_SHARE_HXX
#define INCLUDED_BRIDGES_SOURCE_CPP_UNO_MINGW_X86_64_SHARE_HXX
#include "uno/mapping.h"
#include <typeinfo>
#include <exception>
#include <cstddef>
#include "cppu/macros.hxx"
#include "uno/any2.h"
namespace CPPU_CURRENT_NAMESPACE
{
void dummy_can_throw_anything( char const * );
// ----- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
struct _Unwind_Exception
{
unsigned exception_class __attribute__((__mode__(__DI__)));
void * exception_cleanup;
unsigned private_1 __attribute__((__mode__(__word__)));
unsigned private_2 __attribute__((__mode__(__word__)));
} __attribute__((__aligned__));
struct __cxa_exception
{
::std::type_info *exceptionType;
void (*exceptionDestructor)(void *);
::std::unexpected_handler unexpectedHandler;
::std::terminate_handler terminateHandler;
__cxa_exception *nextException;
int handlerCount;
int handlerSwitchValue;
const unsigned char *actionRecord;
const unsigned char *languageSpecificData;
void *catchTemp;
void *adjustedPtr;
_Unwind_Exception unwindHeader;
};
struct __cxa_eh_globals
{
__cxa_exception *caughtExceptions;
unsigned int uncaughtExceptions;
};
}
extern "C" void privateSnippetExecutor( ... );
extern "C" CPPU_CURRENT_NAMESPACE::__cxa_eh_globals *__cxa_get_globals () throw();
namespace CPPU_CURRENT_NAMESPACE
{
void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
void fillUnoException(
__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,438 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* 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 .
*/
#include <exception>
#include <typeinfo>
#include "rtl/alloc.h"
#include "rtl/ustrbuf.hxx"
#include <com/sun/star/uno/genfunc.hxx>
#include "com/sun/star/uno/RuntimeException.hpp"
#include <uno/data.h>
#include <sal/alloca.h>
#include <bridge.hxx>
#include <types.hxx>
#include "unointerfaceproxy.hxx"
#include "vtables.hxx"
#include "abi.hxx"
#include "callvirtualmethod.hxx"
#include "share.hxx"
using namespace ::com::sun::star::uno;
// Macros for easier insertion of values to registers or stack
// pSV - pointer to the source
// nr - order of the value [will be increased if stored to register]
// pFPR, pGPR - pointer to the registers
// pDS - pointer to the stack [will be increased if stored here]
// The value in %xmm register is already prepared to be retrieved as a float,
// thus we treat float and double the same
#define INSERT_FLOAT_DOUBLE( pSV, nr, pFPR, pDS ) \
if ( nr < x86_64::MAX_SSE_REGS ) \
pFPR[nr++] = *reinterpret_cast<double *>( pSV ); \
else \
*pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV ); // verbatim!
#define INSERT_INT64( pSV, nr, pGPR, pDS ) \
if ( nr < x86_64::MAX_GPR_REGS ) \
pGPR[nr++] = *reinterpret_cast<sal_uInt64 *>( pSV ); \
else \
*pDS++ = *reinterpret_cast<sal_uInt64 *>( pSV );
#define INSERT_INT32( pSV, nr, pGPR, pDS ) \
if ( nr < x86_64::MAX_GPR_REGS ) \
pGPR[nr++] = *reinterpret_cast<sal_uInt32 *>( pSV ); \
else \
*pDS++ = *reinterpret_cast<sal_uInt32 *>( pSV );
#define INSERT_INT16( pSV, nr, pGPR, pDS ) \
if ( nr < x86_64::MAX_GPR_REGS ) \
pGPR[nr++] = *reinterpret_cast<sal_uInt16 *>( pSV ); \
else \
*pDS++ = *reinterpret_cast<sal_uInt16 *>( pSV );
#define INSERT_INT8( pSV, nr, pGPR, pDS ) \
if ( nr < x86_64::MAX_GPR_REGS ) \
pGPR[nr++] = *reinterpret_cast<sal_uInt8 *>( pSV ); \
else \
*pDS++ = *reinterpret_cast<sal_uInt8 *>( pSV );
namespace {
void appendCString(OUStringBuffer & buffer, char const * text) {
if (text != 0) {
buffer.append(
OStringToOUString(OString(text), RTL_TEXTENCODING_ISO_8859_1));
// use 8859-1 to avoid conversion failure
}
}
}
static void cpp_call(
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis,
bridges::cpp_uno::shared::VtableSlot aVtableSlot,
typelib_TypeDescriptionReference * pReturnTypeRef,
sal_Int32 nParams, typelib_MethodParameter * pParams,
void * pUnoReturn, void * pUnoArgs[], uno_Any ** ppUnoExc )
{
// Maxium space for [complex ret ptr], values | ptr ...
// (but will be used less - some of the values will be in pGPR and pFPR)
sal_uInt64 *pStack = (sal_uInt64 *)__builtin_alloca( (nParams + 3) * sizeof(sal_uInt64) );
sal_uInt64 *pStackStart = pStack;
sal_uInt64 pGPR[x86_64::MAX_GPR_REGS];
sal_uInt32 nGPR = 0;
double pFPR[x86_64::MAX_SSE_REGS];
sal_uInt32 nFPR = 0;
// Return
typelib_TypeDescription * pReturnTypeDescr = 0;
TYPELIB_DANGER_GET( &pReturnTypeDescr, pReturnTypeRef );
assert(pReturnTypeDescr);
void * pCppReturn = 0; // if != 0 && != pUnoReturn, needs reconversion (see below)
bool bSimpleReturn = true;
if ( pReturnTypeDescr )
{
if ( x86_64::return_in_hidden_param( pReturnTypeRef ) )
bSimpleReturn = false;
if ( bSimpleReturn )
pCppReturn = pUnoReturn; // direct way for simple types
else
{
// complex return via ptr
pCppReturn = bridges::cpp_uno::shared::relatesToInterfaceType( pReturnTypeDescr )?
__builtin_alloca( pReturnTypeDescr->nSize ) : pUnoReturn;
INSERT_INT64( &pCppReturn, nGPR, pGPR, pStack );
}
}
// Push "this" pointer
void * pAdjustedThisPtr = reinterpret_cast< void ** >( pThis->getCppI() ) + aVtableSlot.offset;
INSERT_INT64( &pAdjustedThisPtr, nGPR, pGPR, pStack );
// Args
void ** pCppArgs = (void **)alloca( 3 * sizeof(void *) * nParams );
// Indices of values this have to be converted (interface conversion cpp<=>uno)
sal_Int32 * pTempIndices = (sal_Int32 *)(pCppArgs + nParams);
// Type descriptions for reconversions
typelib_TypeDescription ** ppTempParamTypeDescr = (typelib_TypeDescription **)(pCppArgs + (2 * nParams));
sal_Int32 nTempIndices = 0;
for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
{
const typelib_MethodParameter & rParam = pParams[nPos];
typelib_TypeDescription * pParamTypeDescr = 0;
TYPELIB_DANGER_GET( &pParamTypeDescr, rParam.pTypeRef );
if (!rParam.bOut && bridges::cpp_uno::shared::isSimpleType( pParamTypeDescr ))
{
uno_copyAndConvertData( pCppArgs[nPos] = alloca( 8 ), pUnoArgs[nPos], pParamTypeDescr,
pThis->getBridge()->getUno2Cpp() );
switch (pParamTypeDescr->eTypeClass)
{
case typelib_TypeClass_HYPER:
case typelib_TypeClass_UNSIGNED_HYPER:
INSERT_INT64( pCppArgs[nPos], nGPR, pGPR, pStack );
break;
case typelib_TypeClass_LONG:
case typelib_TypeClass_UNSIGNED_LONG:
case typelib_TypeClass_ENUM:
INSERT_INT32( pCppArgs[nPos], nGPR, pGPR, pStack );
break;
case typelib_TypeClass_SHORT:
case typelib_TypeClass_CHAR:
case typelib_TypeClass_UNSIGNED_SHORT:
INSERT_INT16( pCppArgs[nPos], nGPR, pGPR, pStack );
break;
case typelib_TypeClass_BOOLEAN:
case typelib_TypeClass_BYTE:
INSERT_INT8( pCppArgs[nPos], nGPR, pGPR, pStack );
break;
case typelib_TypeClass_FLOAT:
case typelib_TypeClass_DOUBLE:
INSERT_FLOAT_DOUBLE( pCppArgs[nPos], nFPR, pFPR, pStack );
break;
default:
break;
}
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
else // ptr to complex value | ref
{
if (! rParam.bIn) // is pure out
{
// cpp out is constructed mem, uno out is not!
uno_constructData(
pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
pParamTypeDescr );
pTempIndices[nTempIndices] = nPos; // default constructed for cpp call
// will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
}
// is in/inout
else if (bridges::cpp_uno::shared::relatesToInterfaceType( pParamTypeDescr ))
{
uno_copyAndConvertData(
pCppArgs[nPos] = alloca( pParamTypeDescr->nSize ),
pUnoArgs[nPos], pParamTypeDescr, pThis->getBridge()->getUno2Cpp() );
pTempIndices[nTempIndices] = nPos; // has to be reconverted
// will be released at reconversion
ppTempParamTypeDescr[nTempIndices++] = pParamTypeDescr;
}
else // direct way
{
pCppArgs[nPos] = pUnoArgs[nPos];
// no longer needed
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
INSERT_INT64( &(pCppArgs[nPos]), nGPR, pGPR, pStack );
}
}
try
{
try {
CPPU_CURRENT_NAMESPACE::callVirtualMethod(
pAdjustedThisPtr, aVtableSlot.index,
pCppReturn, pReturnTypeRef, bSimpleReturn,
pStackStart, ( pStack - pStackStart ),
pGPR, nGPR,
pFPR, nFPR );
} catch (const Exception &) {
throw;
} catch (const std::exception & e) {
OUStringBuffer buf;
buf.append("C++ code threw ");
appendCString(buf, typeid(e).name());
buf.append(": ");
appendCString(buf, e.what());
throw RuntimeException(buf.makeStringAndClear());
} catch (...) {
throw RuntimeException("C++ code threw unknown exception");
}
*ppUnoExc = 0;
// reconvert temporary params
for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
typelib_TypeDescription * pParamTypeDescr = ppTempParamTypeDescr[nTempIndices];
if (pParams[nIndex].bIn)
{
if (pParams[nIndex].bOut) // inout
{
uno_destructData( pUnoArgs[nIndex], pParamTypeDescr, 0 ); // destroy uno value
uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
pThis->getBridge()->getCpp2Uno() );
}
}
else // pure out
{
uno_copyAndConvertData( pUnoArgs[nIndex], pCppArgs[nIndex], pParamTypeDescr,
pThis->getBridge()->getCpp2Uno() );
}
// destroy temp cpp param => cpp: every param was constructed
uno_destructData( pCppArgs[nIndex], pParamTypeDescr, cpp_release );
TYPELIB_DANGER_RELEASE( pParamTypeDescr );
}
// return value
if (pCppReturn && pUnoReturn != pCppReturn)
{
uno_copyAndConvertData( pUnoReturn, pCppReturn, pReturnTypeDescr,
pThis->getBridge()->getCpp2Uno() );
uno_destructData( pCppReturn, pReturnTypeDescr, cpp_release );
}
}
catch (...)
{
// fill uno exception
fillUnoException( __cxa_get_globals()->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno() );
// temporary params
for ( ; nTempIndices--; )
{
sal_Int32 nIndex = pTempIndices[nTempIndices];
// destroy temp cpp param => cpp: every param was constructed
uno_destructData( pCppArgs[nIndex], ppTempParamTypeDescr[nTempIndices], cpp_release );
TYPELIB_DANGER_RELEASE( ppTempParamTypeDescr[nTempIndices] );
}
// return type
if (pReturnTypeDescr)
TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
}
}
namespace bridges { namespace cpp_uno { namespace shared {
void unoInterfaceProxyDispatch(
uno_Interface * pUnoI, const typelib_TypeDescription * pMemberDescr,
void * pReturn, void * pArgs[], uno_Any ** ppException )
{
// is my surrogate
bridges::cpp_uno::shared::UnoInterfaceProxy * pThis
= static_cast< bridges::cpp_uno::shared::UnoInterfaceProxy * >(pUnoI);
#if OSL_DEBUG_LEVEL > 0
typelib_InterfaceTypeDescription * pTypeDescr = pThis->pTypeDescr;
#endif
switch (pMemberDescr->eTypeClass)
{
case typelib_TypeClass_INTERFACE_ATTRIBUTE:
{
#if OSL_DEBUG_LEVEL > 0
// determine vtable call index
sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
assert(nMemberPos < pTypeDescr->nAllMembers);
#endif
VtableSlot aVtableSlot(
getVtableSlot(
reinterpret_cast<
typelib_InterfaceAttributeTypeDescription const * >(
pMemberDescr)));
if (pReturn)
{
// dependent dispatch
cpp_call(
pThis, aVtableSlot,
((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef,
0, 0, // no params
pReturn, pArgs, ppException );
}
else
{
// is SET
typelib_MethodParameter aParam;
aParam.pTypeRef =
((typelib_InterfaceAttributeTypeDescription *)pMemberDescr)->pAttributeTypeRef;
aParam.bIn = sal_True;
aParam.bOut = sal_False;
typelib_TypeDescriptionReference * pReturnTypeRef = 0;
OUString aVoidName("void");
typelib_typedescriptionreference_new(
&pReturnTypeRef, typelib_TypeClass_VOID, aVoidName.pData );
// dependent dispatch
aVtableSlot.index += 1; // get, then set method
cpp_call(
pThis, aVtableSlot, // get, then set method
pReturnTypeRef,
1, &aParam,
pReturn, pArgs, ppException );
typelib_typedescriptionreference_release( pReturnTypeRef );
}
break;
}
case typelib_TypeClass_INTERFACE_METHOD:
{
#if OSL_DEBUG_LEVEL > 0
// determine vtable call index
sal_Int32 nMemberPos = ((typelib_InterfaceMemberTypeDescription *)pMemberDescr)->nPosition;
assert( nMemberPos < pTypeDescr->nAllMembers);
#endif
VtableSlot aVtableSlot(
getVtableSlot(
reinterpret_cast<
typelib_InterfaceMethodTypeDescription const * >(
pMemberDescr)));
switch (aVtableSlot.index)
{
// standard calls
case 1: // acquire uno interface
(*pUnoI->acquire)( pUnoI );
*ppException = 0;
break;
case 2: // release uno interface
(*pUnoI->release)( pUnoI );
*ppException = 0;
break;
case 0: // queryInterface() opt
{
typelib_TypeDescription * pTD = 0;
TYPELIB_DANGER_GET( &pTD, reinterpret_cast< Type * >( pArgs[0] )->getTypeLibType() );
if (pTD)
{
uno_Interface * pInterface = 0;
(*pThis->getBridge()->getUnoEnv()->getRegisteredInterface)(
pThis->getBridge()->getUnoEnv(),
(void **)&pInterface, pThis->oid.pData, (typelib_InterfaceTypeDescription *)pTD );
if (pInterface)
{
::uno_any_construct(
reinterpret_cast< uno_Any * >( pReturn ),
&pInterface, pTD, 0 );
(*pInterface->release)( pInterface );
TYPELIB_DANGER_RELEASE( pTD );
*ppException = 0;
break;
}
TYPELIB_DANGER_RELEASE( pTD );
}
} // else perform queryInterface()
default:
// dependent dispatch
cpp_call(
pThis, aVtableSlot,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pReturnTypeRef,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->nParams,
((typelib_InterfaceMethodTypeDescription *)pMemberDescr)->pParams,
pReturn, pArgs, ppException );
}
break;
}
default:
{
::com::sun::star::uno::RuntimeException aExc(
OUString("illegal member type description!"),
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
Type const & rExcType = cppu::UnoType<decltype(aExc)>::get();
// binary identical null reference
::uno_type_any_construct( *ppException, &aExc, rExcType.getTypeLibType(), 0 );
}
}
}
} } }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -37,7 +37,7 @@
static bridges::cpp_uno::shared::VtableFactory * pInstance;
#if defined(__GNUG__) && !defined(__MINGW32__)
#if defined(__GNUG__)
extern "C" void dso_init() __attribute__((constructor));
extern "C" void dso_exit() __attribute__((destructor));
#endif
-42
View File
@@ -178,11 +178,7 @@ jobject Bridge::call_uno(
break;
}
#ifdef BROKEN_ALLOCA
char * mem = static_cast<char *>(malloc(
#else
char * mem = static_cast<char *>(alloca(
#endif
(nParams * sizeof (void *)) +
return_size + (nParams * sizeof (largest)) ));
void ** uno_args = reinterpret_cast<void **>(mem);
@@ -203,11 +199,7 @@ jobject Bridge::call_uno(
TypeDescr td( type );
if (sal::static_int_cast< sal_uInt32 >(td.get()->nSize)
> sizeof (largest))
#ifdef BROKEN_ALLOCA
uno_args[ nPos ] = malloc( td.get()->nSize );
#else
uno_args[ nPos ] = alloca( td.get()->nSize );
#endif
}
if (param.bIn)
@@ -235,14 +227,7 @@ jobject Bridge::call_uno(
uno_type_destructData(
uno_args[ n ], p.pTypeRef, nullptr );
}
#ifdef BROKEN_ALLOCA
if (uno_args[ nPos ] && uno_args[ nPos ] != &uno_args_mem[ nPos ])
free( uno_args[ nPos ] );
#endif
}
#ifdef BROKEN_ALLOCA
free( mem );
#endif
throw;
}
}
@@ -281,16 +266,9 @@ jobject Bridge::call_uno(
{
uno_type_destructData(
uno_args[ n ], pParams[ n ].pTypeRef, nullptr );
#ifdef BROKEN_ALLOCA
if (uno_args[ nPos ] && uno_args[ nPos ] != &uno_args_mem[ nPos ])
free( uno_args[ nPos ] );
#endif
}
// cleanup uno return value
uno_type_destructData( uno_ret, return_type, nullptr );
#ifdef BROKEN_ALLOCA
free( mem );
#endif
throw;
}
}
@@ -298,10 +276,6 @@ jobject Bridge::call_uno(
typelib_TypeClass_ENUM != type->eTypeClass) // opt
{
uno_type_destructData( uno_args[ nPos ], type, nullptr );
#ifdef BROKEN_ALLOCA
if (uno_args[ nPos ] && uno_args[ nPos ] != &uno_args_mem[ nPos ])
free( uno_args[ nPos ] );
#endif
}
}
@@ -319,9 +293,6 @@ jobject Bridge::call_uno(
catch (...)
{
uno_type_destructData( uno_ret, return_type, nullptr );
#ifdef BROKEN_ALLOCA
free( mem );
#endif
throw;
}
if (typelib_TypeClass_DOUBLE < return_type->eTypeClass &&
@@ -329,14 +300,8 @@ jobject Bridge::call_uno(
{
uno_type_destructData( uno_ret, return_type, nullptr );
}
#ifdef BROKEN_ALLOCA
free( mem );
#endif
return java_ret.l;
}
#ifdef BROKEN_ALLOCA
free( mem );
#endif
return nullptr; // void return
}
else // exception occurred
@@ -347,16 +312,9 @@ jobject Bridge::call_uno(
typelib_MethodParameter const & param = pParams[ nPos ];
if (param.bIn)
uno_type_destructData( uno_args[ nPos ], param.pTypeRef, nullptr );
#ifdef BROKEN_ALLOCA
if (uno_args[ nPos ] && uno_args[ nPos ] != &uno_args_mem[ nPos ])
free( uno_args[ nPos ] );
#endif
}
handle_uno_exc( jni, uno_exc );
#ifdef BROKEN_ALLOCA
free( mem );
#endif
return nullptr;
}
}
-16
View File
@@ -150,11 +150,7 @@ void Bridge::call_java(
}
// prepare java args, save param td
#ifdef BROKEN_ALLOCA
jvalue * java_args = (jvalue *) malloc( sizeof (jvalue) * nParams );
#else
jvalue * java_args = static_cast<jvalue *>(alloca( sizeof (jvalue) * nParams ));
#endif
sal_Int32 nPos;
for ( nPos = 0; nPos < nParams; ++nPos )
@@ -182,9 +178,6 @@ void Bridge::call_java(
jni->DeleteLocalRef( java_args[ n ].l );
}
}
#ifdef BROKEN_ALLOCA
free( java_args );
#endif
throw;
}
}
@@ -344,9 +337,6 @@ void Bridge::call_java(
jni->DeleteLocalRef( java_args[ nPos ].l );
}
}
#ifdef BROKEN_ALLOCA
free( java_args );
#endif
throw;
}
jni->DeleteLocalRef( java_args[ nPos ].l );
@@ -381,9 +371,6 @@ void Bridge::call_java(
uno_args[ i ], param.pTypeRef, nullptr );
}
}
#ifdef BROKEN_ALLOCA
free( java_args );
#endif
throw;
}
} // else: already set integral uno return value
@@ -391,9 +378,6 @@ void Bridge::call_java(
// no exception occurred
*uno_exc = nullptr;
}
#ifdef BROKEN_ALLOCA
free( java_args );
#endif
}
// an UNO proxy wrapping a Java interface
+1 -1
View File
@@ -33,7 +33,7 @@ $(eval $(call gb_Executable_add_exception_objects,cppumaker,\
codemaker/source/cppumaker/includes \
))
ifeq ($(OS)$(COM),WNTMSC)
ifeq ($(OS),WNT)
$(eval $(call gb_Executable_add_cxxflags,cppumaker,\
-Ob0 \
))
-8
View File
@@ -382,13 +382,6 @@ export MDDS_LIBS=$(gb_SPACE)@MDDS_LIBS@
export MERGELIBS=@MERGELIBS@
export MINGWCXX=@MINGWCXX@
export MINGWSTRIP=@MINGWSTRIP@
export MINGW_DLLS=@MINGW_DLLS@
export MINGW_GCCDLL=@MINGW_GCCDLL@
export MINGW_GXXDLL=@MINGW_GXXDLL@
export MINGW_SHARED_GCCLIB=@MINGW_SHARED_GCCLIB@
export MINGW_SHARED_GXXLIB=@MINGW_SHARED_GXXLIB@
export MINGW_SHARED_LIBSTDCPP=@MINGW_SHARED_LIBSTDCPP@
export MINGW_SYSROOT=@MINGW_SYSROOT@
export ML_EXE=@ML_EXE@
export MOC4=@MOC4@
export MPL_SUBSET=@MPL_SUBSET@
@@ -599,7 +592,6 @@ export WINDOWS_SDK_VERSION=@WINDOWS_SDK_VERSION@
export WINDOWS_SDK_WILANGID=@WINDOWS_SDK_WILANGID@
export WINDOWS_X64=@WINDOWS_X64@
export WINDRES=@WINDRES@
export WINEGCC=@WINEGCC@
export WITH_COMPAT_OOWRAPPERS=@WITH_COMPAT_OOWRAPPERS@
export WITH_EXTENSION_INTEGRATION=@WITH_EXTENSION_INTEGRATION@
export WITH_EXTRA_EXTENSIONS=@WITH_EXTRA_EXTENSIONS@
+245 -562
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -55,7 +55,7 @@ $(eval $(call gb_Library_use_externals,postgresql-sdbc-impl,\
))
ifeq ($(SYSTEM_POSTGRESQL),)
ifneq ($(OS)$(COM),WNTMSC)
ifneq ($(OS),WNT)
$(eval $(call gb_Library_add_libs,postgresql-sdbc-impl,\
$(if $(WITH_GSSAPI),$(GSSAPI_LIBS)) \
@@ -30,10 +30,6 @@
#include <connectivity/dbexception.hxx>
#include "resource/ado_res.hrc"
#if defined __MINGW32__
#pragma GCC diagnostic warning "-Wwrite-strings"
#endif
using namespace ::comphelper;
using namespace connectivity;
using namespace connectivity::ado;
@@ -20,9 +20,6 @@
#define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEVARIANT_HXX
#include <sal/types.h>
#ifdef __MINGW32__
#include <windows.h>
#endif
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-6
View File
@@ -29,12 +29,6 @@ $(eval $(call gb_Library_add_defs,dbu,\
-DDBACCESS_DLLIMPLEMENTATION \
))
ifeq ($(OS)$(COM),WNTGCC) # for adoint.h
$(eval $(call gb_Library_add_cxxflags,dbu,\
-fpermissive \
))
endif
$(eval $(call gb_Library_use_externals,dbu,\
boost_headers \
odbc_headers \
-6
View File
@@ -37,12 +37,6 @@
#include "adodatalinks.hxx"
#ifdef __MINGW32__
const IID IID_IDataSourceLocator = { 0x2206CCB2, 0x19C1, 0x11D1, { 0x89, 0xE0, 0x00, 0xC0, 0x4F, 0xD7, 0xA8, 0x29 } };
const CLSID CLSID_DataLinks = { 0x2206CDB2, 0x19C1, 0x11D1, { 0x89, 0xE0, 0x00, 0xC0, 0x4F, 0xD7, 0xA8, 0x29 } };
#endif
OLECHAR const * PromptEdit(long hWnd,OLECHAR const * connstr);
BSTR PromptNew(long hWnd);
@@ -111,11 +111,7 @@ HWND initInstance( HINSTANCE _hAppInstance )
}
// main window function
#ifdef __MINGW32__
extern "C" int APIENTRY WinMain( HINSTANCE _hAppInstance, HINSTANCE, LPSTR, int )
#else
extern "C" int APIENTRY _tWinMain( HINSTANCE _hAppInstance, HINSTANCE, LPTSTR, int )
#endif
{
if ( !registerWindowClass( _hAppInstance ) )
return FALSE;
@@ -24,11 +24,7 @@
#include <stdlib.h>
#include <malloc.h>
#ifdef __MINGW32__
extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
#else
extern "C" int APIENTRY _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
#endif
{
// Retrieve startup info
@@ -141,22 +141,12 @@ static int GenericMain()
return dwExitCode;
}
#ifdef __MINGW32__
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
#else
int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
#endif
{
return GenericMain();
}
#ifdef __MINGW32__
int __cdecl main()
#else
int __cdecl _tmain()
#endif
{
return GenericMain();
}
@@ -274,16 +274,7 @@ BOOL WINAPI CtrlBreakHandler(
return TRUE;
}
#ifdef __MINGW32__
int main( int, char ** )
#else
int _tmain( int, _TCHAR ** )
#endif
{
TCHAR szTargetFileName[MAX_PATH] = TEXT("");
STARTUPINFO aStartupInfo;
@@ -56,11 +56,7 @@ static LPTSTR *GetCommandArgs( int *pArgc )
#endif
}
#ifdef __MINGW32__
int WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
#else
int WINAPI _tWinMain( HINSTANCE, HINSTANCE, LPTSTR, int )
#endif
{
TCHAR szTargetFileName[MAX_PATH] = TEXT("");
TCHAR szIniDirectory[MAX_PATH];
-9
View File
@@ -70,21 +70,12 @@ void writePath(
}
#ifdef __MINGW32__
int main(int argc, char ** argv, char **) {
if (argc == 2 && strcmp(argv[1], "c++") == 0) {
#else
int wmain(int argc, wchar_t ** argv, wchar_t **) {
if (argc == 2 && wcscmp(argv[1], L"c++") == 0) {
#endif
wchar_t path[MAX_PATH];
wchar_t * pathEnd = getBrandPath(path);
writePath(path, pathEnd, MY_STRING(L""));
#ifdef __MINGW32__
} else if (argc == 2 && strcmp(argv[1], "java") == 0) {
#else
} else if (argc == 2 && wcscmp(argv[1], L"java") == 0) {
#endif
if (fwrite("1", 1, 1, stdout) != 1) {
exit(EXIT_FAILURE);
}
-31
View File
@@ -1,31 +0,0 @@
--build=x86_64-unknown-linux-gnu
--host=i686-w64-mingw32
--with-system-altlinuxhyph
--with-system-boost
--with-system-cairo
--with-system-cppunit
--with-system-curl
--with-system-expat
--with-system-graphite
--with-system-hunspell
--with-system-icu
--with-system-libpng
--with-system-libxml
--with-system-lpsolve
--with-system-mythes
--with-system-neon
--with-system-nss
--with-system-openssl
--with-system-poppler
--with-system-redland
--with-system-zlib
--without-junit
--without-myspell-dicts
--disable-activex
--disable-cairo-canvas
--disable-directx
--disable-extension-integration
--disable-postgresql-sdbc
--disable-gtk
--with-help
--with-myspell-dicts
-32
View File
@@ -1,32 +0,0 @@
--build=x86_64-unknown-linux-gnu
--host=x86_64-w64-mingw32
--enable-64-bit
--with-system-altlinuxhyph
--with-system-boost
--with-system-cairo
--with-system-cppunit
--with-system-curl
--with-system-expat
--with-system-graphite
--with-system-hunspell
--with-system-icu
--with-system-libpng
--with-system-libxml
--with-system-lpsolve
--with-system-mythes
--with-system-neon
--with-system-nss
--with-system-openssl
--with-system-poppler
--with-system-redland
--with-system-zlib
--without-junit
--without-myspell-dicts
--disable-activex
--disable-cairo-canvas
--disable-directx
--disable-extension-integration
--disable-postgresql-sdbc
--disable-gtk
--with-help
--with-myspell-dicts
@@ -46,12 +46,6 @@
#include <process.h>
#include <systools/win32/comtools.hxx>
#ifdef __MINGW32__
#if defined __uuidof
#undef __uuidof
#endif
#define __uuidof(I) IID_##I
#endif
// namespace directives
-7
View File
@@ -19,13 +19,6 @@
#include "idroptarget.hxx"
#ifdef __MINGW32__
#if defined __uuidof
#undef __uuidof
#endif
#define __uuidof(I) IID_##I
#endif
IDropTargetImpl::IDropTargetImpl( DropTarget& pTarget): m_nRefCount( 0),
m_rDropTarget( pTarget)
{
-7
View File
@@ -36,13 +36,6 @@
#include <winuser.h>
#include <stdio.h>
#ifdef __MINGW32__
#if defined __uuidof
#undef __uuidof
#endif
#define __uuidof(I) IID_##I
#endif
using namespace cppu;
using namespace osl;
using namespace com::sun::star::datatransfer;
@@ -21,12 +21,6 @@
#include <osl/diagnose.h>
#include <systools/win32/comtools.hxx>
#ifdef __MINGW32__
#if defined __uuidof
#undef __uuidof
#endif
#define __uuidof(I) IID_##I
#endif
#define FREE_HGLOB_ON_RELEASE TRUE
#define KEEP_HGLOB_ON_RELEASE FALSE
@@ -22,13 +22,6 @@
#include "../clipb/WinClipbImpl.hxx"
#include "../clipb/WinClipboard.hxx"
#ifdef __MINGW32__
#if defined __uuidof
#undef __uuidof
#endif
#define __uuidof(I) IID_##I
#endif
using namespace com::sun::star::datatransfer;
using namespace com::sun::star::datatransfer::clipboard;
using com::sun::star::uno::RuntimeException;
@@ -42,13 +42,6 @@
#pragma warning(pop)
#endif
#ifdef __MINGW32__
#if defined __uuidof
#undef __uuidof
#endif
#define __uuidof(I) IID_##I
#endif
using namespace com::sun::star::datatransfer;
using namespace com::sun::star::datatransfer::clipboard;
using namespace com::sun::star::uno;
-76
View File
@@ -33,10 +33,6 @@
#include <vector>
#if defined ( __MINGW32__ )
#include <sehandler.hxx>
#endif
#define FORMATETC_EXACT_MATCH 1
#define FORMATETC_PARTIAL_MATCH -1
#define FORMATETC_NO_MATCH 0
@@ -175,29 +171,14 @@ OUString SAL_CALL cptostr( sal_uInt32 codepage )
// SCODE - S_OK if successful
void SAL_CALL DeleteTargetDevice( DVTARGETDEVICE* ptd )
{
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
jmp_buf jmpbuf;
__SEHandler han;
if (__builtin_setjmp(jmpbuf) == 0)
{
han.Set(jmpbuf, NULL, (__SEHandler::PF)EXCEPTION_EXECUTE_HANDLER);
#else
__try
{
#endif
CoTaskMemFree( ptd );
}
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
else
#else
__except( EXCEPTION_EXECUTE_HANDLER )
#endif
{
OSL_FAIL( "Error DeleteTargetDevice" );
}
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
han.Reset();
#endif
}
// OleStdCopyTargetDevice()
@@ -219,29 +200,17 @@ DVTARGETDEVICE* SAL_CALL CopyTargetDevice( DVTARGETDEVICE* ptdSrc )
{
DVTARGETDEVICE* ptdDest = nullptr;
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
jmp_buf jmpbuf;
__SEHandler han;
if (__builtin_setjmp(jmpbuf) == 0)
{
han.Set(jmpbuf, NULL, (__SEHandler::PF)EXCEPTION_EXECUTE_HANDLER);
#else
__try
{
#endif
if ( nullptr != ptdSrc )
{
ptdDest = static_cast< DVTARGETDEVICE* >( CoTaskMemAlloc( ptdSrc->tdSize ) );
memcpy( ptdDest, ptdSrc, static_cast< size_t >( ptdSrc->tdSize ) );
}
}
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
han.Reset();
#else
__except( EXCEPTION_EXECUTE_HANDLER )
{
}
#endif
return ptdDest;
}
@@ -273,16 +242,8 @@ bool SAL_CALL CopyFormatEtc( LPFORMATETC petcDest, LPFORMATETC petcSrc )
{
bool bRet = false;
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
jmp_buf jmpbuf;
__SEHandler han;
if (__builtin_setjmp(jmpbuf) == 0)
{
han.Set(jmpbuf, NULL, (__SEHandler::PF)EXCEPTION_EXECUTE_HANDLER);
#else
__try
{
#endif
if ( petcDest != petcSrc )
{
@@ -299,17 +260,10 @@ bool SAL_CALL CopyFormatEtc( LPFORMATETC petcDest, LPFORMATETC petcSrc )
bRet = true;
}
}
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
else
#else
__except( EXCEPTION_EXECUTE_HANDLER )
#endif
{
OSL_FAIL( "Error CopyFormatEtc" );
}
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
han.Reset();
#endif
return bRet;
}
@@ -324,16 +278,8 @@ sal_Int32 SAL_CALL CompareFormatEtc( const FORMATETC* pFetcLhs, const FORMATETC*
{
sal_Int32 nMatch = FORMATETC_EXACT_MATCH;
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
jmp_buf jmpbuf;
__SEHandler han;
if (__builtin_setjmp(jmpbuf) == 0)
{
han.Set(jmpbuf, NULL, (__SEHandler::PF)EXCEPTION_EXECUTE_HANDLER);
#else
__try
{
#endif
if ( pFetcLhs != pFetcRhs )
{
if ( ( pFetcLhs->cfFormat != pFetcRhs->cfFormat ) ||
@@ -371,18 +317,11 @@ sal_Int32 SAL_CALL CompareFormatEtc( const FORMATETC* pFetcLhs, const FORMATETC*
}
}
}
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
else
#else
__except( EXCEPTION_EXECUTE_HANDLER )
#endif
{
OSL_FAIL( "Error CompareFormatEtc" );
nMatch = FORMATETC_NO_MATCH;
}
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
han.Reset();
#endif
return nMatch;
}
@@ -391,16 +330,8 @@ bool SAL_CALL CompareTargetDevice( DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE* ptdR
{
bool bRet = false;
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
jmp_buf jmpbuf;
__SEHandler han;
if (__builtin_setjmp(jmpbuf) == 0)
{
han.Set(jmpbuf, NULL, (__SEHandler::PF)EXCEPTION_EXECUTE_HANDLER);
#else
__try
{
#endif
if ( ptdLeft == ptdRight )
{
// same address of td; must be same (handles NULL case)
@@ -415,18 +346,11 @@ bool SAL_CALL CompareTargetDevice( DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE* ptdR
if ( memcmp( ptdLeft, ptdRight, ptdLeft->tdSize ) == 0 )
bRet = true;
}
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
else
#else
__except( EXCEPTION_EXECUTE_HANDLER )
#endif
{
OSL_FAIL( "Error CompareTargetDevice" );
bRet = false;
}
#if defined ( __MINGW32__ ) && !defined ( _WIN64 )
han.Reset();
#endif
return bRet;
}
+3 -3
View File
@@ -927,7 +927,7 @@ EditPaM ImpEditEngine::CursorVisualStartEnd( EditView* pEditView, const EditPaM&
UBiDi* pBidi = ubidi_openSized( aLine.getLength(), 0, &nError );
const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/;
ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(pLineString), aLine.getLength(), nBidiLevel, nullptr, &nError ); // UChar != sal_Unicode in MinGW
ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(pLineString), aLine.getLength(), nBidiLevel, nullptr, &nError );
sal_Int32 nVisPos = bStart ? 0 : aLine.getLength()-1;
const sal_Int32 nLogPos = ubidi_getLogicalIndex( pBidi, nVisPos, &nError );
@@ -1046,7 +1046,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView* pEditView, const EditPaM
UBiDi* pBidi = ubidi_openSized( aLine.getLength(), 0, &nError );
const UBiDiLevel nBidiLevel = IsRightToLeft( nPara ) ? 1 /*RTL*/ : 0 /*LTR*/;
ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(pLineString), aLine.getLength(), nBidiLevel, nullptr, &nError ); // UChar != sal_Unicode in MinGW
ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(pLineString), aLine.getLength(), nBidiLevel, nullptr, &nError );
if ( !pEditView->IsInsertMode() )
{
@@ -1882,7 +1882,7 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara )
UBiDi* pBidi = ubidi_openSized( aText.getLength(), 0, &nError );
nError = U_ZERO_ERROR;
ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.getStr()), aText.getLength(), nBidiLevel, nullptr, &nError ); // UChar != sal_Unicode in MinGW
ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.getStr()), aText.getLength(), nBidiLevel, nullptr, &nError );
nError = U_ZERO_ERROR;
int32_t nCount = ubidi_countRuns( pBidi, &nError );
-4
View File
@@ -22,10 +22,6 @@
#pragma warning(disable : 4917 4555)
#endif
#ifdef __MINGW32__
#define _INIT_ATL_COMMON_VARS
#endif
#include "stdafx.h"
#include <atlbase.h>
-3
View File
@@ -20,9 +20,6 @@
#pragma warning(disable : 4917 4555)
#endif
#ifdef __MINGW32__
#define INITGUID
#endif
#include "servprov.hxx"
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-2
View File
@@ -28,7 +28,6 @@
#define OLESERV_DEACTIVATE 6
#include <oleidl.h>
#ifndef __MINGW32__
#pragma warning(disable : 4265)
#if defined __clang__
#pragma clang diagnostic push
@@ -41,7 +40,6 @@
#if defined __clang__
#pragma clang diagnostic pop
#endif
#endif
#include <cppuhelper/weak.hxx>
class EmbedDocument_Impl;
-17
View File
@@ -26,22 +26,6 @@
#define SUPPORTED_FACTORIES_NUM 10
#if defined(__MINGW32__) && !defined(INITGUID)
extern "C" const GUID DECLSPEC_SELECTANY OID_WriterTextServer;
extern "C" const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer;
extern "C" const GUID DECLSPEC_SELECTANY OID_CalcServer;
extern "C" const GUID DECLSPEC_SELECTANY OID_CalcOASISServer;
extern "C" const GUID DECLSPEC_SELECTANY OID_DrawingServer;
extern "C" const GUID DECLSPEC_SELECTANY OID_DrawingOASISServer;
extern "C" const GUID DECLSPEC_SELECTANY OID_PresentationServer;
extern "C" const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer;
extern "C" const GUID DECLSPEC_SELECTANY OID_MathServer;
extern "C" const GUID DECLSPEC_SELECTANY OID_MathOASISServer;
#else
extern "C" const GUID DECLSPEC_SELECTANY OID_WriterTextServer = { SO3_SW_OLE_EMBED_CLASSID_60 };
extern "C" const GUID DECLSPEC_SELECTANY OID_WriterOASISTextServer = { SO3_SW_OLE_EMBED_CLASSID_8 };
@@ -56,7 +40,6 @@ extern "C" const GUID DECLSPEC_SELECTANY OID_PresentationOASISServer = { SO3_SIM
extern "C" const GUID DECLSPEC_SELECTANY OID_MathServer = { SO3_SM_OLE_EMBED_CLASSID_60 };
extern "C" const GUID DECLSPEC_SELECTANY OID_MathOASISServer = { SO3_SM_OLE_EMBED_CLASSID_8 };
#endif
#endif
-5
View File
@@ -38,11 +38,6 @@
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#ifdef __MINGW32__
#include <algorithm>
using ::std::min;
using ::std::max;
#endif
#include <atlcom.h>
#include <atlctl.h>
+5 -11
View File
@@ -21,12 +21,6 @@
#include <stdio.h>
#include <inprocembobj.h>
#ifdef __MINGW32__
#define INITGUID
#define INPROC_DLLPUBLIC SAL_DLLPUBLIC_EXPORT
#else
#define INPROC_DLLPUBLIC
#endif
#include <embservconst.h>
static const GUID* guidList[ SUPPORTED_FACTORIES_NUM ] = {
@@ -163,7 +157,7 @@ protected:
// Entry points
extern "C" INPROC_DLLPUBLIC BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/ )
extern "C" BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/ )
{
if (dwReason == DLL_PROCESS_ATTACH)
{
@@ -177,7 +171,7 @@ extern "C" INPROC_DLLPUBLIC BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwRe
}
STDAPI INPROC_DLLPUBLIC DllGetClassObject( REFCLSID rclsid, REFIID riid, LPVOID* ppv )
STDAPI DllGetClassObject( REFCLSID rclsid, REFIID riid, LPVOID* ppv )
{
for( int nInd = 0; nInd < SUPPORTED_FACTORIES_NUM; nInd++ )
if ( *guidList[nInd] == rclsid )
@@ -194,7 +188,7 @@ STDAPI INPROC_DLLPUBLIC DllGetClassObject( REFCLSID rclsid, REFIID riid, LPVOID*
}
STDAPI INPROC_DLLPUBLIC DllCanUnloadNow()
STDAPI DllCanUnloadNow()
{
if ( !g_nObj && !g_nLock )
return S_OK;
@@ -203,7 +197,7 @@ STDAPI INPROC_DLLPUBLIC DllCanUnloadNow()
}
STDAPI INPROC_DLLPUBLIC DllRegisterServer()
STDAPI DllRegisterServer()
{
HMODULE aCurModule = GetModuleHandleA( "inprocserv.dll" );
if( aCurModule )
@@ -221,7 +215,7 @@ STDAPI INPROC_DLLPUBLIC DllRegisterServer()
}
STDAPI INPROC_DLLPUBLIC DllUnregisterServer()
STDAPI DllUnregisterServer()
{
return WriteLibraryToRegistry( "ole32.dll", 10 );
}
-3
View File
@@ -21,9 +21,6 @@
// stdafx1.pch will be the pre-compiled header
// stdafx1.obj will contain the pre-compiled type information
#ifdef __MINGW32__
#define _INIT_ATL_COMMON_VARS
#endif
#include "StdAfx2.h"
#ifdef _ATL_STATIC_REGISTRY
-5
View File
@@ -23,11 +23,6 @@
using namespace com::sun::star::uno;
#ifdef __MINGW32__
DEFINE_GUID(IID_IJScriptValueObject, 0xe40a2331, 0x3bc1, 0x11d4, 0x83, 0x21, 0x00, 0x50, 0x04, 0x52, 0x6a, 0xb4);
DEFINE_GUID(IID_IUnoObjectWrapper, 0x7B5C3410, 0x66FA, 0x11d4, 0x83, 0x2A, 0x00, 0x50, 0x04, 0x52, 0x6A, 0xB4);
DEFINE_GUID(IID_IUnoTypeWrapper, 0x8BB66591, 0xA544, 0x4de9, 0x82, 0x2C, 0x57, 0xAB, 0x57, 0xBC, 0xED, 0x1C);
#endif
MIDL_INTERFACE("e40a2331-3bc1-11d4-8321-005004526ab4")
IJScriptValueObject: public IUnknown
{
-3
View File
@@ -37,9 +37,6 @@
#pragma clang diagnostic ignored "-Wnon-virtual-dtor"
#endif
#ifdef __MINGW32__
#define _INIT_ATL_COMMON_VARS
#endif
#include <atlbase.h>
static CComModule _Module;
#include <atlcom.h>
-8
View File
@@ -949,11 +949,7 @@ Any IUnknownWrapper_Impl::invokeWithDispIdUnoTlb(const OUString& sFunctionName,
if( SUCCEEDED( CComObject<JScriptOutParam>::CreateInstance( &pParamObject)))
{
CComPtr<IUnknown> pUnk(pParamObject->GetUnknown());
#ifdef __MINGW32__
CComQIPtr<IDispatch, &__uuidof(IDispatch)> pDisp( pUnk);
#else
CComQIPtr<IDispatch> pDisp( pUnk);
#endif
pVarParams[ parameterCount - i -1].vt= VT_DISPATCH;
pVarParams[ parameterCount - i -1].pdispVal= pDisp;
@@ -1178,11 +1174,7 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
OSL_ASSERT(aArguments.getLength() == 3);
m_spUnknown= *static_cast<IUnknown* const *>(aArguments[0].getValue());
#ifdef __MINGW32__
m_spUnknown->QueryInterface(IID_IDispatch, reinterpret_cast<LPVOID*>( & m_spDispatch.p));
#else
m_spUnknown.QueryInterface( & m_spDispatch.p);
#endif
aArguments[1] >>= m_bOriginalDispatch;
aArguments[2] >>= m_seqTypes;
-5
View File
@@ -19,13 +19,8 @@
#include <vector>
#ifdef __MINGW32__
#define INITGUID
#include <initguid.h>
#else
#include "ole2uno.hxx"
#include "unoconversionutilities.hxx"
#endif
#include "servprov.hxx"
#include "unoobjw.hxx"
#include "oleobjw.hxx"
@@ -57,10 +57,6 @@ typedef unsigned char BYTE;
using namespace com::sun::star::script;
using namespace com::sun::star::beans;
using namespace com::sun::star::uno;
#ifdef __MINGW32__
using namespace com::sun::star::bridge;
using namespace com::sun::star::bridge::ModelDependent;
#endif
using namespace com::sun::star::bridge::oleautomation;
namespace ole_adapter
{
@@ -85,10 +81,6 @@ typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::const_itera
extern std::unordered_map<sal_uIntPtr, WeakReference<XInterface> > UnoObjToWrapperMap;
typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::iterator IT_Uno;
typedef std::unordered_map<sal_uIntPtr, WeakReference<XInterface> >::const_iterator CIT_Uno;
#ifdef __MINGW32__
inline void reduceRange( Any& any);
#endif
// createUnoObjectWrapper gets a wrapper instance by calling createUnoWrapperInstance
// and initializes it via XInitialization. The wrapper object is required to implement
@@ -1523,11 +1515,7 @@ void UnoConversionUtilities<T>::variantToAny( const VARIANT* pVariant, Any& rAny
case VT_DISPATCH:
{
//check if it is a UNO type
#ifdef __MINGW32__
CComQIPtr<IUnoTypeWrapper, &__uuidof(IUnoTypeWrapper)> spType((IUnknown*) var.byref);
#else
CComQIPtr<IUnoTypeWrapper> spType(static_cast<IUnknown*>(var.byref));
#endif
if (spType)
{
CComBSTR sName;
@@ -1669,21 +1657,13 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
{
spUnknown = pVar->punkVal;
if (spUnknown)
#ifdef __MINGW32__
spUnknown->QueryInterface( IID_IDispatch, reinterpret_cast<LPVOID*>( & spDispatch.p));
#else
spUnknown.QueryInterface( & spDispatch.p);
#endif
}
else if (pVar->vt == VT_DISPATCH && pVar->pdispVal != nullptr)
{
CComPtr<IDispatch> spDispatch2(pVar->pdispVal);
if (spDispatch2)
#ifdef __MINGW32__
spDispatch2->QueryInterface( IID_IUnknown, reinterpret_cast<LPVOID*>( & spUnknown.p));
#else
spDispatch2.QueryInterface( & spUnknown.p);
#endif
}
static Type VOID_TYPE= Type();
@@ -1725,11 +1705,7 @@ Any UnoConversionUtilities<T>::createOleObjectWrapper(VARIANT* pVar, const Type&
// Check if "spUnknown" is a UNO wrapper, that is an UNO object that has been
// passed to COM. Then it supports IUnoObjectWrapper
// and we extract the original UNO object.
#ifdef __MINGW32__
CComQIPtr<IUnoObjectWrapper, &__uuidof(IUnoObjectWrapper)> spUno( spUnknown);
#else
CComQIPtr<IUnoObjectWrapper> spUno( spUnknown);
#endif
if( spUno)
{ // it is a wrapper
Reference<XInterface> xInt;
-12
View File
@@ -561,11 +561,7 @@ static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource)
CComPtr<IDispatch> spDispDest(varDest.pdispVal);
// special Handling for a JScriptValue object
#ifdef __MINGW32__
CComQIPtr<IJScriptValueObject, &__uuidof(IJScriptValueObject)> spValueDest(spDispDest);
#else
CComQIPtr<IJScriptValueObject> spValueDest(spDispDest);
#endif
if (spValueDest)
{
VARIANT_BOOL varBool= VARIANT_FALSE;
@@ -584,11 +580,7 @@ static bool writeBackOutParameter2( VARIANTARG* pDest, VARIANT* pSource)
// of a property if it does not exist already. This is convenient for
// out parameters in JScript. Then the user must not specify propery "0"
// explicitly
#ifdef __MINGW32__
CComQIPtr<IDispatchEx, &__uuidof(IDispatchEx)> spDispEx( spDispDest);
#else
CComQIPtr<IDispatchEx> spDispEx( spDispDest);
#endif
if( spDispEx)
{
CComBSTR nullProp(L"0");
@@ -1074,11 +1066,7 @@ HRESULT InterfaceOleWrapper_Impl::InvokeGeneral( DISPID dispidMember, unsigned s
{
pValue->AddRef();
pvarResult->vt= VT_DISPATCH;
#ifdef __MINGW32__
pvarResult->pdispVal= CComQIPtr<IDispatch, &__uuidof(IDispatch)>(pValue->GetUnknown());
#else
pvarResult->pdispVal= CComQIPtr<IDispatch>(pValue->GetUnknown());
#endif
ret= S_OK;
}
else
-8
View File
@@ -32,17 +32,9 @@ bool createUnoTypeWrapper(BSTR sTypeName, VARIANT * pVar)
{
pObj->AddRef();
pVar->vt= VT_DISPATCH;
#ifdef __MINGW32__
pVar->pdispVal= CComQIPtr<IDispatch, &__uuidof(IDispatch)>(pObj->GetUnknown());
#else
pVar->pdispVal= CComQIPtr<IDispatch>(pObj->GetUnknown());
#endif
//now set the value, e.i. the name of the type
#ifdef __MINGW32__
CComQIPtr<IUnoTypeWrapper, &__uuidof(IUnoTypeWrapper)> spType(pVar->pdispVal);
#else
CComQIPtr<IUnoTypeWrapper> spType(pVar->pdispVal);
#endif
OSL_ASSERT(spType);
if (SUCCEEDED(spType->put_Name(sTypeName)))
{
@@ -41,9 +41,7 @@ extern "C" bool SAL_CALL WNT_hasInternetConnection()
DWORD dwFlags;
TCHAR szConnectionName[1024];
#ifndef __MINGW32__
__try {
#endif
BOOL fIsConnected = InternetGetConnectedStateEx(
&dwFlags,
szConnectionName,
@@ -52,11 +50,9 @@ extern "C" bool SAL_CALL WNT_hasInternetConnection()
return fIsConnected;
#ifndef __MINGW32__
} __except( EXCEPTION_EXECUTE_HANDLER ) {
return false;
}
#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-4
View File
@@ -9,10 +9,6 @@
$(eval $(call gb_Module_Module,external))
ifeq ($(OS)$(COM),WNTGCC)
$(eval $(call gb_Module_add_moduledir,external,mingw-externals))
endif
ifeq ($(COM),MSC)
$(eval $(call gb_Module_add_moduledir,external,msc-externals))
endif
+1 -1
View File
@@ -13,7 +13,7 @@ $(eval $(call gb_Module_add_targets,breakpad,\
UnpackedTarball_breakpad \
))
ifneq ($(OS)$(COM),WNTMSC)
ifneq ($(OS),WNT)
$(eval $(call gb_Module_add_targets,breakpad,\
ExternalProject_breakpad \
))
+1 -1
View File
@@ -26,7 +26,7 @@ $(eval $(call gb_ExternalProject_register_targets,cairo,\
build \
))
ifeq ($(OS)$(COM),WNTMSC)
ifeq ($(OS),WNT)
$(call gb_ExternalProject_get_state_target,cairo,build) :
$(call gb_ExternalProject_run,build,\
+1 -1
View File
@@ -13,7 +13,7 @@ $(eval $(call gb_ExternalProject_register_targets,pixman,\
build \
))
ifeq ($(OS)$(COM),WNTMSC)
ifeq ($(OS),WNT)
$(call gb_ExternalProject_get_state_target,pixman,build) :
$(call gb_ExternalProject_run,build,\
+1 -1
View File
@@ -15,7 +15,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,pixman,\
external/cairo/pixman/pixman-0.24.4.patch \
))
ifeq ($(OS)$(COM),WNTMSC)
ifeq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_file,pixman,pixman,external/cairo/pixman/Makefile.win32.common))
endif
-8
View File
@@ -50,15 +50,7 @@ endif
ifeq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_file,clucene,src/shared/CLucene/_clucene-config.h,external/clucene/configs/_clucene-config-MSVC.h))
ifeq ($(COM),MSC)
$(eval $(call gb_UnpackedTarball_add_file,clucene,src/shared/CLucene/clucene-config.h,external/clucene/configs/clucene-config-MSVC.h))
else
ifeq ($(HAVE_GCC_BUILTIN_ATOMIC),TRUE)
$(eval $(call gb_UnpackedTarball_add_file,clucene,src/shared/CLucene/clucene-config.h,external/clucene/configs/clucene-config-MINGW-atomic.h))
else
$(eval $(call gb_UnpackedTarball_add_file,clucene,src/shared/CLucene/clucene-config.h,external/clucene/configs/clucene-config-MINGW.h))
endif
endif
else # ! $(OS),WNT
ifeq ($(HAVE_GCC_BUILTIN_ATOMIC),TRUE)
$(eval $(call gb_UnpackedTarball_add_file,clucene,src/shared/CLucene/clucene-config.h,external/clucene/configs/clucene-config-GCC-atomic.h))
-150
View File
@@ -1,150 +0,0 @@
#ifndef _SRC_CLUCENE_CLUCENE_CONFIG_H
#define _SRC_CLUCENE_CLUCENE_CONFIG_H 1
/* src/shared/CLucene/clucene-config.h.
* Normally generated automatically at end of cmake,
* but here in LibreOffice this actually is a copy of
* clucene/configs/clucene-config-MINGW-atomic.h.
*/
/* CMake will look for these headers: */
#define _CL_HAVE_STRING_H 1
#define _CL_HAVE_MEMORY_H 1
/* #undef _CL_HAVE_UNISTD_H */
#define _CL_HAVE_IO_H 1
#define _CL_HAVE_DIRECT_H 1
/* #undef _CL_HAVE_DIRENT_H */
/* #undef _CL_HAVE_SYS_DIR_H */
/* #undef _CL_HAVE_SYS_NDIR_H */
#define _CL_HAVE_ERRNO_H 1
#define _CL_HAVE_WCHAR_H 1
#define _CL_HAVE_WCTYPE_H
#define _CL_HAVE_CTYPE_H 1
#define _CL_HAVE_WINDOWS_H 1
/* #undef _CL_HAVE_WINDEF_H */
#define _CL_HAVE_SYS_TYPES_H 1
/* #undef _CL_HAVE_DLFCN_H */
/* #undef _CL_HAVE_EXT_HASH_MAP */
/* #undef _CL_HAVE_EXT_HASH_SET */
/* #undef _CL_HAVE_TR1_UNORDERED_MAP */
/* #undef _CL_HAVE_TR1_UNORDERED_SET */
/* #undef _CL_HAVE_HASH_MAP */
/* #undef _CL_HAVE_HASH_SET */
/* #undef _CL_HAVE_NDIR_H */
#define _CL_HAVE_SYS_STAT_H 1
#define _CL_HAVE_SYS_TIMEB_H 1
/* #undef _CL_HAVE_SYS_TIME_H */
#define _CL_HAVE_TCHAR_H 1
/* #undef _CL_HAVE_SYS_MMAN_H */
#define _CL_HAVE_WINERROR_H 1
/* #undef _CL_HAVE_STDINT_H */
// our needed types
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
/* undef float_t*/
typedef unsigned long _cl_dword_t;
/* undef size_t size_t */
/* tchar & _T definitions... */
/* undef TCHAR TCHAR */
/* #undef _T */
/* CMake will determine these specifics. Things like bugs, etc */
/* if we can't support the map/set hashing */
/* #undef LUCENE_DISABLE_HASHING */
/* Define if you have POSIX threads libraries and header files. */
/* #undef _CL_HAVE_PTHREAD */
/* Define if you have Win32 threads libraries and header files. */
#define _CL_HAVE_WIN32_THREADS 1
/* Define if we have gcc atomic functions */
#define _CL_HAVE_GCC_ATOMIC_FUNCTIONS 1
/* Define what eval method is required for float_t to be defined (for GCC). */
/* #undef _FLT_EVAL_METHOD */
/* If we use hashmaps, which namespace do we use: */
#define CL_NS_HASHING(func)
/* If we use hashmaps, which classes do we use: */
#define _CL_HASH_MAP
#define _CL_HASH_SET
/* define if the compiler implements namespaces */
#define _CL_HAVE_NAMESPACES
/* Defined if the snprintf overflow test fails */
/* #undef _CL_HAVE_SNPRINTF_BUG */
/* Defined if the swprintf test fails */
/* #undef _CL_HAVE_SNWPRINTF_BUG */
/* How to define a static const in a class */
#define LUCENE_STATIC_CONSTANT(type, assignment) static const type assignment
/* Define to the necessary symbol if this constant uses a non-standard name on
your system. */
//todo: not checked
/* #undef _CL_PTHREAD_CREATE_JOINABLE */
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
//todo: not being checked for...
/* #undef _CL_STAT_MACROS_BROKEN */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
//not actually used for anything...
/* #undef _CL_TIME_WITH_SYS_TIME */
/* Define that we will be using -fvisibility=hidden, and
* make public classes visible using __attribute__ ((visibility("default")))
*/
/* #undef _CL_HAVE_GCCVISIBILITYPATCH */
/* Versions, etc */
/* Name of package */
#define _CL_PACKAGE "clucene-core"
/* Version number of package */
#define _CL_VERSION "2.3.3.4"
/* So-Version number of package */
#define _CL_SOVERSION "1"
/* A comparable version number */
#define _CL_INT_VERSION 2030304
/* Configured options (from command line) */
/* Forces into Ascii mode */
/* #undef _ASCII */
/* Conditional Debugging */
/* #undef _CL__CND_DEBUG */
/* debuging option */
/* #undef _DEBUG */
/* Disable multithreading */
/* #undef _CL_DISABLE_MULTITHREADING */
#ifdef __BORLANDC__ //borland compiler
//todo: bcc incorrectly detects this... fix this in cmake
#undef LUCENE_STATIC_CONSTANT
#define LUCENE_STATIC_CONSTANT(type, assignment) enum { assignment }
#endif
#endif
-150
View File
@@ -1,150 +0,0 @@
#ifndef _SRC_CLUCENE_CLUCENE_CONFIG_H
#define _SRC_CLUCENE_CLUCENE_CONFIG_H 1
/* src/shared/CLucene/clucene-config.h.
* Normally generated automatically at end of cmake,
* but here in LibreOffice this actually is a copy of
* clucene/configs/clucene-config-MINGW.h.
*/
/* CMake will look for these headers: */
#define _CL_HAVE_STRING_H 1
#define _CL_HAVE_MEMORY_H 1
/* #undef _CL_HAVE_UNISTD_H */
#define _CL_HAVE_IO_H 1
#define _CL_HAVE_DIRECT_H 1
/* #undef _CL_HAVE_DIRENT_H */
/* #undef _CL_HAVE_SYS_DIR_H */
/* #undef _CL_HAVE_SYS_NDIR_H */
#define _CL_HAVE_ERRNO_H 1
#define _CL_HAVE_WCHAR_H 1
#define _CL_HAVE_WCTYPE_H
#define _CL_HAVE_CTYPE_H 1
#define _CL_HAVE_WINDOWS_H 1
/* #undef _CL_HAVE_WINDEF_H */
#define _CL_HAVE_SYS_TYPES_H 1
/* #undef _CL_HAVE_DLFCN_H */
/* #undef _CL_HAVE_EXT_HASH_MAP */
/* #undef _CL_HAVE_EXT_HASH_SET */
/* #undef _CL_HAVE_TR1_UNORDERED_MAP */
/* #undef _CL_HAVE_TR1_UNORDERED_SET */
/* #undef _CL_HAVE_HASH_MAP */
/* #undef _CL_HAVE_HASH_SET */
/* #undef _CL_HAVE_NDIR_H */
#define _CL_HAVE_SYS_STAT_H 1
#define _CL_HAVE_SYS_TIMEB_H 1
/* #undef _CL_HAVE_SYS_TIME_H */
#define _CL_HAVE_TCHAR_H 1
/* #undef _CL_HAVE_SYS_MMAN_H */
#define _CL_HAVE_WINERROR_H 1
/* #undef _CL_HAVE_STDINT_H */
// our needed types
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
/* undef float_t*/
typedef unsigned long _cl_dword_t;
/* undef size_t size_t */
/* tchar & _T definitions... */
/* undef TCHAR TCHAR */
/* #undef _T */
/* CMake will determine these specifics. Things like bugs, etc */
/* if we can't support the map/set hashing */
/* #undef LUCENE_DISABLE_HASHING */
/* Define if you have POSIX threads libraries and header files. */
/* #undef _CL_HAVE_PTHREAD */
/* Define if you have Win32 threads libraries and header files. */
#define _CL_HAVE_WIN32_THREADS 1
/* Define if we have gcc atomic functions */
/* #undef _CL_HAVE_GCC_ATOMIC_FUNCTIONS */
/* Define what eval method is required for float_t to be defined (for GCC). */
/* #undef _FLT_EVAL_METHOD */
/* If we use hashmaps, which namespace do we use: */
#define CL_NS_HASHING(func)
/* If we use hashmaps, which classes do we use: */
#define _CL_HASH_MAP
#define _CL_HASH_SET
/* define if the compiler implements namespaces */
#define _CL_HAVE_NAMESPACES
/* Defined if the snprintf overflow test fails */
/* #undef _CL_HAVE_SNPRINTF_BUG */
/* Defined if the swprintf test fails */
/* #undef _CL_HAVE_SNWPRINTF_BUG */
/* How to define a static const in a class */
#define LUCENE_STATIC_CONSTANT(type, assignment) static const type assignment
/* Define to the necessary symbol if this constant uses a non-standard name on
your system. */
//todo: not checked
/* #undef _CL_PTHREAD_CREATE_JOINABLE */
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
//todo: not being checked for...
/* #undef _CL_STAT_MACROS_BROKEN */
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
//not actually used for anything...
/* #undef _CL_TIME_WITH_SYS_TIME */
/* Define that we will be using -fvisibility=hidden, and
* make public classes visible using __attribute__ ((visibility("default")))
*/
/* #undef _CL_HAVE_GCCVISIBILITYPATCH */
/* Versions, etc */
/* Name of package */
#define _CL_PACKAGE "clucene-core"
/* Version number of package */
#define _CL_VERSION "2.3.3.4"
/* So-Version number of package */
#define _CL_SOVERSION "1"
/* A comparable version number */
#define _CL_INT_VERSION 2030304
/* Configured options (from command line) */
/* Forces into Ascii mode */
/* #undef _ASCII */
/* Conditional Debugging */
/* #undef _CL__CND_DEBUG */
/* debuging option */
/* #undef _DEBUG */
/* Disable multithreading */
/* #undef _CL_DISABLE_MULTITHREADING */
#ifdef __BORLANDC__ //borland compiler
//todo: bcc incorrectly detects this... fix this in cmake
#undef LUCENE_STATIC_CONSTANT
#define LUCENE_STATIC_CONSTANT(type, assignment) enum { assignment }
#endif
#endif
+1 -5
View File
@@ -13,7 +13,7 @@ $(eval $(call gb_ExternalProject_register_targets,cppunit,\
build \
))
ifeq ($(OS)$(COM),WNTMSC)
ifeq ($(OS),WNT)
$(call gb_ExternalProject_get_state_target,cppunit,build) :
$(call gb_ExternalProject_run,build,\
PROFILEFLAGS="$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
@@ -34,10 +34,6 @@ cppunit_CXXFLAGS+=-D_GLIBCXX_DEBUG
endif
endif
ifeq ($(OS)-$(COM),WNT-GCC)
cppunit_CXXFLAGS+=-mthreads
endif
ifneq (,$(debug))
cppunit_CXXFLAGS+=-g
endif
+1 -3
View File
@@ -13,9 +13,7 @@ $(eval $(call gb_ExternalPackage_use_external_project,curl,curl))
ifneq ($(DISABLE_DYNLOADING),TRUE)
ifeq ($(OS)$(COM),WNTGCC)
$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.dll,lib/.libs/libcurl.dll))
else ifeq ($(COM),MSC)
ifeq ($(COM),MSC)
$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl$(if $(MSVC_USE_DEBUG_RUNTIME),d).dll,lib/$(if $(MSVC_USE_DEBUG_RUNTIME),debug-dll,release-dll)/libcurl$(if $(MSVC_USE_DEBUG_RUNTIME),d).dll))
else ifeq ($(OS),MACOSX)
$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.4.dylib,lib/.libs/libcurl.4.dylib))
-15
View File
@@ -60,21 +60,6 @@ $(call gb_ExternalProject_get_state_target,curl,build):
&& $(MAKE) \
)
else ifeq ($(OS)$(COM),WNTGCC)
$(call gb_ExternalProject_get_state_target,curl,build):
$(call gb_ExternalProject_run,build,\
./configure --with-nss --without-ssl --enable-ftp --enable-ipv6 --disable-http --disable-gopher \
--disable-file --disable-ldap --disable-telnet --disable-dict --build=i586-pc-mingw32 --host=i586-pc-mingw32 \
$(if $(ENABLE_DEBUG),--enable-debug) \
CC="$(CC) -mthreads $(if $(MINGW_SHARED_GCCLIB),-shared-libgcc)" \
LIBS="-lws2_32 -lwinmm $(if $(MINGW_SHARED_GXXLIB),$(MINGW_SHARED_LIBSTDCPP))" \
LDFLAGS="$(patsubst ;, -L,$(ILIB))" \
CPPFLAGS="$(INCLUDE)" OBJDUMP="objdump" \
&& cd lib \
&& $(MAKE) \
)
else ifeq ($(COM),MSC)
$(call gb_ExternalProject_get_state_target,curl,build):
-1
View File
@@ -20,7 +20,6 @@ $(eval $(call gb_UnpackedTarball_fix_end_of_line,curl,\
$(eval $(call gb_UnpackedTarball_add_patches,curl,\
external/curl/curl-msvc.patch.1 \
external/curl/curl-msvc-schannel.patch.1 \
external/curl/curl-7.26.0_mingw.patch \
external/curl/curl-7.26.0_win-proxy.patch \
external/curl/curl-xp.patch.1 \
))
-24
View File
@@ -1,24 +0,0 @@
--- a/lib/curl_setup.h 2009-10-29 05:21:58.000000000 +0900
+++ b/lib/curl_setup.h 2010-03-02 06:03:10.009500000 +0900
@@ -40,6 +40,21 @@
#include "curl_config.h"
+#ifdef __MINGW32__
+#undef HAVE_DLFCN_H
+#define HAVE_GETHOSTBYADDR 1
+#define HAVE_GETHOSTBYNAME 1
+#undef HAVE_LIBZ
+#undef HAVE_NETDB_H
+#undef HAVE_POLL_H
+#undef HAVE_SYS_IOCTL_H
+#undef HAVE_SYS_POLL_H
+#undef HAVE_SYS_UIO_H
+#undef HAVE_TERMIOS_H
+#undef HAVE_TERMIO_H
+#undef HAVE_ZLIB_H
+#endif
+
#else /* HAVE_CONFIG_H */
#ifdef _WIN32_WCE
+1 -8
View File
@@ -14,14 +14,7 @@ $(eval $(call gb_Module_add_targets,expat,\
StaticLibrary_expat \
))
# Actually it wasn't that clear if we should
# run configure step on mingw or not:
# CONFIGURATION_ACTION wasn't set, but
# CROSS_COMPILE case was handled in original makefile
# tested it on mingw and it doesn't hurt ;-)
#ifneq ($(OS),WNT)
ifneq ($(OS)$(COM),WNTMSC)
ifneq ($(OS),WNT)
$(eval $(call gb_Module_add_targets,expat,\
ExternalProject_expat \
))
+1 -1
View File
@@ -14,7 +14,7 @@ $(eval $(call gb_StaticLibrary_set_warnings_not_errors,expat))
$(eval $(call gb_StaticLibrary_use_unpacked,expat,expat))
# no configure step on windows, no dependency
ifneq ($(OS)$(COM),WNTMSC)
ifneq ($(OS),WNT)
$(eval $(call gb_StaticLibrary_use_external_project,expat,expat,full))
endif
+1 -1
View File
@@ -11,7 +11,7 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,firebird,firebird))
$(eval $(call gb_ExternalPackage_use_external_project,firebird,firebird))
ifeq ($(OS)-$(COM),WNT-MSC)
ifeq ($(OS),WNT)
$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/ifbclient.dll,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/bin/ifbclient.dll))
$(eval $(call gb_ExternalPackage_add_file,firebird,$(LIBO_LIB_FOLDER)/Engine12.dll,gen/$(if $(ENABLE_DEBUG),Debug,Release)/firebird/plugins/Engine12.dll))
else ifeq ($(OS),MACOSX)
+1 -1
View File
@@ -25,7 +25,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,firebird,\
external/firebird/0002-Backported-fix-for-CORE-5452-Segfault-when-engine-s-.patch.1 \
))
ifeq ($(OS)-$(COM),WNT-MSC)
ifeq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_patches,firebird,\
external/firebird/firebird-cygwin-msvc.patch \
))
+1 -1
View File
@@ -13,7 +13,7 @@ $(eval $(call gb_ExternalProject_register_targets,freetype,\
build \
))
ifeq ($(OS)$(COM),WNTMSC)
ifeq ($(OS),WNT)
$(call gb_ExternalProject_get_state_target,freetype,build) :
$(call gb_ExternalProject_run,build,\
cd ../builds/win32/vc2010/ && \
-1
View File
@@ -33,7 +33,6 @@ $(call gb_ExternalProject_get_state_target,hunspell,build):
$(SHELL) ./configure --disable-shared --disable-nls --with-pic \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM))\
$(if $(filter AIX,$(OS)),CFLAGS="-D_LINUX_SOURCE_COMPAT") \
$(if $(filter-out WNTGCC,$(OS)$(COM)),,LDFLAGS="-Wl,--enable-runtime-pseudo-reloc-v2") \
CXXFLAGS="$(hunspell_CXXFLAGS)" \
&& cd src/hunspell && $(MAKE) \
)
-18
View File
@@ -18,7 +18,6 @@ icu_CPPFLAGS:="-DHAVE_GCC_ATOMICS=$(if $(filter TRUE,$(GCC_HAVE_BUILTIN_ATOMIC))
ifeq ($(OS),WNT)
# Note: runConfigureICU ignores everything following the platform name!
ifeq ($(COM),MSC)
$(call gb_ExternalProject_get_state_target,icu,build) :
$(call gb_ExternalProject_run,build,\
export LIB="$(ILIB)" \
@@ -29,23 +28,6 @@ $(call gb_ExternalProject_get_state_target,icu,build) :
Cygwin/MSVC \
&& $(MAKE) \
,source)
else
$(call gb_ExternalProject_get_state_target,icu,build) :
$(call gb_ExternalProject_run,build,\
CPPFLAGS=$(icu_CPPFLAGS) CFLAGS="-O -D_MT" CXXFLAGS="-O -D_MT" \
LIBS="$(if $(MINGW_SHARED_GXXLIB),$(MINGW_SHARED_LIBSTDCPP))" \
LDFLAGS="-L$(COMPATH)/lib -Wl$(COMMA)--enable-runtime-pseudo-reloc-v2 \
$(if $(MINGW_SHARED_GCCLIB),-shared-libgcc)" \
./configure \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
--with-cross-build=$(WORKDIR_FOR_BUILD)/UnpackedTarball/icu/source) \
--disable-layout --disable-static --enable-shared --disable-samples \
&& $(MAKE) \
&& for lib in icudata icuin icuuc; do \
touch $$lib; \
done \
,source)
endif
else # $(OS)
-1
View File
@@ -31,7 +31,6 @@ $(call gb_ExternalProject_get_state_target,lcms2,build):
$(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no)) \
CPPFLAGS=" $(SOLARINC)" \
CFLAGS='$(CFLAGS) $(if $(debug),$(gb_DEBUGINFO_FLAGS) $(gb_DEBUG_CFLAGS),$(gb_COMPILEROPTFLAGS))' \
$(if $(filter-out WNTGCC,$(OS)$(COM)),,CPPFLAGS=" -DCMS_DLL_BUILD") \
$(if $(DISABLE_DYNLOADING), \
--enable-static --disable-shared \
, \
+1 -1
View File
@@ -21,7 +21,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,cmis, \
external/libcmis/libcmis-fix-error-handling.patch \
))
ifeq ($(OS)$(COM),WNTMSC)
ifeq ($(OS),WNT)
$(eval $(call gb_UnpackedTarball_add_patches,cmis,external/libcmis/boost-win.patch))
endif
+2 -3
View File
@@ -30,12 +30,11 @@ $(call gb_ExternalProject_get_state_target,langtag,build):
$(if $(filter TRUE,$(HAVE_GCC_BUILTIN_ATOMIC)),"lt_cv_has_atomic=yes","lt_cv_has_atomic=no") \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) "ac_cv_va_copy=no") \
LIBXML2_CFLAGS="$(LIBXML_CFLAGS)" \
LIBXML2_LIBS="$(if $(filter WNTMSC,$(OS)$(COM)),-L$(call gb_UnpackedTarball_get_dir,xml2)/win32/bin.msvc -llibxml2,$(LIBXML_LIBS))" \
LIBXML2_LIBS="$(if $(filter WNT,$(OS)),-L$(call gb_UnpackedTarball_get_dir,xml2)/win32/bin.msvc -llibxml2,$(LIBXML_LIBS))" \
$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________URELIB) \
$(if $(filter-out LINUX FREEBSD,$(OS)),,LDFLAGS="-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath,\\"\$$\$$ORIGIN) \
$(if $(filter-out SOLARIS,$(OS)),,LDFLAGS="-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-R$(COMMA)\\"\$$\$$ORIGIN) \
$(if $(filter-out WNTGCC,$(OS)$(COM)),,LDFLAGS="-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2") \
&& $(if $(filter WNTMSC,$(OS)$(COM)),\
&& $(if $(filter WNT,$(OS)),\
REAL_CC="$(shell cygpath -w $(lastword $(filter-out -%,$(CC))))" \
REAL_CC_FLAGS="$(filter -%,$(CC))") \
$(if $(verbose),V=1) \
-8
View File
@@ -23,14 +23,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,langtag,\
endif
endif
ifeq ($(OS),WNT)
ifeq ($(COM),GCC)
$(eval $(call gb_UnpackedTarball_add_patches,langtag,\
external/liblangtag/liblangtag-0.5.1-mingw.patch \
))
endif
endif
$(eval $(call gb_UnpackedTarball_add_patches,langtag, \
$(if $(SYSTEM_LIBXML),,external/liblangtag/langtag-libtool-rpath.patch.0) \
external/liblangtag/clang-cl.patch.0 \
-64
View File
@@ -1,64 +0,0 @@
--- misc/liblangtag-0.4.0/liblangtag/lt-ext-module.c 2013-06-14 15:06:13.629182430 +0100
+++ misc/liblangtag-0.4.0/liblangtag/lt-ext-module.c 2013-06-14 15:06:43.537534204 +0100
@@ -608,8 +608,8 @@
size_t len;
while (1) {
- if (readdir_r(dir, &dent, &dresult) || dresult == NULL)
- break;
+/* if (readdir_r(dir, &dent, &dresult) || dresult == NULL)
+ break;*/ abort(); /* we do not use liblangtag-gobject anyway */
len = strlen(dent.d_name);
if (len > suffix_len &&
--- misc/liblangtag-0.4.0/liblangtag/Makefile.am 2013-06-14 15:06:13.636182512 +0100
+++ misc/liblangtag-0.4.0/liblangtag/Makefile.am 2013-06-14 15:08:53.556063464 +0100
@@ -211,6 +211,7 @@
liblangtag_la_LDFLAGS = \
$(LDFLAGS) \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+ -no-undefined \
$(NULL)
-include $(top_srcdir)/git.mk
--- misc/liblangtag-0.4.0/liblangtag/Makefile.in 2013-06-14 15:06:13.636182512 +0100
+++ misc/liblangtag-0.4.0/liblangtag/Makefile.in 2013-06-14 15:09:07.204223994 +0100
@@ -576,6 +576,7 @@
liblangtag_la_LDFLAGS = \
$(LDFLAGS) \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
+ -no-undefined \
$(NULL)
all: $(BUILT_SOURCES)
--- misc/liblangtag-0.4.0/liblangtag-gobject/Makefile.am 2013-06-14 15:06:13.648182653 +0100
+++ misc/liblangtag-0.4.0/liblangtag-gobject/Makefile.am 2013-06-14 15:09:27.122458271 +0100
@@ -149,6 +149,7 @@
liblangtag_gobject_la_LDFLAGS = \
$(LDFLAGS) \
-version-info $(LT_G_CURRENT):$(LT_G_REVISION):$(LT_G_AGE) \
+ -no-undefined \
$(NULL)
#
if HAVE_INTROSPECTION
--- misc/liblangtag-0.4.0/liblangtag-gobject/Makefile.in 2013-06-14 15:06:13.648182653 +0100
+++ misc/liblangtag-0.4.0/liblangtag-gobject/Makefile.in 2013-06-14 15:09:33.099528574 +0100
@@ -476,6 +476,7 @@
liblangtag_gobject_la_LDFLAGS = \
$(LDFLAGS) \
-version-info $(LT_G_CURRENT):$(LT_G_REVISION):$(LT_G_AGE) \
+ -no-undefined \
$(NULL)
#
--- misc/liblangtag-0.4.0/Makefile.am 2013-06-14 15:06:13.652182700 +0100
+++ misc/liblangtag-0.4.0/Makefile.am 2013-06-14 15:06:43.539534228 +0100
@@ -6,7 +6,7 @@
SUBDIRS += liblangtag-gobject
endif
#SUBDIRS += docs tests
-SUBDIRS += tests
+#SUBDIRS += tests
ACLOCAL_AMFLAGS = -I m4macros
-15
View File
@@ -14,20 +14,6 @@ $(eval $(call gb_ExternalProject_register_targets,xml2,\
))
ifeq ($(OS),WNT)
ifeq ($(COM),GCC)
$(call gb_ExternalProject_get_state_target,xml2,build):
$(call gb_ExternalProject_run,build,\
./configure --disable-ipv6 --without-python --without-zlib \
--without-lzma \
--disable-static --without-debug lt_cv_cc_dll_switch="-shared" \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
CC="$(CC) -mthreads $(if $(MINGW_SHARED_GCCLIB),-shared-libgcc)" \
LIBS="-lws2_32 $(if $(MINGW_SHARED_GXXLIB),$(MINGW_SHARED_LIBSTDCPP))" \
LDFLAGS="-Wl$(COMMA)--no-undefined -Wl$(COMMA)--enable-runtime-pseudo-reloc-v2" \
OBJDUMP=objdump \
&& $(MAKE) \
)
else # COM=MSC
$(call gb_ExternalProject_use_external_project,xml2,icu)
$(call gb_ExternalProject_get_state_target,xml2,build):
@@ -38,7 +24,6 @@ $(call gb_ExternalProject_get_state_target,xml2,build):
&& unset MAKEFLAGS \
&& LIB="$(ILIB)" nmake \
,win32)
endif
else # OS!=WNT
$(call gb_ExternalProject_get_state_target,xml2,build):
$(call gb_ExternalProject_run,build,\
-16
View File
@@ -21,21 +21,6 @@ $(eval $(call gb_ExternalProject_register_targets,xmlsec,\
ifeq ($(OS),WNT)
ifeq ($(COM),GCC)
$(call gb_ExternalProject_get_state_target,xmlsec,build) :
$(call gb_ExternalProject_run,build,\
autoreconf \
&& ./configure --build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \
--without-libxslt --without-openssl --without-gnutls --disable-crypto-dl \
$(if $(SYSTEM_NSS),,--disable-pkgconfig) \
CC="$(CC) -mthreads $(if $(MINGW_SHARED_GCCLIB),-shared-libgcc)" \
LDFLAGS="-Wl$(COMMA)--no-undefined $(ILIB:;= -L)" \
LIBS="$(if $(MINGW_SHARED_GXXLIB),$(MINGW_SHARED__LIBSTDCPP))" \
lt_cv_deplibs_check_method=pass_all \
&& $(MAKE) \
)
else
$(call gb_ExternalProject_get_state_target,xmlsec,build) :
$(call gb_ExternalProject_run,build,\
cscript /e:javascript configure.js crypto=mscrypto xslt=no iconv=no static=no \
@@ -44,7 +29,6 @@ $(call gb_ExternalProject_get_state_target,xmlsec,build) :
&& unset MAKEFLAGS \
&& LIB="$(ILIB)" nmake \
,win32)
endif
else
+1 -1
View File
@@ -88,7 +88,7 @@ index b8770ad..721e4ca 100644
-NSPR_LIBS_LIST="-lnspr4 -lplds4 -lplc4"
+
+case $host_os in
+cygwin* | mingw* | pw32*)
+cygwin* | pw32*)
+ NSS_LIBS_LIST="-lnss3 -lsmime3"
+ NSPR_LIBS_LIST="-lnspr4"
+ ;;
+1 -5
View File
@@ -3165,7 +3165,7 @@ new file mode 100644
index 0000000..e27d1e4
--- /dev/null
+++ b/src/nss/tokens.c
@@ -0,0 +1,548 @@
@@ -0,0 +1,544 @@
+/**
+ * XMLSec library
+ *
@@ -3517,11 +3517,7 @@ index 0000000..e27d1e4
+/**
+ * Key Slot List
+ */
+#ifdef __MINGW32__ // for runtime-pseudo-reloc
+static struct _xmlSecPtrListKlass xmlSecNssKeySlotPtrListKlass = {
+#else
+static xmlSecPtrListKlass xmlSecNssKeySlotPtrListKlass = {
+#endif
+ BAD_CAST "mechanism-list",
+ (xmlSecPtrDuplicateItemMethod)xmlSecNssKeySlotDuplicate,
+ (xmlSecPtrDestroyItemMethod)xmlSecNssKeySlotDestroy,

Some files were not shown because too many files have changed in this diff Show More