Consistently use __EMSCRIPTEN__ instead of EMSCRIPTEN macro

...as emsdk 5.0.3 deprecated the predefined EMSCRIPTEN macro (see
<https://github.com/emscripten-core/emscripten/commit/506052bd8b4e23ded7f2351c62ca3b24d40c8cf3>
"Warn about usage of deprecated EMSCRIPTEN macro. NFC (#26381)"), causing
failures like

> In file included from static/source/unoembindhelpers/PrimaryBindings.cxx:29:
> In file included from include/sfx2/viewsh.hxx:35:
> In file included from include/editeng/outliner.hxx:32:
> In file included from include/tools/color.hxx:26:
> include/osl/endian.h:66:15: error: macro 'EMSCRIPTEN' has been marked as deprecated: use __EMSCRIPTEN__ instead [-Werror,-Wdeprecated-pragma]
>    66 | #elif defined EMSCRIPTEN
>       |               ^
> /home/sberg/emsdk/5.0.4/emsdk/emscripten/main/cache/sysroot/include/emscripten/emscripten.h:35:66: note: macro marked 'deprecated' here
>    35 | #pragma clang deprecated(EMSCRIPTEN, "use __EMSCRIPTEN__ instead")
>       |                                                                  ^

To avoid confusion, also suppress the -D$(OS) in
solenv/gbuild/platform/unxgcc.mk that would unnecessarily keep defining
EMSCRIPTEN.

Change-Id: Ic1f187cf1c6417cd95d4092e9cea01a665bd1b2f
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/34
Reviewed-by: Michael Stahl <michael.stahl@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
(cherry picked from commit 50291c2ed83bdb49bb827a4a12905d94b8c42035)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205167
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Stephan Bergmann
2026-05-14 10:11:38 +02:00
committed by Julien Nabet
parent 63f2b6308d
commit 811769f009
52 changed files with 116 additions and 104 deletions
@@ -12,7 +12,8 @@
#include <config_emscripten.h> #include <config_emscripten.h>
#include <config_vclplug.h> #include <config_vclplug.h>
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
#include <comphelper/emscriptenthreading.hxx> #include <comphelper/emscriptenthreading.hxx>
+2 -2
View File
@@ -34,7 +34,7 @@
namespace { namespace {
#if !(defined ANDROID || defined EMSCRIPTEN) #if !(defined ANDROID || defined __EMSCRIPTEN__)
OUString get_this_libpath() { OUString get_this_libpath() {
static OUString s_uri = []() { static OUString s_uri = []() {
OUString uri; OUString uri;
@@ -61,7 +61,7 @@ OUString cppu::getUnoIniUri() {
// and since rtlBootstrapHandle is not ref-counted doing anything // and since rtlBootstrapHandle is not ref-counted doing anything
// clean here is hardish. // clean here is hardish.
OUString uri("file:///assets/program"); OUString uri("file:///assets/program");
#elif defined(EMSCRIPTEN) #elif defined(__EMSCRIPTEN__)
OUString uri("file:///instdir/program"); OUString uri("file:///instdir/program");
#else #else
OUString uri(get_this_libpath()); OUString uri(get_this_libpath());
+1 -1
View File
@@ -11,7 +11,7 @@
#include <sal/config.h> #include <sal/config.h>
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
void initJsUnoScripting(); void initJsUnoScripting();
+4 -4
View File
@@ -358,7 +358,7 @@ void RemoveIconCacheDirectory()
namespace { namespace {
#if defined(DBG_UTIL) && !defined(EMSCRIPTEN) #if defined(DBG_UTIL) && !defined(__EMSCRIPTEN__)
void runGraphicsRenderTests() void runGraphicsRenderTests()
{ {
if (comphelper::LibreOfficeKit::isActive()) if (comphelper::LibreOfficeKit::isActive())
@@ -532,7 +532,7 @@ void Desktop::Init()
RequestHandler::Status aStatus = RequestHandler::Enable(true); RequestHandler::Status aStatus = RequestHandler::Enable(true);
if ( aStatus == RequestHandler::IPC_STATUS_PIPE_ERROR ) if ( aStatus == RequestHandler::IPC_STATUS_PIPE_ERROR )
{ {
#if defined(ANDROID) || defined(EMSCRIPTEN) #if defined(ANDROID) || defined(__EMSCRIPTEN__)
// Ignore crack pipe errors on Android // Ignore crack pipe errors on Android
#else #else
// Keep using this oddly named BE_PATHINFO_MISSING value // Keep using this oddly named BE_PATHINFO_MISSING value
@@ -1392,7 +1392,7 @@ int Desktop::Main()
recordTime(startT, "SetSplashScreenProgress(25): time = "); recordTime(startT, "SetSplashScreenProgress(25): time = ");
#if HAVE_FEATURE_DESKTOP && !defined(EMSCRIPTEN) #if HAVE_FEATURE_DESKTOP && !defined(__EMSCRIPTEN__)
// check user installation directory for lockfile so we can be sure // check user installation directory for lockfile so we can be sure
// there is no other instance using our data files from a remote host // there is no other instance using our data files from a remote host
@@ -1644,7 +1644,7 @@ int Desktop::Main()
CheckOpenCLCompute(xDesktop); CheckOpenCLCompute(xDesktop);
#endif #endif
#if defined(DBG_UTIL) && !defined(EMSCRIPTEN) #if defined(DBG_UTIL) && !defined(__EMSCRIPTEN__)
//Running the VCL graphics rendering tests //Running the VCL graphics rendering tests
const char * pDisplay = std::getenv("DISPLAY"); const char * pDisplay = std::getenv("DISPLAY");
if (!pDisplay || pDisplay[0] == ':') if (!pDisplay || pDisplay[0] == ':')
+2 -2
View File
@@ -45,7 +45,7 @@
#include <iostream> #include <iostream>
#include <map> #include <map>
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
#include <initjsunoscripting.hxx> #include <initjsunoscripting.hxx>
#endif #endif
@@ -85,7 +85,7 @@ void Desktop::InitApplicationServiceManager()
UNO_QUERY_THROW); UNO_QUERY_THROW);
#endif #endif
comphelper::setProcessServiceFactory(sm); comphelper::setProcessServiceFactory(sm);
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
initJsUnoScripting(); initJsUnoScripting();
#endif #endif
} }
+1 -1
View File
@@ -9,7 +9,7 @@
#include <sal/config.h> #include <sal/config.h>
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
#include <cassert> #include <cassert>
#include <cstdint> #include <cstdint>
+1 -1
View File
@@ -668,7 +668,7 @@ RequestHandler::Status RequestHandler::Enable(bool ipc)
if( pGlobal.is() ) if( pGlobal.is() )
return IPC_STATUS_OK; return IPC_STATUS_OK;
#if !HAVE_FEATURE_DESKTOP || HAVE_FEATURE_MACOSX_SANDBOX || defined(EMSCRIPTEN) #if !HAVE_FEATURE_DESKTOP || HAVE_FEATURE_MACOSX_SANDBOX || defined(__EMSCRIPTEN__)
ipc = false; ipc = false;
#endif #endif
+1 -1
View File
@@ -75,7 +75,7 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main()
#endif #endif
tools::extendApplicationEnvironment(); tools::extendApplicationEnvironment();
#if defined EMSCRIPTEN && !HAVE_EMSCRIPTEN_JSPI #if defined __EMSCRIPTEN__ && !HAVE_EMSCRIPTEN_JSPI
//HACK: Qt5 QWasmEventDispatcher::processEvents //HACK: Qt5 QWasmEventDispatcher::processEvents
// (qtbase/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp) calls // (qtbase/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp) calls
// emscripten_set_main_loop_arg with simulateInfiniteLoop == true, and as we use // emscripten_set_main_loop_arg with simulateInfiniteLoop == true, and as we use
+3 -3
View File
@@ -27,7 +27,7 @@
#include <officecfg/Setup.hxx> #include <officecfg/Setup.hxx>
#include <osl/file.h> #include <osl/file.h>
#include <osl/file.hxx> #include <osl/file.hxx>
#if defined ANDROID || defined IOS || defined EMSCRIPTEN #if defined ANDROID || defined IOS || defined __EMSCRIPTEN__
#include <rtl/bootstrap.hxx> #include <rtl/bootstrap.hxx>
#endif #endif
#include <rtl/ustring.hxx> #include <rtl/ustring.hxx>
@@ -40,7 +40,7 @@ namespace desktop::userinstall {
namespace { namespace {
#if !(defined ANDROID || defined IOS || defined EMSCRIPTEN) #if !(defined ANDROID || defined IOS || defined __EMSCRIPTEN__)
osl::FileBase::RC copyRecursive( osl::FileBase::RC copyRecursive(
OUString const & srcUri, OUString const & dstUri) OUString const & srcUri, OUString const & dstUri)
{ {
@@ -104,7 +104,7 @@ Status create(OUString const & uri) {
if (e != osl::FileBase::E_None && e != osl::FileBase::E_EXIST) { if (e != osl::FileBase::E_None && e != osl::FileBase::E_EXIST) {
return ERROR_OTHER; return ERROR_OTHER;
} }
#if !(defined ANDROID || defined IOS || defined EMSCRIPTEN) #if !(defined ANDROID || defined IOS || defined __EMSCRIPTEN__)
#if defined UNIX #if defined UNIX
// Set safer permissions for the user directory by default: // Set safer permissions for the user directory by default:
osl::File::setAttributes( osl::File::setAttributes(
+2 -2
View File
@@ -70,7 +70,7 @@ std::shared_ptr<rtl::Bootstrap> & UnoRc()
return theRc; return theRc;
}; };
#if !defined EMSCRIPTEN #if !defined __EMSCRIPTEN__
bool existsOfficePipe() bool existsOfficePipe()
{ {
@@ -326,7 +326,7 @@ OUString generateOfficePipeId()
bool office_is_running() bool office_is_running()
{ {
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
return true; return true;
#else #else
// i#82778: We need to check if we run within the office process. Then we must not use the pipe, // i#82778: We need to check if we run within the office process. Then we must not use the pipe,
+3 -3
View File
@@ -47,7 +47,7 @@
#include <osl/detail/android-bootstrap.h> #include <osl/detail/android-bootstrap.h>
#endif #endif
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
#include <initjsunoscripting.hxx> #include <initjsunoscripting.hxx>
#include <osl/detail/emscripten-bootstrap.h> #include <osl/detail/emscripten-bootstrap.h>
#endif #endif
@@ -7958,7 +7958,7 @@ static bool initialize_uno(const OUString& aAppProgramURL)
xSFactory.set(xFactory, uno::UNO_QUERY_THROW); xSFactory.set(xFactory, uno::UNO_QUERY_THROW);
comphelper::setProcessServiceFactory(xSFactory); comphelper::setProcessServiceFactory(xSFactory);
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
initJsUnoScripting(); initJsUnoScripting();
#endif #endif
@@ -8534,7 +8534,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
} }
else else
{ {
#if defined ANDROID || defined EMSCRIPTEN #if defined ANDROID || defined __EMSCRIPTEN__
aAppPath = OUString::fromUtf8(lo_get_app_data_dir()) + "/program"; aAppPath = OUString::fromUtf8(lo_get_app_data_dir()) + "/program";
#else #else
// Fun conversion dance back and forth between URLs and system paths... // Fun conversion dance back and forth between URLs and system paths...
@@ -87,7 +87,7 @@ void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css::
} }
} }
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
m_bDisableReschedule = true; m_bDisableReschedule = true;
#endif #endif
impl_createProgress(); impl_createProgress();
@@ -38,7 +38,7 @@
#include <osl/detail/android-bootstrap.h> #include <osl/detail/android-bootstrap.h>
#endif #endif
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
#include <osl/detail/emscripten-bootstrap.h> #include <osl/detail/emscripten-bootstrap.h>
#endif #endif
@@ -221,7 +221,7 @@ void LiblangtagDataRef::teardown()
void LiblangtagDataRef::setupDataPath() void LiblangtagDataRef::setupDataPath()
{ {
#if defined(ANDROID) || defined(EMSCRIPTEN) #if defined(ANDROID) || defined(__EMSCRIPTEN__)
maDataPath = OString(lo_get_app_data_dir()) + "/share/liblangtag"; maDataPath = OString(lo_get_app_data_dir()) + "/share/liblangtag";
#else #else
// maDataPath is assumed to be empty here. // maDataPath is assumed to be empty here.
+1 -1
View File
@@ -240,7 +240,7 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
if (bInitialized) if (bInitialized)
return aInstance; return aInstance;
#if ! defined(MACOSX) && ! defined(EMSCRIPTEN) #if ! defined(MACOSX) && ! defined(__EMSCRIPTEN__)
// try libpaper // try libpaper
// #i78617# workaround missing paperconf command // #i78617# workaround missing paperconf command
FILE* pPipe = popen( "paperconf 2>/dev/null", "r" ); FILE* pPipe = popen( "paperconf 2>/dev/null", "r" );
+1 -1
View File
@@ -249,7 +249,7 @@ void SvMetaType::WriteSfxItem(
// write the implementation part // write the implementation part
rOutStm.WriteOString( "#ifdef SFX_TYPEMAP" ) << endl; rOutStm.WriteOString( "#ifdef SFX_TYPEMAP" ) << endl;
rOutStm.WriteOString( "#if !defined(_WIN32) && (defined(DISABLE_DYNLOADING) && (defined(ANDROID) || defined(IOS) || defined(EMSCRIPTEN) || defined(LINUX)))" ) << endl; rOutStm.WriteOString( "#if !defined(_WIN32) && (defined(DISABLE_DYNLOADING) && (defined(ANDROID) || defined(IOS) || defined(__EMSCRIPTEN__) || defined(LINUX)))" ) << endl;
rOutStm.WriteOString( "__attribute__((__weak__))" ) << endl; rOutStm.WriteOString( "__attribute__((__weak__))" ) << endl;
rOutStm.WriteOString( "#endif" ) << endl; rOutStm.WriteOString( "#endif" ) << endl;
rOutStm.WriteOString( "constinit const " ).WriteOString( aTypeName ).WriteOString( aVarName ) rOutStm.WriteOString( "constinit const " ).WriteOString( aTypeName ).WriteOString( aVarName )
+2 -1
View File
@@ -14,7 +14,8 @@
#include <config_emscripten.h> #include <config_emscripten.h>
#include <config_vclplug.h> #include <config_vclplug.h>
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
#include <thread> #include <thread>
+1 -1
View File
@@ -68,7 +68,7 @@ public:
@param bJoin - if set call joinThreadsIfIdle() at the end @param bJoin - if set call joinThreadsIfIdle() at the end
*/ */
void waitUntilDone(const std::shared_ptr<ThreadTaskTag>&, bool bJoin = void waitUntilDone(const std::shared_ptr<ThreadTaskTag>&, bool bJoin =
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
false false
#else #else
true true
+2 -2
View File
@@ -9,7 +9,7 @@
#pragma once #pragma once
#if defined(EMSCRIPTEN) #if defined(__EMSCRIPTEN__)
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -21,6 +21,6 @@ const char *lo_get_app_data_dir(void);
} }
#endif #endif
#endif // EMSCRIPTEN #endif // __EMSCRIPTEN__
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+1 -1
View File
@@ -67,7 +67,7 @@ extern "C" {
# elif defined _BIG_ENDIAN # elif defined _BIG_ENDIAN
# define OSL_BIGENDIAN # define OSL_BIGENDIAN
# endif # endif
#elif defined EMSCRIPTEN #elif defined __EMSCRIPTEN__
# define OSL_LITENDIAN # define OSL_LITENDIAN
#else #else
# error "Target platform not specified !" # error "Target platform not specified !"
+1 -1
View File
@@ -25,7 +25,7 @@
#define INCLUDED_SAL_ALLOCA_H #define INCLUDED_SAL_ALLOCA_H
#if defined(__sun) || defined(LINUX) || defined(ANDROID) || defined(HAIKU) || defined(MACOSX) \ #if defined(__sun) || defined(LINUX) || defined(ANDROID) || defined(HAIKU) || defined(MACOSX) \
|| defined(IOS) || defined(EMSCRIPTEN) || defined(IOS) || defined(__EMSCRIPTEN__)
#ifndef INCLUDED_ALLOCA_H #ifndef INCLUDED_ALLOCA_H
#include <alloca.h> #include <alloca.h>
+1 -1
View File
@@ -83,7 +83,7 @@
#define SAL_CONFIGFILE(name) name "rc" #define SAL_CONFIGFILE(name) name "rc"
#endif #endif
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
#define SAL_UNX #define SAL_UNX
#define SAL_DLLEXTENSION ".bc" #define SAL_DLLEXTENSION ".bc"
#define SAL_EXEEXTENSION "" #define SAL_EXEEXTENSION ""
+1 -1
View File
@@ -36,7 +36,7 @@ static void InitCurl_easy(CURL* const pCURL)
if (path == nullptr) if (path == nullptr)
{ {
SAL_WARN("ucb.ucp.webdav.curl", "no OpenSSL CA certificate bundle found"); SAL_WARN("ucb.ucp.webdav.curl", "no OpenSSL CA certificate bundle found");
#if !defined(EMSCRIPTEN) #if !defined(__EMSCRIPTEN__)
throw css::uno::RuntimeException(u"no OpenSSL CA certificate bundle found"_ustr); throw css::uno::RuntimeException(u"no OpenSSL CA certificate bundle found"_ustr);
#endif #endif
} }
+1 -1
View File
@@ -728,7 +728,7 @@ uno::Reference< XInputStream > ZipFile::createStreamForZipEntry(
if (!bUseBufferedStream) if (!bUseBufferedStream)
return xSrcStream; return xSrcStream;
#ifndef EMSCRIPTEN #ifndef __EMSCRIPTEN__
static const sal_Int32 nThreadingThreshold = 10000; static const sal_Int32 nThreadingThreshold = 10000;
// "encrypted-package" is the only data stream, no point in threading it // "encrypted-package" is the only data stream, no point in threading it
+2 -2
View File
@@ -30,7 +30,7 @@
#include "nlsupport.hxx" #include "nlsupport.hxx"
// these share a lot, so use one define // these share a lot, so use one define
#if defined(LINUX) || defined(EMSCRIPTEN) || defined(__sun) || \ #if defined(LINUX) || defined(__EMSCRIPTEN__) || defined(__sun) || \
defined(FREEBSD) || defined(OPENBSD) || defined(DRAGONFLY) || defined(NETBSD) defined(FREEBSD) || defined(OPENBSD) || defined(DRAGONFLY) || defined(NETBSD)
#define LO_COMMON_NLS_ARCHS 1 #define LO_COMMON_NLS_ARCHS 1
#else #else
@@ -282,7 +282,7 @@ static const Pair nl_language_list[] = {
/* XXX MS-874 is an extension to tis620, so this is not /* XXX MS-874 is an extension to tis620, so this is not
* really equivalent */ * really equivalent */
#elif defined(LINUX) || defined(EMSCRIPTEN) #elif defined(LINUX) || defined(__EMSCRIPTEN__)
#if !defined(CODESET) #if !defined(CODESET)
#define CODESET _NL_CTYPE_CODESET_NAME #define CODESET _NL_CTYPE_CODESET_NAME
+1 -1
View File
@@ -95,7 +95,7 @@ namespace {
oslProcessError bootstrap_getExecutableFile(rtl_uString ** ppFileURL) oslProcessError bootstrap_getExecutableFile(rtl_uString ** ppFileURL)
{ {
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
// Just return some dummy file: URL for now to see what happens // Just return some dummy file: URL for now to see what happens
OUString fileURL = "vnd.sun.star.pathname:/instdir/program/soffice"; OUString fileURL = "vnd.sun.star.pathname:/instdir/program/soffice";
rtl_uString_acquire(fileURL.pData); rtl_uString_acquire(fileURL.pData);
+2 -2
View File
@@ -128,7 +128,7 @@ oslSecurity SAL_CALL osl_getCurrentSecurity()
if (p == nullptr) { if (p == nullptr) {
return nullptr; return nullptr;
} }
#if (defined(IOS) && defined(X86_64)) || defined(EMSCRIPTEN) #if (defined(IOS) && defined(X86_64)) || defined(__EMSCRIPTEN__)
// getpwuid_r() does not work in the iOS simulator // getpwuid_r() does not work in the iOS simulator
(void) found; (void) found;
char * buffer = p->m_buffer; char * buffer = p->m_buffer;
@@ -141,7 +141,7 @@ oslSecurity SAL_CALL osl_getCurrentSecurity()
buffer += strlen(buffer) + 1; buffer += strlen(buffer) + 1;
p->m_pPasswd.pw_uid = geteuid(); p->m_pPasswd.pw_uid = geteuid();
p->m_pPasswd.pw_gid = getegid(); p->m_pPasswd.pw_gid = getegid();
#if !defined(EMSCRIPTEN) #if !defined(__EMSCRIPTEN__)
p->m_pPasswd.pw_change = 0; p->m_pPasswd.pw_change = 0;
strcpy(buffer, ""); strcpy(buffer, "");
p->m_pPasswd.pw_class = buffer; p->m_pPasswd.pw_class = buffer;
+2 -2
View File
@@ -209,7 +209,7 @@ int macxp_resolveAlias(char *path, int buflen);
# define NO_PTHREAD_RTL # define NO_PTHREAD_RTL
#endif #endif
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
# include <pthread.h> # include <pthread.h>
# include <sys/file.h> # include <sys/file.h>
# include <sys/ioctl.h> # include <sys/ioctl.h>
@@ -231,7 +231,7 @@ int macxp_resolveAlias(char *path, int buflen);
!defined(__sun) && !defined(MACOSX) && \ !defined(__sun) && !defined(MACOSX) && \
!defined(OPENBSD) && !defined(DRAGONFLY) && \ !defined(OPENBSD) && !defined(DRAGONFLY) && \
!defined(IOS) && !defined(ANDROID) && \ !defined(IOS) && !defined(ANDROID) && \
!defined(HAIKU) && !defined(EMSCRIPTEN) !defined(HAIKU) && !defined(__EMSCRIPTEN__)
# error "Target platform not specified!" # error "Target platform not specified!"
#endif #endif
+2 -2
View File
@@ -222,7 +222,7 @@ template<> OUString fromOString(OString const & s)
template<typename T> bool realpath_(const T& pstrFileName, T& ppstrResolvedName) template<typename T> bool realpath_(const T& pstrFileName, T& ppstrResolvedName)
{ {
OString fn = toOString(pstrFileName); OString fn = toOString(pstrFileName);
#if defined ANDROID || defined(EMSCRIPTEN) #if defined ANDROID || defined(__EMSCRIPTEN__)
#if defined ANDROID #if defined ANDROID
if (fn == "/assets" || fn.startsWith("/assets/")) if (fn == "/assets" || fn.startsWith("/assets/"))
#else #else
@@ -236,7 +236,7 @@ template<typename T> bool realpath_(const T& pstrFileName, T& ppstrResolvedName)
return true; return true;
} }
#endif // ANDROID || EMSCRIPTEN #endif // ANDROID || __EMSCRIPTEN__
#ifdef MACOSX #ifdef MACOSX
fn = macxp_resolveAliasAndConvert(fn); fn = macxp_resolveAliasAndConvert(fn);
+3 -3
View File
@@ -45,7 +45,7 @@
#include <osl/detail/android-bootstrap.h> #include <osl/detail/android-bootstrap.h>
#endif #endif
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
#include <osl/detail/emscripten-bootstrap.h> #include <osl/detail/emscripten-bootstrap.h>
#endif #endif
@@ -226,7 +226,7 @@ static OUString getIniFileName(bool overriding) {
? OUString("vnd.sun.star.pathname:/assets/fundamental.override.ini") ? OUString("vnd.sun.star.pathname:/assets/fundamental.override.ini")
: OUString("vnd.sun.star.pathname:/assets/rc"); : OUString("vnd.sun.star.pathname:/assets/rc");
resolvePathnameUrl(&fileName); resolvePathnameUrl(&fileName);
#elif defined(EMSCRIPTEN) #elif defined(__EMSCRIPTEN__)
fileName = overriding fileName = overriding
? OUString("vnd.sun.star.pathname:/instdir/program/fundamental.override.ini") ? OUString("vnd.sun.star.pathname:/instdir/program/fundamental.override.ini")
: OUString("vnd.sun.star.pathname:/instdir/program/sofficerc"); : OUString("vnd.sun.star.pathname:/instdir/program/sofficerc");
@@ -505,7 +505,7 @@ bool Bootstrap_Impl::getValue(
return true; return true;
} }
#if defined ANDROID || defined EMSCRIPTEN #if defined ANDROID || defined __EMSCRIPTEN__
if (key == "APP_DATA_DIR") if (key == "APP_DATA_DIR")
{ {
const char *app_data_dir = lo_get_app_data_dir(); const char *app_data_dir = lo_get_app_data_dir();
+1 -1
View File
@@ -828,7 +828,7 @@ void FastSaxParserImpl::parseStream(const InputSource& rStructSource)
rEntity.mxDocumentHandler->startDocument(); rEntity.mxDocumentHandler->startDocument();
} }
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
rEntity.mbEnableThreads = false; rEntity.mbEnableThreads = false;
#else #else
if (!getenv("SAX_DISABLE_THREADS") && !m_bDisableThreadedParser) if (!getenv("SAX_DISABLE_THREADS") && !m_bDisableThreadedParser)
+1 -1
View File
@@ -339,7 +339,7 @@ void importSheetFragments( WorkbookFragment& rWorkbookHandler, SheetFragmentVect
nSheetsLeft++; nSheetsLeft++;
} }
#if defined EMSCRIPTEN && !HAVE_EMSCRIPTEN_JSPI #if defined __EMSCRIPTEN__ && !HAVE_EMSCRIPTEN_JSPI
// Hack around Application::Yield() deliberately calling std::abort() in the standard (non-JSPI) // Hack around Application::Yield() deliberately calling std::abort() in the standard (non-JSPI)
// Emscripten case; so instead of yielding (which implicitly releases the SolarMutex), just // Emscripten case; so instead of yielding (which implicitly releases the SolarMutex), just
// release the SolarMutex so that the WorkerThreads can proceed: // release the SolarMutex so that the WorkerThreads can proceed:
+1 -1
View File
@@ -113,7 +113,7 @@ SfxApplication* SfxApplication::GetOrCreate()
#if HAVE_FEATURE_XMLHELP #if HAVE_FEATURE_XMLHELP
Application::SetHelp( pSfxHelp ); Application::SetHelp( pSfxHelp );
#endif #endif
#if HAVE_FEATURE_XMLHELP || defined(EMSCRIPTEN) #if HAVE_FEATURE_XMLHELP || defined(__EMSCRIPTEN__)
bool bHelpTip = officecfg::Office::Common::Help::Tip::get(); bool bHelpTip = officecfg::Office::Common::Help::Tip::get();
bool bExtendedHelpTip = officecfg::Office::Common::Help::ExtendedTip::get(); bool bExtendedHelpTip = officecfg::Office::Common::Help::ExtendedTip::get();
if (bHelpTip) if (bHelpTip)
+2 -2
View File
@@ -1937,7 +1937,7 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, c
css::uno::Reference< css::frame::XPopupMenuController > xPopupController( css::uno::Reference< css::frame::XPopupMenuController > xPopupController(
xContext->getServiceManager()->createInstanceWithArgumentsAndContext( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
u"com.sun.star.comp.framework.ResourceMenuController"_ustr, aArgs, xContext ), css::uno::UNO_QUERY ); u"com.sun.star.comp.framework.ResourceMenuController"_ustr, aArgs, xContext ), css::uno::UNO_QUERY );
#if defined EMSCRIPTEN && ENABLE_QT5 #if defined __EMSCRIPTEN__ && ENABLE_QT5
// At least under Emscripten with Qt5, the QMenu::exec underlying the below call to // At least under Emscripten with Qt5, the QMenu::exec underlying the below call to
// xPopupMenu->execute returns immediately, without going into a new event loop, and we need to // xPopupMenu->execute returns immediately, without going into a new event loop, and we need to
// keep the underlying QMenu instance alive via the static lastPopupController chain here, until // keep the underlying QMenu instance alive via the static lastPopupController chain here, until
@@ -1990,7 +1990,7 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, c
} }
} }
#if !(defined EMSCRIPTEN && ENABLE_QT5) #if !(defined __EMSCRIPTEN__ && ENABLE_QT5)
css::uno::Reference< css::lang::XComponent > xComponent( xPopupController, css::uno::UNO_QUERY ); css::uno::Reference< css::lang::XComponent > xComponent( xPopupController, css::uno::UNO_QUERY );
if ( xComponent.is() ) if ( xComponent.is() )
xComponent->dispose(); xComponent->dispose();
+4 -4
View File
@@ -40,7 +40,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
#include <emscripten/threading.h> #include <emscripten/threading.h>
#include <rtl/uri.hxx> #include <rtl/uri.hxx>
extern void execute_browser(const char* sUrl); extern void execute_browser(const char* sUrl);
@@ -54,7 +54,7 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::system::SystemShellExecuteFlags; using namespace ::com::sun::star::system::SystemShellExecuteFlags;
using namespace cppu; using namespace cppu;
#ifndef EMSCRIPTEN #ifndef __EMSCRIPTEN__
namespace namespace
{ {
void escapeForShell( OStringBuffer & rBuffer, const OString & rURL) void escapeForShell( OStringBuffer & rBuffer, const OString & rURL)
@@ -80,7 +80,7 @@ ShellExec::ShellExec( const Reference< XComponentContext >& xContext ) :
void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aParameter, sal_Int32 nFlags ) void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aParameter, sal_Int32 nFlags )
{ {
#ifndef EMSCRIPTEN #ifndef __EMSCRIPTEN__
OStringBuffer aBuffer, aLaunchBuffer; OStringBuffer aBuffer, aLaunchBuffer;
if (comphelper::LibreOfficeKit::isActive()) if (comphelper::LibreOfficeKit::isActive())
@@ -266,7 +266,7 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
int nerr = errno; int nerr = errno;
throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ), throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ),
static_cast < XSystemShellExecute * > (this), nerr ); static_cast < XSystemShellExecute * > (this), nerr );
#else // EMSCRIPTEN #else // __EMSCRIPTEN__
(void)nFlags; (void)nFlags;
css::uno::Reference< css::uri::XUriReference > uri( css::uno::Reference< css::uri::XUriReference > uri(
+1 -1
View File
@@ -29,7 +29,7 @@ gb_AR := $(AR)
endif endif
gb_OSDEFS := \ gb_OSDEFS := \
-D$(OS) \ $(if $(filter-out EMSCRIPTEN,$(OS)),-D$(OS)) \
-D_PTHREADS \ -D_PTHREADS \
-DUNIX \ -DUNIX \
-DUNX \ -DUNX \
@@ -6,7 +6,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
#include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XModel.hpp>
#include <emscripten.h> #include <emscripten.h>
@@ -38,7 +38,7 @@ namespace tools
{ {
void extendApplicationEnvironment() void extendApplicationEnvironment()
{ {
#if defined UNX && !defined EMSCRIPTEN #if defined UNX && !defined __EMSCRIPTEN__
// Try to set RLIMIT_NOFILE as large as possible (failure is harmless): // Try to set RLIMIT_NOFILE as large as possible (failure is harmless):
rlimit lim; rlimit lim;
if (getrlimit(RLIMIT_NOFILE, &lim) == 0) if (getrlimit(RLIMIT_NOFILE, &lim) == 0)
+2 -2
View File
@@ -57,7 +57,7 @@
#include <osl/detail/android-bootstrap.h> #include <osl/detail/android-bootstrap.h>
#endif #endif
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
#include <osl/detail/emscripten-bootstrap.h> #include <osl/detail/emscripten-bootstrap.h>
#endif #endif
@@ -125,7 +125,7 @@ namespace Translate
gen.characters(boost::locale::char_facet_t::char_f); gen.characters(boost::locale::char_facet_t::char_f);
gen.categories(boost::locale::category_t::message | boost::locale::category_t::information); gen.categories(boost::locale::category_t::message | boost::locale::category_t::information);
#endif #endif
#if defined(ANDROID) || defined(EMSCRIPTEN) #if defined(ANDROID) || defined(__EMSCRIPTEN__)
OString sPath(OString(lo_get_app_data_dir()) + "/program/resource"); OString sPath(OString(lo_get_app_data_dir()) + "/program/resource");
#else #else
OUString uri(u"$BRAND_BASE_DIR/$BRAND_SHARE_RESOURCE_SUBDIR/"_ustr); OUString uri(u"$BRAND_BASE_DIR/$BRAND_SHARE_RESOURCE_SUBDIR/"_ustr);
+6 -6
View File
@@ -21,7 +21,7 @@
#include <mutex> #include <mutex>
#if !defined(ANDROID) && !defined(IOS) && !defined(EMSCRIPTEN) && !defined(_WIN32) #if !defined(ANDROID) && !defined(IOS) && !defined(__EMSCRIPTEN__) && !defined(_WIN32)
#include <pthread.h> #include <pthread.h>
#endif #endif
@@ -52,7 +52,7 @@
#include <tools/time.hxx> #include <tools/time.hxx>
#include <o3tl/unreachable.hxx> #include <o3tl/unreachable.hxx>
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
#include <emscripten.h> #include <emscripten.h>
#endif #endif
@@ -75,7 +75,7 @@ do { \
#define DBG_TESTSVPYIELDMUTEX() ((void)0) #define DBG_TESTSVPYIELDMUTEX() ((void)0)
#endif #endif
#if !defined(ANDROID) && !defined(IOS) && !defined(EMSCRIPTEN) #if !defined(ANDROID) && !defined(IOS) && !defined(__EMSCRIPTEN__)
static void atfork_child() static void atfork_child()
{ {
@@ -96,10 +96,10 @@ SvpSalInstance::SvpSalInstance(std::unique_ptr<SalYieldMutex> pMutex, SalData* p
m_MainThread = osl::Thread::getCurrentIdentifier(); m_MainThread = osl::Thread::getCurrentIdentifier();
if( s_pDefaultInstance == nullptr ) if( s_pDefaultInstance == nullptr )
s_pDefaultInstance = this; s_pDefaultInstance = this;
#if !defined(ANDROID) && !defined(IOS) && !defined(EMSCRIPTEN) && !defined(_WIN32) #if !defined(ANDROID) && !defined(IOS) && !defined(__EMSCRIPTEN__) && !defined(_WIN32)
pthread_atfork(nullptr, nullptr, atfork_child); pthread_atfork(nullptr, nullptr, atfork_child);
#endif #endif
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
ImplGetSVData()->maAppData.m_bUseSystemLoop = true; ImplGetSVData()->maAppData.m_bUseSystemLoop = true;
#endif #endif
} }
@@ -298,7 +298,7 @@ void SvpSalInstance::ProcessEvent( SalUserEvent aEvent )
pMutex->m_NonMainWaitingYieldCond.set(); pMutex->m_NonMainWaitingYieldCond.set();
} }
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
static void loop(void * arg) { static void loop(void * arg) {
SolarMutexGuard g; SolarMutexGuard g;
+1 -1
View File
@@ -96,7 +96,7 @@ class VCL_DLLPUBLIC SvpSalInstance : public SalGenericInstance, public SalUserEv
virtual void TriggerUserEventProcessing() override; virtual void TriggerUserEventProcessing() override;
virtual void ProcessEvent( SalUserEvent aEvent ) override; virtual void ProcessEvent( SalUserEvent aEvent ) override;
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
bool DoExecute(int &nExitCode) override; bool DoExecute(int &nExitCode) override;
void DoQuit() override; void DoQuit() override;
#endif #endif
+5 -3
View File
@@ -58,7 +58,8 @@ class QApplication;
class SalYieldMutex; class SalYieldMutex;
class SalFrame; class SalFrame;
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
namespace comphelper::emscriptenthreading namespace comphelper::emscriptenthreading
{ {
struct Data; struct Data;
@@ -103,7 +104,8 @@ class VCLPLUG_QT_PUBLIC QtInstance : public QObject,
QtFrame* m_pActivePopup; QtFrame* m_pActivePopup;
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
comphelper::emscriptenthreading::Data* m_emscriptenThreadingData; comphelper::emscriptenthreading::Data* m_emscriptenThreadingData;
#endif #endif
@@ -191,7 +193,7 @@ public:
CreateColorChooserDialog(weld::Window* pParent, vcl::ColorPickerMode eMode) override; CreateColorChooserDialog(weld::Window* pParent, vcl::ColorPickerMode eMode) override;
// so we fall back to the default abort, instead of duplicating it... // so we fall back to the default abort, instead of duplicating it...
#ifndef EMSCRIPTEN #ifndef __EMSCRIPTEN__
virtual OpenGLContext* CreateOpenGLContext() override; virtual OpenGLContext* CreateOpenGLContext() override;
#endif #endif
+6 -6
View File
@@ -26,7 +26,7 @@
#include <map> #include <map>
#include <utility> #include <utility>
#if defined EMSCRIPTEN && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if defined __EMSCRIPTEN__ && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <com/sun/star/io/IOException.hpp> #include <com/sun/star/io/IOException.hpp>
#include <comphelper/diagnose_ex.hxx> #include <comphelper/diagnose_ex.hxx>
#include <emscripten.h> #include <emscripten.h>
@@ -73,7 +73,7 @@ void QtClipboard::flushClipboard()
css::uno::Reference<css::datatransfer::XTransferable> QtClipboard::getContents() css::uno::Reference<css::datatransfer::XTransferable> QtClipboard::getContents()
{ {
#if defined(EMSCRIPTEN) #if defined(__EMSCRIPTEN__)
static QMimeData aMimeData; static QMimeData aMimeData;
#endif #endif
osl::MutexGuard aGuard(m_aMutex); osl::MutexGuard aGuard(m_aMutex);
@@ -86,7 +86,7 @@ css::uno::Reference<css::datatransfer::XTransferable> QtClipboard::getContents()
// check if we can still use the shared QtClipboardTransferable // check if we can still use the shared QtClipboardTransferable
const QMimeData* pMimeData = QApplication::clipboard()->mimeData(m_eClipboardMode); const QMimeData* pMimeData = QApplication::clipboard()->mimeData(m_eClipboardMode);
#if defined(EMSCRIPTEN) #if defined(__EMSCRIPTEN__)
if (!pMimeData) if (!pMimeData)
pMimeData = &aMimeData; pMimeData = &aMimeData;
#endif #endif
@@ -136,7 +136,7 @@ void QtClipboard::setContents(
aGuard.clear(); aGuard.clear();
#if defined EMSCRIPTEN && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if defined __EMSCRIPTEN__ && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// At least Qt5, in QWasmEventTranslator::processKeyboard in qbase // At least Qt5, in QWasmEventTranslator::processKeyboard in qbase
// src/plugins/platforms/wasm/qwasmeventtranslator.cpp, listens for Ctrl-C and initiates a // src/plugins/platforms/wasm/qwasmeventtranslator.cpp, listens for Ctrl-C and initiates a
// browser Clipboard API writeText call, but (a) calls it before LO has sent the to-be-copied // browser Clipboard API writeText call, but (a) calls it before LO has sent the to-be-copied
@@ -196,7 +196,7 @@ void QtClipboard::handleChanged(QClipboard::Mode eMode)
if (qobject_cast<const QtMimeData*>(mimeData)) if (qobject_cast<const QtMimeData*>(mimeData))
return; return;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined EMSCRIPTEN #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && defined __EMSCRIPTEN__
// At least for the Qt5 Wasm backend, copying text from LO and then pasting it back into LO // At least for the Qt5 Wasm backend, copying text from LO and then pasting it back into LO
// will, for whatever reason, call here with an empty text/plain mimeData; while that // will, for whatever reason, call here with an empty text/plain mimeData; while that
// doesn't seem to be an issue at least with the current upstream Qt6 dev branch (again, for // doesn't seem to be an issue at least with the current upstream Qt6 dev branch (again, for
@@ -287,7 +287,7 @@ bool QtClipboard::isOwner(const QClipboard::Mode aMode)
{ {
return true; return true;
} }
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
// QWasmClipboard::ownsMode (in qtbase/src/plugins/platforms/wasm/qwasmclipboard.cpp, // QWasmClipboard::ownsMode (in qtbase/src/plugins/platforms/wasm/qwasmclipboard.cpp,
// which is the actual implementation of the above ownsClipboard call) unconditionally // which is the actual implementation of the above ownsClipboard call) unconditionally
// returns false, so as a hack use "m_aContents is a LO-internal XTransferable type" as // returns false, so as a hack use "m_aContents is a LO-internal XTransferable type" as
+1 -1
View File
@@ -667,7 +667,7 @@ void QtFrame::ShowFullScreen(bool bFullScreen, sal_Int32 nScreen)
void QtFrame::StartPresentation(bool bStart) void QtFrame::StartPresentation(bool bStart)
{ {
#if defined LINUX || defined __sun || defined FREEBSD || defined OPENBSD #if !defined __EMSCRIPTEN__
#if CHECK_QT5_USING_X11 #if CHECK_QT5_USING_X11
unsigned int nRootWindow(0); unsigned int nRootWindow(0);
std::optional<Display*> aDisplay; std::optional<Display*> aDisplay;
+20 -13
View File
@@ -77,7 +77,7 @@
#include <QtWidgets/QWidget> #include <QtWidgets/QWidget>
#include <QtWidgets/QMessageBox> #include <QtWidgets/QMessageBox>
#ifdef EMSCRIPTEN #ifdef __EMSCRIPTEN__
#include <QtCore/QtPlugin> #include <QtCore/QtPlugin>
Q_IMPORT_PLUGIN(QWasmIntegrationPlugin) Q_IMPORT_PLUGIN(QWasmIntegrationPlugin)
#if defined DISABLE_DYNLOADING && ENABLE_QT6 #if defined DISABLE_DYNLOADING && ENABLE_QT6
@@ -85,7 +85,8 @@ Q_IMPORT_PLUGIN(QWasmIntegrationPlugin)
#endif #endif
#endif #endif
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
#include <emscripten/promise.h> #include <emscripten/promise.h>
#include <emscripten/proxying.h> #include <emscripten/proxying.h>
#include <emscripten/threading.h> #include <emscripten/threading.h>
@@ -215,7 +216,8 @@ void QtInstance::RunInMainThread(std::function<void()> func)
func(); func();
return; return;
} }
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
if (pthread_self() == m_emscriptenThreadingData->eventHandlerThread) if (pthread_self() == m_emscriptenThreadingData->eventHandlerThread)
{ {
EmscriptenLightweightRunInMainThread(func); EmscriptenLightweightRunInMainThread(func);
@@ -243,7 +245,8 @@ void QtInstance::RunInMainThread(std::function<void()> func)
void QtInstance::EmscriptenLightweightRunInMainThread_(std::function<void()> func) void QtInstance::EmscriptenLightweightRunInMainThread_(std::function<void()> func)
{ {
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
if (pthread_self() != emscripten_main_runtime_thread_id()) if (pthread_self() != emscripten_main_runtime_thread_id())
{ {
SolarMutexReleaser release; SolarMutexReleaser release;
@@ -286,7 +289,8 @@ QtInstance::QtInstance()
{ {
m_pQApplication = CreateQApplication(); m_pQApplication = CreateQApplication();
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
m_emscriptenThreadingData = &comphelper::emscriptenthreading::getData(); m_emscriptenThreadingData = &comphelper::emscriptenthreading::getData();
#endif #endif
@@ -334,7 +338,7 @@ QtInstance::QtInstance()
&QtInstance::colorSchemeChanged); &QtInstance::colorSchemeChanged);
#endif #endif
#ifndef EMSCRIPTEN #ifndef __EMSCRIPTEN__
m_bSupportsOpenGL = true; m_bSupportsOpenGL = true;
#elif !HAVE_EMSCRIPTEN_JSPI #elif !HAVE_EMSCRIPTEN_JSPI
ImplGetSVData()->maAppData.m_bUseSystemLoop = true; ImplGetSVData()->maAppData.m_bUseSystemLoop = true;
@@ -347,7 +351,8 @@ QtInstance::~QtInstance()
// as it uses references to the provided arguments! // as it uses references to the provided arguments!
m_pQApplication.reset(); m_pQApplication.reset();
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
comphelper::emscriptenthreading::tearDown(); comphelper::emscriptenthreading::tearDown();
#endif #endif
} }
@@ -474,7 +479,8 @@ bool QtInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents)
if (bWasEvent) if (bWasEvent)
m_aWaitingYieldCond.set(); m_aWaitingYieldCond.set();
} }
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
else if (pthread_self() == m_emscriptenThreadingData->eventHandlerThread) else if (pthread_self() == m_emscriptenThreadingData->eventHandlerThread)
{ {
SolarMutexReleaser release; SolarMutexReleaser release;
@@ -523,7 +529,7 @@ bool QtInstance::AnyInput(VclInputFlags nType)
void QtInstance::AddToRecentDocumentList(const OUString&, const OUString&, const OUString&) {} void QtInstance::AddToRecentDocumentList(const OUString&, const OUString&, const OUString&) {}
#ifndef EMSCRIPTEN #ifndef __EMSCRIPTEN__
OpenGLContext* QtInstance::CreateOpenGLContext() { return new QtOpenGLContext; } OpenGLContext* QtInstance::CreateOpenGLContext() { return new QtOpenGLContext; }
#endif #endif
@@ -540,7 +546,8 @@ void QtInstance::TriggerUserEventProcessing()
void QtInstance::ProcessEvent(SalUserEvent aEvent) void QtInstance::ProcessEvent(SalUserEvent aEvent)
{ {
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
SolarMutexReleaser release; SolarMutexReleaser release;
(void)emscripten_promise_await( (void)emscripten_promise_await(
emscripten_proxy_promise(m_emscriptenThreadingData->proxyingQueue.queue, emscripten_proxy_promise(m_emscriptenThreadingData->proxyingQueue.queue,
@@ -821,13 +828,13 @@ bool QtInstance::DoExecute(int& nExitCode)
const bool bIsUseSystemEventLoop = Application::IsUseSystemEventLoop(); const bool bIsUseSystemEventLoop = Application::IsUseSystemEventLoop();
if (bIsUseSystemEventLoop) if (bIsUseSystemEventLoop)
{ {
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
// For Emscripten, QApplication::exec() will unwind the stack by throwing a JavaScript // For Emscripten, QApplication::exec() will unwind the stack by throwing a JavaScript
// exception, so we need to manually undo the call of AcquireYieldMutex() done in InitVCL: // exception, so we need to manually undo the call of AcquireYieldMutex() done in InitVCL:
ReleaseYieldMutex(false); ReleaseYieldMutex(false);
#endif #endif
nExitCode = QApplication::exec(); nExitCode = QApplication::exec();
#if defined EMSCRIPTEN #if defined __EMSCRIPTEN__
O3TL_UNREACHABLE; O3TL_UNREACHABLE;
#endif #endif
} }
@@ -984,7 +991,7 @@ QtInstance::CreateColorChooserDialog(weld::Window* pParent, vcl::ColorPickerMode
static void initResources() static void initResources()
{ {
#if defined EMSCRIPTEN && defined DISABLE_DYNLOADING && ENABLE_QT6 #if defined __EMSCRIPTEN__ && defined DISABLE_DYNLOADING && ENABLE_QT6
// Make sure the resources from Qt6's plugins/platforms/libqwasm.a are not stripped out of a // Make sure the resources from Qt6's plugins/platforms/libqwasm.a are not stripped out of a
// statically linked binary (and this code cannot be directly in extern "C" create_SalInstance, // statically linked binary (and this code cannot be directly in extern "C" create_SalInstance,
// as the expansion of Q_INIT_RESOURCE contains extern function declarations that would then // as the expansion of Q_INIT_RESOURCE contains extern function declarations that would then
+1 -1
View File
@@ -21,7 +21,7 @@ QtMainWindow::QtMainWindow(QtFrame& rFrame, Qt::WindowFlags f)
: QMainWindow(nullptr, f) : QMainWindow(nullptr, f)
, m_rFrame(rFrame) , m_rFrame(rFrame)
{ {
#ifndef EMSCRIPTEN #ifndef __EMSCRIPTEN__
QAccessible::installFactory(QtAccessibleWidget::customFactory); QAccessible::installFactory(QtAccessibleWidget::customFactory);
#endif #endif
} }
+2 -1
View File
@@ -42,7 +42,8 @@ QtTimer::QtTimer()
void QtTimer::timeoutActivated() void QtTimer::timeoutActivated()
{ {
#if !(defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD) #if !(defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI \
&& !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD)
//TODO: While the special Emscripten Qt6 JSPI/non-PROXY_TO_PTHREAD mode doesn't lock the //TODO: While the special Emscripten Qt6 JSPI/non-PROXY_TO_PTHREAD mode doesn't lock the
// SolarMutex here, but only when calling pTask->Invoke() in Scheduler::CallbackTaskScheduling, // SolarMutex here, but only when calling pTask->Invoke() in Scheduler::CallbackTaskScheduling,
// that looks too brittle in general, so treat that special mode specially here. // that looks too brittle in general, so treat that special mode specially here.
+3 -3
View File
@@ -297,7 +297,7 @@ QStringList QtMimeData::formats() const
for (const auto& rFlavor : aFormats) for (const auto& rFlavor : aFormats)
{ {
#if !(QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && defined EMSCRIPTEN) #if !(QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && defined __EMSCRIPTEN__)
aList << toQString(rFlavor.MimeType); aList << toQString(rFlavor.MimeType);
#endif #endif
lcl_textMimeInfo(rFlavor.MimeType, m_bHaveNoCharset, bHaveUTF16, m_bHaveUTF8); lcl_textMimeInfo(rFlavor.MimeType, m_bHaveNoCharset, bHaveUTF16, m_bHaveUTF8);
@@ -306,7 +306,7 @@ QStringList QtMimeData::formats() const
// we provide a locale encoded and a UTF-8 variant, if missing // we provide a locale encoded and a UTF-8 variant, if missing
if (m_bHaveNoCharset || bHaveUTF16 || m_bHaveUTF8) if (m_bHaveNoCharset || bHaveUTF16 || m_bHaveUTF8)
{ {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && defined EMSCRIPTEN #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && defined __EMSCRIPTEN__
aList << QStringLiteral("text/plain"); aList << QStringLiteral("text/plain");
#else #else
// if there is a text representation from LO point of view, it'll be UTF-16 // if there is a text representation from LO point of view, it'll be UTF-16
@@ -317,7 +317,7 @@ QStringList QtMimeData::formats() const
aList << QStringLiteral("text/plain"); aList << QStringLiteral("text/plain");
#endif #endif
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && defined EMSCRIPTEN #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) && defined __EMSCRIPTEN__
else if (aFormats.hasElements()) else if (aFormats.hasElements())
{ {
aList << toQString(aFormats[0].MimeType); aList << toQString(aFormats[0].MimeType);
+1 -1
View File
@@ -367,7 +367,7 @@ DesktopType SalGetDesktopEnvironment()
return DesktopType::Windows; return DesktopType::Windows;
#elif defined(MACOSX) #elif defined(MACOSX)
return DesktopType::macOS; return DesktopType::macOS;
#elif defined(EMSCRIPTEN) #elif defined(__EMSCRIPTEN__)
return DesktopType::WASM; return DesktopType::WASM;
#elif defined(ANDROID) #elif defined(ANDROID)
return DesktopType::Android; return DesktopType::Android;
+2 -2
View File
@@ -409,7 +409,7 @@ void Scheduler::CallbackTaskScheduling()
ImplSVData *pSVData = ImplGetSVData(); ImplSVData *pSVData = ImplGetSVData();
ImplSchedulerContext &rSchedCtx = pSVData->maSchedCtx; ImplSchedulerContext &rSchedCtx = pSVData->maSchedCtx;
#if !(defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD) #if !(defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD)
//TODO: While the special Emscripten Qt6 JSPI/non-PROXY_TO_PTHREAD mode doesn't lock the //TODO: While the special Emscripten Qt6 JSPI/non-PROXY_TO_PTHREAD mode doesn't lock the
// SolarMutex in QtTimer::timeoutActivated, but only down below when calling pTask->Invoke(), // SolarMutex in QtTimer::timeoutActivated, but only down below when calling pTask->Invoke(),
// that looks too brittle in general, so treat that special mode specially here. // that looks too brittle in general, so treat that special mode specially here.
@@ -593,7 +593,7 @@ void Scheduler::CallbackTaskScheduling()
{ {
// prepare Scheduler object for deletion after handling // prepare Scheduler object for deletion after handling
pTask->SetDeletionFlags(); pTask->SetDeletionFlags();
#if defined EMSCRIPTEN && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD #if defined __EMSCRIPTEN__ && ENABLE_QT6 && HAVE_EMSCRIPTEN_JSPI && !HAVE_EMSCRIPTEN_PROXY_TO_PTHREAD
if (pTask->DecideTransferredExecution()) if (pTask->DecideTransferredExecution())
{ {
auto & data = comphelper::emscriptenthreading::getData(); auto & data = comphelper::emscriptenthreading::getData();
+1 -1
View File
@@ -1253,7 +1253,7 @@ OUString Application::GetHWOSConfInfo(const int bSelection, const bool bLocalize
#endif #endif
appendDetails(u"", Localize(SV_APP_DEFAULT, bLocalize)); appendDetails(u"", Localize(SV_APP_DEFAULT, bLocalize));
#if (defined LINUX || defined _WIN32 || defined MACOSX || defined __FreeBSD__ || defined EMSCRIPTEN) #if (defined LINUX || defined _WIN32 || defined MACOSX || defined __FreeBSD__ || defined __EMSCRIPTEN__)
appendDetails(u"; ", SV_APP_VCLBACKEND + GetToolkitName()); appendDetails(u"; ", SV_APP_VCLBACKEND + GetToolkitName());
#endif #endif
} }
+2 -2
View File
@@ -1134,7 +1134,7 @@ void VclBuilderPreload()
extern "C" VclBuilder::customMakeWidget lo_get_custom_widget_func(const char* name); extern "C" VclBuilder::customMakeWidget lo_get_custom_widget_func(const char* name);
#elif defined EMSCRIPTEN && !ENABLE_QT5 #elif defined __EMSCRIPTEN__ && !ENABLE_QT5
// This branch is mainly for building for WASM, and especially for // This branch is mainly for building for WASM, and especially for
// Collabora Online in the browser, where code from core and Collabora // Collabora Online in the browser, where code from core and Collabora
@@ -1222,7 +1222,7 @@ VclBuilder::customMakeWidget GetCustomMakeWidget(const OUString& rName)
else else
pFunction = reinterpret_cast<VclBuilder::customMakeWidget>( pFunction = reinterpret_cast<VclBuilder::customMakeWidget>(
aI->second->getFunctionSymbol(sFunction)); aI->second->getFunctionSymbol(sFunction));
#elif !HAVE_FEATURE_DESKTOP || (defined EMSCRIPTEN && !ENABLE_QT5) #elif !HAVE_FEATURE_DESKTOP || (defined __EMSCRIPTEN__ && !ENABLE_QT5)
// This ifdef branch is mainly for building for either the // This ifdef branch is mainly for building for either the
// Android or iOS apps, or the Collabora Online as WASM thing. // Android or iOS apps, or the Collabora Online as WASM thing.
pFunction = lo_get_custom_widget_func(sFunction.toUtf8().getStr()); pFunction = lo_get_custom_widget_func(sFunction.toUtf8().getStr());
+2 -2
View File
@@ -25,7 +25,7 @@
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
# include <sys/utsname.h> # include <sys/utsname.h>
#endif #endif
#if defined(EMSCRIPTEN) #if defined(__EMSCRIPTEN__)
#include <emscripten/version.h> #include <emscripten/version.h>
#endif #endif
@@ -77,7 +77,7 @@ OUString SalGenericInstance::getOSVersion()
break; break;
} }
aKernelVer = OUString::createFromAscii(stName.sysname) + " " + aKernelVer.copy(0, nIndex); aKernelVer = OUString::createFromAscii(stName.sysname) + " " + aKernelVer.copy(0, nIndex);
#elif defined(EMSCRIPTEN) #elif defined(__EMSCRIPTEN__)
#if defined __EMSCRIPTEN_MAJOR__ #if defined __EMSCRIPTEN_MAJOR__
aKernelVer = u"Emscripten "_ustr + OUString::number(__EMSCRIPTEN_MAJOR__) + u"."_ustr aKernelVer = u"Emscripten "_ustr + OUString::number(__EMSCRIPTEN_MAJOR__) + u"."_ustr
+ OUString::number(__EMSCRIPTEN_MINOR__) + u"."_ustr + OUString::number(__EMSCRIPTEN_MINOR__) + u"."_ustr