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_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>
+2 -2
View File
@@ -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());
+1 -1
View File
@@ -11,7 +11,7 @@
#include <sal/config.h>
#if defined EMSCRIPTEN
#if defined __EMSCRIPTEN__
void initJsUnoScripting();
+4 -4
View File
@@ -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] == ':')
+2 -2
View File
@@ -45,7 +45,7 @@
#include <iostream>
#include <map>
#if defined EMSCRIPTEN
#if defined __EMSCRIPTEN__
#include <initjsunoscripting.hxx>
#endif
@@ -85,7 +85,7 @@ void Desktop::InitApplicationServiceManager()
UNO_QUERY_THROW);
#endif
comphelper::setProcessServiceFactory(sm);
#if defined EMSCRIPTEN
#if defined __EMSCRIPTEN__
initJsUnoScripting();
#endif
}
+1 -1
View File
@@ -9,7 +9,7 @@
#include <sal/config.h>
#if defined EMSCRIPTEN
#if defined __EMSCRIPTEN__
#include <cassert>
#include <cstdint>
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+3 -3
View File
@@ -27,7 +27,7 @@
#include <officecfg/Setup.hxx>
#include <osl/file.h>
#include <osl/file.hxx>
#if defined ANDROID || defined IOS || defined EMSCRIPTEN
#if defined ANDROID || defined IOS || defined __EMSCRIPTEN__
#include <rtl/bootstrap.hxx>
#endif
#include <rtl/ustring.hxx>
@@ -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(
+2 -2
View File
@@ -70,7 +70,7 @@ std::shared_ptr<rtl::Bootstrap> & 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,
+3 -3
View File
@@ -47,7 +47,7 @@
#include <osl/detail/android-bootstrap.h>
#endif
#ifdef EMSCRIPTEN
#ifdef __EMSCRIPTEN__
#include <initjsunoscripting.hxx>
#include <osl/detail/emscripten-bootstrap.h>
#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...
@@ -87,7 +87,7 @@ void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css::
}
}
#ifdef EMSCRIPTEN
#ifdef __EMSCRIPTEN__
m_bDisableReschedule = true;
#endif
impl_createProgress();
@@ -38,7 +38,7 @@
#include <osl/detail/android-bootstrap.h>
#endif
#ifdef EMSCRIPTEN
#ifdef __EMSCRIPTEN__
#include <osl/detail/emscripten-bootstrap.h>
#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.
+1 -1
View File
@@ -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" );
+1 -1
View File
@@ -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 )
+2 -1
View File
@@ -14,7 +14,8 @@
#include <config_emscripten.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>
+1 -1
View File
@@ -68,7 +68,7 @@ public:
@param bJoin - if set call joinThreadsIfIdle() at the end
*/
void waitUntilDone(const std::shared_ptr<ThreadTaskTag>&, bool bJoin =
#if defined EMSCRIPTEN
#if defined __EMSCRIPTEN__
false
#else
true
+2 -2
View File
@@ -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: */
+1 -1
View File
@@ -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 !"
+1 -1
View File
@@ -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 <alloca.h>
+1 -1
View File
@@ -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 ""
+1 -1
View File
@@ -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
}
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -209,7 +209,7 @@ int macxp_resolveAlias(char *path, int buflen);
# define NO_PTHREAD_RTL
#endif
#ifdef EMSCRIPTEN
#ifdef __EMSCRIPTEN__
# include <pthread.h>
# include <sys/file.h>
# include <sys/ioctl.h>
@@ -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
+2 -2
View File
@@ -222,7 +222,7 @@ template<> OUString fromOString(OString const & s)
template<typename T> 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<typename T> bool realpath_(const T& pstrFileName, T& ppstrResolvedName)
return true;
}
#endif // ANDROID || EMSCRIPTEN
#endif // ANDROID || __EMSCRIPTEN__
#ifdef MACOSX
fn = macxp_resolveAliasAndConvert(fn);
+3 -3
View File
@@ -45,7 +45,7 @@
#include <osl/detail/android-bootstrap.h>
#endif
#ifdef EMSCRIPTEN
#ifdef __EMSCRIPTEN__
#include <osl/detail/emscripten-bootstrap.h>
#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();
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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:
+1 -1
View File
@@ -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)
+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(
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();
+4 -4
View File
@@ -40,7 +40,7 @@
#include <sys/stat.h>
#endif
#ifdef EMSCRIPTEN
#ifdef __EMSCRIPTEN__
#include <emscripten/threading.h>
#include <rtl/uri.hxx>
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(
+1 -1
View File
@@ -29,7 +29,7 @@ gb_AR := $(AR)
endif
gb_OSDEFS := \
-D$(OS) \
$(if $(filter-out EMSCRIPTEN,$(OS)),-D$(OS)) \
-D_PTHREADS \
-DUNIX \
-DUNX \
@@ -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 <com/sun/star/frame/XModel.hpp>
#include <emscripten.h>
@@ -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)
+2 -2
View File
@@ -57,7 +57,7 @@
#include <osl/detail/android-bootstrap.h>
#endif
#ifdef EMSCRIPTEN
#ifdef __EMSCRIPTEN__
#include <osl/detail/emscripten-bootstrap.h>
#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);
+6 -6
View File
@@ -21,7 +21,7 @@
#include <mutex>
#if !defined(ANDROID) && !defined(IOS) && !defined(EMSCRIPTEN) && !defined(_WIN32)
#if !defined(ANDROID) && !defined(IOS) && !defined(__EMSCRIPTEN__) && !defined(_WIN32)
#include <pthread.h>
#endif
@@ -52,7 +52,7 @@
#include <tools/time.hxx>
#include <o3tl/unreachable.hxx>
#if defined EMSCRIPTEN
#if defined __EMSCRIPTEN__
#include <emscripten.h>
#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<SalYieldMutex> 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;
+1 -1
View File
@@ -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
+5 -3
View File
@@ -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
+6 -6
View File
@@ -26,7 +26,7 @@
#include <map>
#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 <comphelper/diagnose_ex.hxx>
#include <emscripten.h>
@@ -73,7 +73,7 @@ void QtClipboard::flushClipboard()
css::uno::Reference<css::datatransfer::XTransferable> QtClipboard::getContents()
{
#if defined(EMSCRIPTEN)
#if defined(__EMSCRIPTEN__)
static QMimeData aMimeData;
#endif
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
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<const QtMimeData*>(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
+1 -1
View File
@@ -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<Display*> aDisplay;
+20 -13
View File
@@ -77,7 +77,7 @@
#include <QtWidgets/QWidget>
#include <QtWidgets/QMessageBox>
#ifdef EMSCRIPTEN
#ifdef __EMSCRIPTEN__
#include <QtCore/QtPlugin>
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 <emscripten/promise.h>
#include <emscripten/proxying.h>
#include <emscripten/threading.h>
@@ -215,7 +216,8 @@ void QtInstance::RunInMainThread(std::function<void()> 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<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())
{
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
+1 -1
View File
@@ -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
}
+2 -1
View File
@@ -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.
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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();
+1 -1
View File
@@ -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
}
+2 -2
View File
@@ -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<VclBuilder::customMakeWidget>(
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());
+2 -2
View File
@@ -25,7 +25,7 @@
#if defined(__FreeBSD__)
# include <sys/utsname.h>
#endif
#if defined(EMSCRIPTEN)
#if defined(__EMSCRIPTEN__)
#include <emscripten/version.h>
#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