From 811769f009ec431ba622fc8a89eb1642dfd43568 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 31 Mar 2026 22:10:42 +0200 Subject: [PATCH] Consistently use __EMSCRIPTEN__ instead of EMSCRIPTEN macro ...as emsdk 5.0.3 deprecated the predefined EMSCRIPTEN macro (see "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 Tested-by: Jenkins CPCI (cherry picked from commit 50291c2ed83bdb49bb827a4a12905d94b8c42035) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205167 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- .../source/misc/emscriptenthreading.cxx | 3 +- cppuhelper/source/paths.cxx | 4 +-- desktop/inc/initjsunoscripting.hxx | 2 +- desktop/source/app/app.cxx | 8 ++--- desktop/source/app/appinit.cxx | 4 +-- desktop/source/app/initjsunoscripting.cxx | 2 +- desktop/source/app/officeipcthread.cxx | 2 +- desktop/source/app/sofficemain.cxx | 2 +- desktop/source/app/userinstall.cxx | 6 ++-- desktop/source/deployment/misc/dp_misc.cxx | 4 +-- desktop/source/lib/init.cxx | 6 ++-- .../source/helper/statusindicatorfactory.cxx | 2 +- .../source/languagetag/languagetag.cxx | 4 +-- i18nutil/source/utility/paper.cxx | 2 +- idl/source/objects/types.cxx | 2 +- include/comphelper/emscriptenthreading.hxx | 3 +- include/comphelper/threadpool.hxx | 2 +- include/osl/detail/emscripten-bootstrap.h | 4 +-- include/osl/endian.h | 2 +- include/sal/alloca.h | 2 +- include/sal/config.h | 2 +- include/systools/curlinit.hxx | 2 +- package/source/zipapi/ZipFile.cxx | 2 +- sal/osl/unx/nlsupport.cxx | 4 +-- sal/osl/unx/process_impl.cxx | 2 +- sal/osl/unx/security.cxx | 4 +-- sal/osl/unx/system.hxx | 4 +-- sal/osl/unx/uunxapi.cxx | 4 +-- sal/rtl/bootstrap.cxx | 6 ++-- sax/source/fastparser/fastparser.cxx | 2 +- sc/source/filter/oox/workbookfragment.cxx | 2 +- sfx2/source/appl/app.cxx | 2 +- sfx2/source/control/dispatch.cxx | 4 +-- shell/source/unix/exec/shellexec.cxx | 8 ++--- solenv/gbuild/platform/unxgcc.mk | 2 +- .../unoembindhelpers/PrimaryBindings.cxx | 2 +- .../misc/extendapplicationenvironment.cxx | 2 +- unotools/source/i18n/resmgr.cxx | 4 +-- vcl/headless/svpinst.cxx | 12 +++---- vcl/inc/headless/svpinst.hxx | 2 +- vcl/inc/qt5/QtInstance.hxx | 8 +++-- vcl/qt5/QtClipboard.cxx | 12 +++---- vcl/qt5/QtFrame.cxx | 2 +- vcl/qt5/QtInstance.cxx | 33 +++++++++++-------- vcl/qt5/QtMainWindow.cxx | 2 +- vcl/qt5/QtTimer.cxx | 3 +- vcl/qt5/QtTransferable.cxx | 6 ++-- vcl/source/app/salplug.cxx | 2 +- vcl/source/app/scheduler.cxx | 4 +-- vcl/source/app/svapp.cxx | 2 +- vcl/source/window/builder.cxx | 4 +-- vcl/unx/generic/app/geninst.cxx | 4 +-- 52 files changed, 116 insertions(+), 104 deletions(-) diff --git a/comphelper/source/misc/emscriptenthreading.cxx b/comphelper/source/misc/emscriptenthreading.cxx index 3c33fc47b5f5..730503d1eef2 100644 --- a/comphelper/source/misc/emscriptenthreading.cxx +++ b/comphelper/source/misc/emscriptenthreading.cxx @@ -12,7 +12,8 @@ #include #include -#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 diff --git a/cppuhelper/source/paths.cxx b/cppuhelper/source/paths.cxx index 0a4ccf76e6ef..171a3013591e 100644 --- a/cppuhelper/source/paths.cxx +++ b/cppuhelper/source/paths.cxx @@ -34,7 +34,7 @@ namespace { -#if !(defined ANDROID || defined EMSCRIPTEN) +#if !(defined ANDROID || defined __EMSCRIPTEN__) OUString get_this_libpath() { static OUString s_uri = []() { OUString uri; @@ -61,7 +61,7 @@ OUString cppu::getUnoIniUri() { // and since rtlBootstrapHandle is not ref-counted doing anything // clean here is hardish. OUString uri("file:///assets/program"); -#elif defined(EMSCRIPTEN) +#elif defined(__EMSCRIPTEN__) OUString uri("file:///instdir/program"); #else OUString uri(get_this_libpath()); diff --git a/desktop/inc/initjsunoscripting.hxx b/desktop/inc/initjsunoscripting.hxx index ccfe9fd1d5fa..21039eea4024 100644 --- a/desktop/inc/initjsunoscripting.hxx +++ b/desktop/inc/initjsunoscripting.hxx @@ -11,7 +11,7 @@ #include -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ void initJsUnoScripting(); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index dfdb08a0080f..e93cbc04d19a 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -358,7 +358,7 @@ void RemoveIconCacheDirectory() namespace { -#if defined(DBG_UTIL) && !defined(EMSCRIPTEN) +#if defined(DBG_UTIL) && !defined(__EMSCRIPTEN__) void runGraphicsRenderTests() { if (comphelper::LibreOfficeKit::isActive()) @@ -532,7 +532,7 @@ void Desktop::Init() RequestHandler::Status aStatus = RequestHandler::Enable(true); if ( aStatus == RequestHandler::IPC_STATUS_PIPE_ERROR ) { -#if defined(ANDROID) || defined(EMSCRIPTEN) +#if defined(ANDROID) || defined(__EMSCRIPTEN__) // Ignore crack pipe errors on Android #else // Keep using this oddly named BE_PATHINFO_MISSING value @@ -1392,7 +1392,7 @@ int Desktop::Main() 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 // there is no other instance using our data files from a remote host @@ -1644,7 +1644,7 @@ int Desktop::Main() CheckOpenCLCompute(xDesktop); #endif -#if defined(DBG_UTIL) && !defined(EMSCRIPTEN) +#if defined(DBG_UTIL) && !defined(__EMSCRIPTEN__) //Running the VCL graphics rendering tests const char * pDisplay = std::getenv("DISPLAY"); if (!pDisplay || pDisplay[0] == ':') diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 8f92acecbb40..c1abcca75cef 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -45,7 +45,7 @@ #include #include -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ #include #endif @@ -85,7 +85,7 @@ void Desktop::InitApplicationServiceManager() UNO_QUERY_THROW); #endif comphelper::setProcessServiceFactory(sm); -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ initJsUnoScripting(); #endif } diff --git a/desktop/source/app/initjsunoscripting.cxx b/desktop/source/app/initjsunoscripting.cxx index a6939f838e8c..ec11e725e1f9 100644 --- a/desktop/source/app/initjsunoscripting.cxx +++ b/desktop/source/app/initjsunoscripting.cxx @@ -9,7 +9,7 @@ #include -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ #include #include diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 9c1a040768b2..f216bb5de074 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -668,7 +668,7 @@ RequestHandler::Status RequestHandler::Enable(bool ipc) if( pGlobal.is() ) 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; #endif diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index ac0f72ec5521..6ef54185b380 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -75,7 +75,7 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() #endif tools::extendApplicationEnvironment(); -#if defined EMSCRIPTEN && !HAVE_EMSCRIPTEN_JSPI +#if defined __EMSCRIPTEN__ && !HAVE_EMSCRIPTEN_JSPI //HACK: Qt5 QWasmEventDispatcher::processEvents // (qtbase/src/plugins/platforms/wasm/qwasmeventdispatcher.cpp) calls // emscripten_set_main_loop_arg with simulateInfiniteLoop == true, and as we use diff --git a/desktop/source/app/userinstall.cxx b/desktop/source/app/userinstall.cxx index 7243db43e691..9deea8b7da43 100644 --- a/desktop/source/app/userinstall.cxx +++ b/desktop/source/app/userinstall.cxx @@ -27,7 +27,7 @@ #include #include #include -#if defined ANDROID || defined IOS || defined EMSCRIPTEN +#if defined ANDROID || defined IOS || defined __EMSCRIPTEN__ #include #endif #include @@ -40,7 +40,7 @@ namespace desktop::userinstall { namespace { -#if !(defined ANDROID || defined IOS || defined EMSCRIPTEN) +#if !(defined ANDROID || defined IOS || defined __EMSCRIPTEN__) osl::FileBase::RC copyRecursive( 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) { return ERROR_OTHER; } -#if !(defined ANDROID || defined IOS || defined EMSCRIPTEN) +#if !(defined ANDROID || defined IOS || defined __EMSCRIPTEN__) #if defined UNIX // Set safer permissions for the user directory by default: osl::File::setAttributes( diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index be180c163fbc..0161452bbc93 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -70,7 +70,7 @@ std::shared_ptr & UnoRc() return theRc; }; -#if !defined EMSCRIPTEN +#if !defined __EMSCRIPTEN__ bool existsOfficePipe() { @@ -326,7 +326,7 @@ OUString generateOfficePipeId() bool office_is_running() { -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ return true; #else // i#82778: We need to check if we run within the office process. Then we must not use the pipe, diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7fcff604d4e0..60d42293799c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -47,7 +47,7 @@ #include #endif -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ #include #include #endif @@ -7958,7 +7958,7 @@ static bool initialize_uno(const OUString& aAppProgramURL) xSFactory.set(xFactory, uno::UNO_QUERY_THROW); comphelper::setProcessServiceFactory(xSFactory); -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ initJsUnoScripting(); #endif @@ -8534,7 +8534,7 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char } else { -#if defined ANDROID || defined EMSCRIPTEN +#if defined ANDROID || defined __EMSCRIPTEN__ aAppPath = OUString::fromUtf8(lo_get_app_data_dir()) + "/program"; #else // Fun conversion dance back and forth between URLs and system paths... diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 8351f1921667..3cc800515406 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -87,7 +87,7 @@ void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css:: } } -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ m_bDisableReschedule = true; #endif impl_createProgress(); diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 03d5bb73475b..4955512435ec 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -38,7 +38,7 @@ #include #endif -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ #include #endif @@ -221,7 +221,7 @@ void LiblangtagDataRef::teardown() void LiblangtagDataRef::setupDataPath() { -#if defined(ANDROID) || defined(EMSCRIPTEN) +#if defined(ANDROID) || defined(__EMSCRIPTEN__) maDataPath = OString(lo_get_app_data_dir()) + "/share/liblangtag"; #else // maDataPath is assumed to be empty here. diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx index 80fd4633c93e..e41adb2fa4ed 100644 --- a/i18nutil/source/utility/paper.cxx +++ b/i18nutil/source/utility/paper.cxx @@ -240,7 +240,7 @@ PaperInfo PaperInfo::getSystemDefaultPaper() if (bInitialized) return aInstance; -#if ! defined(MACOSX) && ! defined(EMSCRIPTEN) +#if ! defined(MACOSX) && ! defined(__EMSCRIPTEN__) // try libpaper // #i78617# workaround missing paperconf command FILE* pPipe = popen( "paperconf 2>/dev/null", "r" ); diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx index 8f6c949af531..56ee05400ffc 100644 --- a/idl/source/objects/types.cxx +++ b/idl/source/objects/types.cxx @@ -249,7 +249,7 @@ void SvMetaType::WriteSfxItem( // write the implementation part 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( "#endif" ) << endl; rOutStm.WriteOString( "constinit const " ).WriteOString( aTypeName ).WriteOString( aVarName ) diff --git a/include/comphelper/emscriptenthreading.hxx b/include/comphelper/emscriptenthreading.hxx index 9d0abc273feb..5fccc4eeeb20 100644 --- a/include/comphelper/emscriptenthreading.hxx +++ b/include/comphelper/emscriptenthreading.hxx @@ -14,7 +14,8 @@ #include #include -#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 diff --git a/include/comphelper/threadpool.hxx b/include/comphelper/threadpool.hxx index c5cc92944da9..e5483d919b0a 100644 --- a/include/comphelper/threadpool.hxx +++ b/include/comphelper/threadpool.hxx @@ -68,7 +68,7 @@ public: @param bJoin - if set call joinThreadsIfIdle() at the end */ void waitUntilDone(const std::shared_ptr&, bool bJoin = -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ false #else true diff --git a/include/osl/detail/emscripten-bootstrap.h b/include/osl/detail/emscripten-bootstrap.h index 580964253377..ae1b51a61fbc 100644 --- a/include/osl/detail/emscripten-bootstrap.h +++ b/include/osl/detail/emscripten-bootstrap.h @@ -9,7 +9,7 @@ #pragma once -#if defined(EMSCRIPTEN) +#if defined(__EMSCRIPTEN__) #ifdef __cplusplus extern "C" { @@ -21,6 +21,6 @@ const char *lo_get_app_data_dir(void); } #endif -#endif // EMSCRIPTEN +#endif // __EMSCRIPTEN__ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/osl/endian.h b/include/osl/endian.h index 8dd5387c0b84..00ad2352f740 100644 --- a/include/osl/endian.h +++ b/include/osl/endian.h @@ -67,7 +67,7 @@ extern "C" { # elif defined _BIG_ENDIAN # define OSL_BIGENDIAN # endif -#elif defined EMSCRIPTEN +#elif defined __EMSCRIPTEN__ # define OSL_LITENDIAN #else # error "Target platform not specified !" diff --git a/include/sal/alloca.h b/include/sal/alloca.h index 3e0c94942516..87df55c9f99f 100644 --- a/include/sal/alloca.h +++ b/include/sal/alloca.h @@ -25,7 +25,7 @@ #define INCLUDED_SAL_ALLOCA_H #if defined(__sun) || defined(LINUX) || defined(ANDROID) || defined(HAIKU) || defined(MACOSX) \ - || defined(IOS) || defined(EMSCRIPTEN) + || defined(IOS) || defined(__EMSCRIPTEN__) #ifndef INCLUDED_ALLOCA_H #include diff --git a/include/sal/config.h b/include/sal/config.h index f666fed23897..b2b71b26295c 100644 --- a/include/sal/config.h +++ b/include/sal/config.h @@ -83,7 +83,7 @@ #define SAL_CONFIGFILE(name) name "rc" #endif -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ #define SAL_UNX #define SAL_DLLEXTENSION ".bc" #define SAL_EXEEXTENSION "" diff --git a/include/systools/curlinit.hxx b/include/systools/curlinit.hxx index d97f84a80f8f..26e46d223165 100644 --- a/include/systools/curlinit.hxx +++ b/include/systools/curlinit.hxx @@ -36,7 +36,7 @@ static void InitCurl_easy(CURL* const pCURL) if (path == nullptr) { 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); #endif } diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx index be59ebfe1570..7a8536a41a8f 100644 --- a/package/source/zipapi/ZipFile.cxx +++ b/package/source/zipapi/ZipFile.cxx @@ -728,7 +728,7 @@ uno::Reference< XInputStream > ZipFile::createStreamForZipEntry( if (!bUseBufferedStream) return xSrcStream; -#ifndef EMSCRIPTEN +#ifndef __EMSCRIPTEN__ static const sal_Int32 nThreadingThreshold = 10000; // "encrypted-package" is the only data stream, no point in threading it diff --git a/sal/osl/unx/nlsupport.cxx b/sal/osl/unx/nlsupport.cxx index 263439e3097e..9964d6e1400c 100644 --- a/sal/osl/unx/nlsupport.cxx +++ b/sal/osl/unx/nlsupport.cxx @@ -30,7 +30,7 @@ #include "nlsupport.hxx" // 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) #define LO_COMMON_NLS_ARCHS 1 #else @@ -282,7 +282,7 @@ static const Pair nl_language_list[] = { /* XXX MS-874 is an extension to tis620, so this is not * really equivalent */ -#elif defined(LINUX) || defined(EMSCRIPTEN) +#elif defined(LINUX) || defined(__EMSCRIPTEN__) #if !defined(CODESET) #define CODESET _NL_CTYPE_CODESET_NAME diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 07eb239045ff..12a8a7add551 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -95,7 +95,7 @@ namespace { oslProcessError bootstrap_getExecutableFile(rtl_uString ** ppFileURL) { -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ // Just return some dummy file: URL for now to see what happens OUString fileURL = "vnd.sun.star.pathname:/instdir/program/soffice"; rtl_uString_acquire(fileURL.pData); diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx index 733aa0dfc6bf..006869235282 100644 --- a/sal/osl/unx/security.cxx +++ b/sal/osl/unx/security.cxx @@ -128,7 +128,7 @@ oslSecurity SAL_CALL osl_getCurrentSecurity() if (p == 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 (void) found; char * buffer = p->m_buffer; @@ -141,7 +141,7 @@ oslSecurity SAL_CALL osl_getCurrentSecurity() buffer += strlen(buffer) + 1; p->m_pPasswd.pw_uid = geteuid(); p->m_pPasswd.pw_gid = getegid(); -#if !defined(EMSCRIPTEN) +#if !defined(__EMSCRIPTEN__) p->m_pPasswd.pw_change = 0; strcpy(buffer, ""); p->m_pPasswd.pw_class = buffer; diff --git a/sal/osl/unx/system.hxx b/sal/osl/unx/system.hxx index 078fa348905e..f349170ed29b 100644 --- a/sal/osl/unx/system.hxx +++ b/sal/osl/unx/system.hxx @@ -209,7 +209,7 @@ int macxp_resolveAlias(char *path, int buflen); # define NO_PTHREAD_RTL #endif -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ # include # include # include @@ -231,7 +231,7 @@ int macxp_resolveAlias(char *path, int buflen); !defined(__sun) && !defined(MACOSX) && \ !defined(OPENBSD) && !defined(DRAGONFLY) && \ !defined(IOS) && !defined(ANDROID) && \ - !defined(HAIKU) && !defined(EMSCRIPTEN) + !defined(HAIKU) && !defined(__EMSCRIPTEN__) # error "Target platform not specified!" #endif diff --git a/sal/osl/unx/uunxapi.cxx b/sal/osl/unx/uunxapi.cxx index 6af6fbb61a4d..a406b8e3408a 100644 --- a/sal/osl/unx/uunxapi.cxx +++ b/sal/osl/unx/uunxapi.cxx @@ -222,7 +222,7 @@ template<> OUString fromOString(OString const & s) template bool realpath_(const T& pstrFileName, T& ppstrResolvedName) { OString fn = toOString(pstrFileName); -#if defined ANDROID || defined(EMSCRIPTEN) +#if defined ANDROID || defined(__EMSCRIPTEN__) #if defined ANDROID if (fn == "/assets" || fn.startsWith("/assets/")) #else @@ -236,7 +236,7 @@ template bool realpath_(const T& pstrFileName, T& ppstrResolvedName) return true; } -#endif // ANDROID || EMSCRIPTEN +#endif // ANDROID || __EMSCRIPTEN__ #ifdef MACOSX fn = macxp_resolveAliasAndConvert(fn); diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index 56005632192f..7073ba6aa1e8 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -45,7 +45,7 @@ #include #endif -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ #include #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/rc"); resolvePathnameUrl(&fileName); -#elif defined(EMSCRIPTEN) +#elif defined(__EMSCRIPTEN__) fileName = overriding ? OUString("vnd.sun.star.pathname:/instdir/program/fundamental.override.ini") : OUString("vnd.sun.star.pathname:/instdir/program/sofficerc"); @@ -505,7 +505,7 @@ bool Bootstrap_Impl::getValue( return true; } -#if defined ANDROID || defined EMSCRIPTEN +#if defined ANDROID || defined __EMSCRIPTEN__ if (key == "APP_DATA_DIR") { const char *app_data_dir = lo_get_app_data_dir(); diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 32dc46506617..898d54d85051 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -828,7 +828,7 @@ void FastSaxParserImpl::parseStream(const InputSource& rStructSource) rEntity.mxDocumentHandler->startDocument(); } -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ rEntity.mbEnableThreads = false; #else if (!getenv("SAX_DISABLE_THREADS") && !m_bDisableThreadedParser) diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index e44a1d8dd716..d70091ca64de 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -339,7 +339,7 @@ void importSheetFragments( WorkbookFragment& rWorkbookHandler, SheetFragmentVect 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) // Emscripten case; so instead of yielding (which implicitly releases the SolarMutex), just // release the SolarMutex so that the WorkerThreads can proceed: diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 9b8b1bb53c96..bca8f9a0c0c8 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -113,7 +113,7 @@ SfxApplication* SfxApplication::GetOrCreate() #if HAVE_FEATURE_XMLHELP Application::SetHelp( pSfxHelp ); #endif -#if HAVE_FEATURE_XMLHELP || defined(EMSCRIPTEN) +#if HAVE_FEATURE_XMLHELP || defined(__EMSCRIPTEN__) bool bHelpTip = officecfg::Office::Common::Help::Tip::get(); bool bExtendedHelpTip = officecfg::Office::Common::Help::ExtendedTip::get(); if (bHelpTip) diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 52995b24b88f..5b0197c19e32 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1937,7 +1937,7 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, c css::uno::Reference< css::frame::XPopupMenuController > xPopupController( xContext->getServiceManager()->createInstanceWithArgumentsAndContext( 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 // 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 @@ -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 ); if ( xComponent.is() ) xComponent->dispose(); diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index abc197acde23..07414371f618 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -40,7 +40,7 @@ #include #endif -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ #include #include 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 cppu; -#ifndef EMSCRIPTEN +#ifndef __EMSCRIPTEN__ namespace { 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 ) { -#ifndef EMSCRIPTEN +#ifndef __EMSCRIPTEN__ OStringBuffer aBuffer, aLaunchBuffer; if (comphelper::LibreOfficeKit::isActive()) @@ -266,7 +266,7 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar int nerr = errno; throw SystemShellExecuteException(OUString::createFromAscii( strerror( nerr ) ), static_cast < XSystemShellExecute * > (this), nerr ); -#else // EMSCRIPTEN +#else // __EMSCRIPTEN__ (void)nFlags; css::uno::Reference< css::uri::XUriReference > uri( diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk index 38ea32b63883..16601e83fc8a 100644 --- a/solenv/gbuild/platform/unxgcc.mk +++ b/solenv/gbuild/platform/unxgcc.mk @@ -29,7 +29,7 @@ gb_AR := $(AR) endif gb_OSDEFS := \ - -D$(OS) \ + $(if $(filter-out EMSCRIPTEN,$(OS)),-D$(OS)) \ -D_PTHREADS \ -DUNIX \ -DUNX \ diff --git a/static/source/unoembindhelpers/PrimaryBindings.cxx b/static/source/unoembindhelpers/PrimaryBindings.cxx index 7cf197694cae..c4fb22555e5c 100644 --- a/static/source/unoembindhelpers/PrimaryBindings.cxx +++ b/static/source/unoembindhelpers/PrimaryBindings.cxx @@ -6,7 +6,7 @@ * 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/. */ -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ #include #include diff --git a/tools/source/misc/extendapplicationenvironment.cxx b/tools/source/misc/extendapplicationenvironment.cxx index a98d63bc4958..0f5183880d13 100644 --- a/tools/source/misc/extendapplicationenvironment.cxx +++ b/tools/source/misc/extendapplicationenvironment.cxx @@ -38,7 +38,7 @@ namespace tools { void extendApplicationEnvironment() { -#if defined UNX && !defined EMSCRIPTEN +#if defined UNX && !defined __EMSCRIPTEN__ // Try to set RLIMIT_NOFILE as large as possible (failure is harmless): rlimit lim; if (getrlimit(RLIMIT_NOFILE, &lim) == 0) diff --git a/unotools/source/i18n/resmgr.cxx b/unotools/source/i18n/resmgr.cxx index f93e943b628a..7072c79451b0 100644 --- a/unotools/source/i18n/resmgr.cxx +++ b/unotools/source/i18n/resmgr.cxx @@ -57,7 +57,7 @@ #include #endif -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ #include #endif @@ -125,7 +125,7 @@ namespace Translate gen.characters(boost::locale::char_facet_t::char_f); gen.categories(boost::locale::category_t::message | boost::locale::category_t::information); #endif -#if defined(ANDROID) || defined(EMSCRIPTEN) +#if defined(ANDROID) || defined(__EMSCRIPTEN__) OString sPath(OString(lo_get_app_data_dir()) + "/program/resource"); #else OUString uri(u"$BRAND_BASE_DIR/$BRAND_SHARE_RESOURCE_SUBDIR/"_ustr); diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 81c7e2f7d844..33f2ba9f825b 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -21,7 +21,7 @@ #include -#if !defined(ANDROID) && !defined(IOS) && !defined(EMSCRIPTEN) && !defined(_WIN32) +#if !defined(ANDROID) && !defined(IOS) && !defined(__EMSCRIPTEN__) && !defined(_WIN32) #include #endif @@ -52,7 +52,7 @@ #include #include -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ #include #endif @@ -75,7 +75,7 @@ do { \ #define DBG_TESTSVPYIELDMUTEX() ((void)0) #endif -#if !defined(ANDROID) && !defined(IOS) && !defined(EMSCRIPTEN) +#if !defined(ANDROID) && !defined(IOS) && !defined(__EMSCRIPTEN__) static void atfork_child() { @@ -96,10 +96,10 @@ SvpSalInstance::SvpSalInstance(std::unique_ptr pMutex, SalData* p m_MainThread = osl::Thread::getCurrentIdentifier(); if( s_pDefaultInstance == nullptr ) 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); #endif -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ ImplGetSVData()->maAppData.m_bUseSystemLoop = true; #endif } @@ -298,7 +298,7 @@ void SvpSalInstance::ProcessEvent( SalUserEvent aEvent ) pMutex->m_NonMainWaitingYieldCond.set(); } -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ static void loop(void * arg) { SolarMutexGuard g; diff --git a/vcl/inc/headless/svpinst.hxx b/vcl/inc/headless/svpinst.hxx index 3632d052108d..1ec58317d5b4 100644 --- a/vcl/inc/headless/svpinst.hxx +++ b/vcl/inc/headless/svpinst.hxx @@ -96,7 +96,7 @@ class VCL_DLLPUBLIC SvpSalInstance : public SalGenericInstance, public SalUserEv virtual void TriggerUserEventProcessing() override; virtual void ProcessEvent( SalUserEvent aEvent ) override; -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ bool DoExecute(int &nExitCode) override; void DoQuit() override; #endif diff --git a/vcl/inc/qt5/QtInstance.hxx b/vcl/inc/qt5/QtInstance.hxx index 846a460ea469..8de9110c7fb6 100644 --- a/vcl/inc/qt5/QtInstance.hxx +++ b/vcl/inc/qt5/QtInstance.hxx @@ -58,7 +58,8 @@ class QApplication; class SalYieldMutex; 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 { struct Data; @@ -103,7 +104,8 @@ class VCLPLUG_QT_PUBLIC QtInstance : public QObject, 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; #endif @@ -191,7 +193,7 @@ public: CreateColorChooserDialog(weld::Window* pParent, vcl::ColorPickerMode eMode) override; // so we fall back to the default abort, instead of duplicating it... -#ifndef EMSCRIPTEN +#ifndef __EMSCRIPTEN__ virtual OpenGLContext* CreateOpenGLContext() override; #endif diff --git a/vcl/qt5/QtClipboard.cxx b/vcl/qt5/QtClipboard.cxx index fcd38561e262..ab8b288f2679 100644 --- a/vcl/qt5/QtClipboard.cxx +++ b/vcl/qt5/QtClipboard.cxx @@ -26,7 +26,7 @@ #include #include -#if defined EMSCRIPTEN && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if defined __EMSCRIPTEN__ && QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include #include #include @@ -73,7 +73,7 @@ void QtClipboard::flushClipboard() css::uno::Reference QtClipboard::getContents() { -#if defined(EMSCRIPTEN) +#if defined(__EMSCRIPTEN__) static QMimeData aMimeData; #endif osl::MutexGuard aGuard(m_aMutex); @@ -86,7 +86,7 @@ css::uno::Reference QtClipboard::getContents() // check if we can still use the shared QtClipboardTransferable const QMimeData* pMimeData = QApplication::clipboard()->mimeData(m_eClipboardMode); -#if defined(EMSCRIPTEN) +#if defined(__EMSCRIPTEN__) if (!pMimeData) pMimeData = &aMimeData; #endif @@ -136,7 +136,7 @@ void QtClipboard::setContents( 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 // 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 @@ -196,7 +196,7 @@ void QtClipboard::handleChanged(QClipboard::Mode eMode) if (qobject_cast(mimeData)) 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 // 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 @@ -287,7 +287,7 @@ bool QtClipboard::isOwner(const QClipboard::Mode aMode) { return true; } -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ // QWasmClipboard::ownsMode (in qtbase/src/plugins/platforms/wasm/qwasmclipboard.cpp, // 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 diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 96d343e25050..984421c0f4e1 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -667,7 +667,7 @@ void QtFrame::ShowFullScreen(bool bFullScreen, sal_Int32 nScreen) void QtFrame::StartPresentation(bool bStart) { -#if defined LINUX || defined __sun || defined FREEBSD || defined OPENBSD +#if !defined __EMSCRIPTEN__ #if CHECK_QT5_USING_X11 unsigned int nRootWindow(0); std::optional aDisplay; diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index 282db60a2d92..0b0a08529c96 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -77,7 +77,7 @@ #include #include -#ifdef EMSCRIPTEN +#ifdef __EMSCRIPTEN__ #include Q_IMPORT_PLUGIN(QWasmIntegrationPlugin) #if defined DISABLE_DYNLOADING && ENABLE_QT6 @@ -85,7 +85,8 @@ Q_IMPORT_PLUGIN(QWasmIntegrationPlugin) #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 #include #include @@ -215,7 +216,8 @@ void QtInstance::RunInMainThread(std::function func) func(); 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) { EmscriptenLightweightRunInMainThread(func); @@ -243,7 +245,8 @@ void QtInstance::RunInMainThread(std::function func) void QtInstance::EmscriptenLightweightRunInMainThread_(std::function 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()) { SolarMutexReleaser release; @@ -286,7 +289,8 @@ QtInstance::QtInstance() { 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(); #endif @@ -334,7 +338,7 @@ QtInstance::QtInstance() &QtInstance::colorSchemeChanged); #endif -#ifndef EMSCRIPTEN +#ifndef __EMSCRIPTEN__ m_bSupportsOpenGL = true; #elif !HAVE_EMSCRIPTEN_JSPI ImplGetSVData()->maAppData.m_bUseSystemLoop = true; @@ -347,7 +351,8 @@ QtInstance::~QtInstance() // as it uses references to the provided arguments! 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(); #endif } @@ -474,7 +479,8 @@ bool QtInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) if (bWasEvent) 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) { SolarMutexReleaser release; @@ -523,7 +529,7 @@ bool QtInstance::AnyInput(VclInputFlags nType) void QtInstance::AddToRecentDocumentList(const OUString&, const OUString&, const OUString&) {} -#ifndef EMSCRIPTEN +#ifndef __EMSCRIPTEN__ OpenGLContext* QtInstance::CreateOpenGLContext() { return new QtOpenGLContext; } #endif @@ -540,7 +546,8 @@ void QtInstance::TriggerUserEventProcessing() 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; (void)emscripten_promise_await( emscripten_proxy_promise(m_emscriptenThreadingData->proxyingQueue.queue, @@ -821,13 +828,13 @@ bool QtInstance::DoExecute(int& nExitCode) const bool bIsUseSystemEventLoop = Application::IsUseSystemEventLoop(); if (bIsUseSystemEventLoop) { -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ // 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: ReleaseYieldMutex(false); #endif nExitCode = QApplication::exec(); -#if defined EMSCRIPTEN +#if defined __EMSCRIPTEN__ O3TL_UNREACHABLE; #endif } @@ -984,7 +991,7 @@ QtInstance::CreateColorChooserDialog(weld::Window* pParent, vcl::ColorPickerMode 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 // 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 diff --git a/vcl/qt5/QtMainWindow.cxx b/vcl/qt5/QtMainWindow.cxx index bcf95289d854..7914e48ec429 100644 --- a/vcl/qt5/QtMainWindow.cxx +++ b/vcl/qt5/QtMainWindow.cxx @@ -21,7 +21,7 @@ QtMainWindow::QtMainWindow(QtFrame& rFrame, Qt::WindowFlags f) : QMainWindow(nullptr, f) , m_rFrame(rFrame) { -#ifndef EMSCRIPTEN +#ifndef __EMSCRIPTEN__ QAccessible::installFactory(QtAccessibleWidget::customFactory); #endif } diff --git a/vcl/qt5/QtTimer.cxx b/vcl/qt5/QtTimer.cxx index 762e0835f542..60d033caff96 100644 --- a/vcl/qt5/QtTimer.cxx +++ b/vcl/qt5/QtTimer.cxx @@ -42,7 +42,8 @@ QtTimer::QtTimer() 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 // SolarMutex here, but only when calling pTask->Invoke() in Scheduler::CallbackTaskScheduling, // that looks too brittle in general, so treat that special mode specially here. diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx index 91457cee0c89..3f2cf9749798 100644 --- a/vcl/qt5/QtTransferable.cxx +++ b/vcl/qt5/QtTransferable.cxx @@ -297,7 +297,7 @@ QStringList QtMimeData::formats() const 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); #endif 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 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"); #else // 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"); #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()) { aList << toQString(aFormats[0].MimeType); diff --git a/vcl/source/app/salplug.cxx b/vcl/source/app/salplug.cxx index 30fff4939962..a00bd78d12b1 100644 --- a/vcl/source/app/salplug.cxx +++ b/vcl/source/app/salplug.cxx @@ -367,7 +367,7 @@ DesktopType SalGetDesktopEnvironment() return DesktopType::Windows; #elif defined(MACOSX) return DesktopType::macOS; -#elif defined(EMSCRIPTEN) +#elif defined(__EMSCRIPTEN__) return DesktopType::WASM; #elif defined(ANDROID) return DesktopType::Android; diff --git a/vcl/source/app/scheduler.cxx b/vcl/source/app/scheduler.cxx index 91d10f1133ee..05fd10fb972e 100644 --- a/vcl/source/app/scheduler.cxx +++ b/vcl/source/app/scheduler.cxx @@ -409,7 +409,7 @@ void Scheduler::CallbackTaskScheduling() ImplSVData *pSVData = ImplGetSVData(); 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 // 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. @@ -593,7 +593,7 @@ void Scheduler::CallbackTaskScheduling() { // prepare Scheduler object for deletion after handling 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()) { auto & data = comphelper::emscriptenthreading::getData(); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 952d7288a44f..69735741a773 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1253,7 +1253,7 @@ OUString Application::GetHWOSConfInfo(const int bSelection, const bool bLocalize #endif 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()); #endif } diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 88612a7d5d47..b8633ed5ba56 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1134,7 +1134,7 @@ void VclBuilderPreload() 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 // Collabora Online in the browser, where code from core and Collabora @@ -1222,7 +1222,7 @@ VclBuilder::customMakeWidget GetCustomMakeWidget(const OUString& rName) else pFunction = reinterpret_cast( 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 // Android or iOS apps, or the Collabora Online as WASM thing. pFunction = lo_get_custom_widget_func(sFunction.toUtf8().getStr()); diff --git a/vcl/unx/generic/app/geninst.cxx b/vcl/unx/generic/app/geninst.cxx index f92a23b9babb..37166c69f5ad 100644 --- a/vcl/unx/generic/app/geninst.cxx +++ b/vcl/unx/generic/app/geninst.cxx @@ -25,7 +25,7 @@ #if defined(__FreeBSD__) # include #endif -#if defined(EMSCRIPTEN) +#if defined(__EMSCRIPTEN__) #include #endif @@ -77,7 +77,7 @@ OUString SalGenericInstance::getOSVersion() break; } aKernelVer = OUString::createFromAscii(stName.sysname) + " " + aKernelVer.copy(0, nIndex); -#elif defined(EMSCRIPTEN) +#elif defined(__EMSCRIPTEN__) #if defined __EMSCRIPTEN_MAJOR__ aKernelVer = u"Emscripten "_ustr + OUString::number(__EMSCRIPTEN_MAJOR__) + u"."_ustr + OUString::number(__EMSCRIPTEN_MINOR__) + u"."_ustr