From d7b688870aead912690188b324d370b920a7a600 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Wed, 30 Jul 2008 23:14:24 +0200 Subject: Port of Qt to VxWorks This makes Qt work on VxWorks 6.6+ in native (kernel) mode. * compiles with the WindRiver GNU toolchain (Linux only) * works with QWS (tested with the VNC driver only) * tested on PPC hardware and the x86 VxWorks simulator * no q3support, no phonon, no webkit * no QSharedMemory, no QSystemSemaphore, no QProcess * only one QApplication instance (flat address space) * filesystem support depends heavily on the quality of the native driver * QLibrary is just a dummy to make plugins work at all * qmake transparently creates VxWorks munching rules for static ctors * made auto-test cope with missing OS features A special note regarding the Q_FOREACH patch for dcc: when calling foreach(a,c) with c being a function returning a container, the compiler would generate 5 references to some labels (.LXXXX), which are not there (so the linker complains in the end). Seems like dcc doesn't really like the 'true ? 0 : ' statement Reviewed-By: Harald Fernengel --- configure | 14 + doc/src/platform-notes-rtos.qdoc | 127 +++++++ doc/src/platform-notes.qdoc | 6 + mkspecs/features/vxworks.prf | 63 ++++ mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf | 111 ++++++ .../unsupported/vxworks-ppc-dcc/qplatformdefs.h | 42 +++ mkspecs/unsupported/vxworks-ppc-g++/qmake.conf | 37 ++ .../unsupported/vxworks-ppc-g++/qplatformdefs.h | 42 +++ .../unsupported/vxworks-simpentium-dcc/qmake.conf | 110 ++++++ .../vxworks-simpentium-dcc/qplatformdefs.h | 42 +++ .../unsupported/vxworks-simpentium-g++/qmake.conf | 37 ++ .../vxworks-simpentium-g++/qplatformdefs.h | 128 +++++++ src/3rdparty/freetype/builds/unix/ftsystem.c | 9 +- src/3rdparty/libjpeg/jmorecfg.h | 5 +- src/3rdparty/libpng/pngconf.h | 2 +- src/3rdparty/libtiff/libtiff/tif_config.h | 2 +- src/3rdparty/patches/freetype-2.3.6-vxworks.patch | 35 ++ src/3rdparty/patches/libjpeg-6b-vxworks.patch | 23 ++ src/3rdparty/patches/libpng-1.2.20-vxworks.patch | 13 + src/3rdparty/patches/libtiff-3.8.2-vxworks.patch | 11 + src/3rdparty/patches/sqlite-3.5.6-vxworks.patch | 68 ++++ src/3rdparty/sqlite/sqlite3.c | 25 +- src/corelib/arch/arch.pri | 2 + src/corelib/arch/qatomic_arch.h | 4 +- src/corelib/arch/qatomic_vxworks.h | 318 ++++++++++++++++ src/corelib/arch/vxworks/arch.pri | 6 + src/corelib/arch/vxworks/qatomic_ppc.s | 415 +++++++++++++++++++++ .../concurrent/qtconcurrentiteratekernel.cpp | 2 + src/corelib/global/qglobal.cpp | 4 + src/corelib/global/qglobal.h | 36 +- src/corelib/io/qfsfileengine_unix.cpp | 4 +- src/corelib/io/qresource.cpp | 9 + src/corelib/io/qsettings.cpp | 4 + src/corelib/io/qtemporaryfile.cpp | 9 +- src/corelib/kernel/kernel.pri | 7 + src/corelib/kernel/qcore_unix.cpp | 9 +- src/corelib/kernel/qcore_unix_p.h | 11 + src/corelib/kernel/qcoreapplication.cpp | 8 +- src/corelib/kernel/qeventdispatcher_unix.cpp | 66 +++- src/corelib/kernel/qeventdispatcher_unix_p.h | 10 +- src/corelib/kernel/qfunctions_p.h | 2 + src/corelib/kernel/qfunctions_vxworks.cpp | 202 ++++++++++ src/corelib/kernel/qfunctions_vxworks.h | 153 ++++++++ src/corelib/plugin/qlibrary_unix.cpp | 22 +- src/corelib/thread/qmutex_unix.cpp | 4 + src/corelib/thread/qthread_unix.cpp | 41 +- src/corelib/tools/qlocale.cpp | 5 + src/corelib/tools/qregexp.cpp | 4 + src/corelib/tools/tools.pri | 2 +- src/corelib/xml/qxmlstream_p.h | 4 + src/gui/dialogs/qfileinfogatherer.cpp | 7 +- src/gui/embedded/embedded.pri | 1 + src/gui/inputmethod/qinputcontextplugin.h | 2 +- src/gui/inputmethod/qximinputcontext_x11.cpp | 1 + src/gui/kernel/qapplication.cpp | 1 + src/gui/kernel/qapplication_qws.cpp | 8 +- src/gui/kernel/qt_x11_p.h | 12 +- src/gui/kernel/qx11embed_x11.cpp | 1 + src/gui/painting/qbackingstore.cpp | 3 + src/gui/painting/qbrush.h | 9 + src/gui/painting/qgrayraster.c | 4 +- src/gui/painting/qtextureglyphcache_p.h | 4 + src/gui/painting/qtransform.h | 4 + src/gui/text/qcssparser_p.h | 5 + src/gui/text/qfontengine_qws.cpp | 2 +- src/gui/text/qtextdocument_p.cpp | 45 ++- src/gui/text/qtextdocumentfragment.cpp | 4 + src/gui/util/qdesktopservices_x11.cpp | 4 + src/network/kernel/qhostinfo_unix.cpp | 11 +- src/network/socket/qlocalserver_unix.cpp | 4 + src/network/socket/qlocalsocket_unix.cpp | 4 + src/network/socket/qnativesocketengine_p.h | 4 +- src/network/socket/qnativesocketengine_unix.cpp | 27 +- src/network/socket/qnet_unix_p.h | 26 +- src/opengl/qgl_x11.cpp | 12 + src/opengl/qglpixelbuffer_x11.cpp | 2 + src/script/qscriptbuffer_p.h | 5 + src/script/qscriptclassinfo_p.h | 4 + src/script/qscriptecmadate.cpp | 10 +- src/script/qscriptgc_p.h | 4 + src/script/qscriptmemberfwd_p.h | 4 + src/script/qscriptsyntaxcheckresult_p.h | 4 + src/script/qscriptvalueimplfwd_p.h | 4 + src/src.pro | 2 +- src/svg/qsvghandler.cpp | 2 +- src/xmlpatterns/parser/qquerytransformparser_p.h | 12 + src/xmlpatterns/parser/winCEWorkaround.sed | 12 + tests/auto/qdir/tst_qdir.cpp | 77 ++-- tests/auto/qdiriterator/tst_qdiriterator.cpp | 18 + tests/auto/qfilesystemmodel/qfilesystemmodel.pro | 2 + tests/auto/qhttp/qhttp.pro | 2 + tests/auto/qline/qline.pro | 2 +- tests/auto/qmetaobject/qmetaobject.pro | 3 + tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 + tests/auto/qnumeric/tst_qnumeric.cpp | 5 + tests/auto/qobjectrace/tst_qobjectrace.cpp | 8 +- tests/auto/qreadwritelock/tst_qreadwritelock.cpp | 2 + tests/auto/qregexp/qregexp.pro | 3 + tests/auto/qresourceengine/qresourceengine.pro | 1 + tests/auto/qresourceengine/tst_resourceengine.cpp | 2 +- tests/auto/qscriptengine/qscriptengine.pro | 2 +- tests/auto/qscriptqobject/qscriptqobject.pro | 2 +- tests/auto/qscriptvalue/qscriptvalue.pro | 2 +- tests/auto/qstring/qstring.pro | 2 - tests/auto/qtcpsocket/qtcpsocket.pro | 1 + tests/auto/qtcpsocket/test/test.pro | 1 + tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 24 +- tests/auto/qthreadonce/tst_qthreadonce.cpp | 2 +- tests/auto/qthreadpool/tst_qthreadpool.cpp | 6 +- tests/auto/qxmlsimplereader/parser/main.cpp | 1 + 110 files changed, 2623 insertions(+), 132 deletions(-) create mode 100644 doc/src/platform-notes-rtos.qdoc create mode 100644 mkspecs/features/vxworks.prf create mode 100644 mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf create mode 100644 mkspecs/unsupported/vxworks-ppc-dcc/qplatformdefs.h create mode 100644 mkspecs/unsupported/vxworks-ppc-g++/qmake.conf create mode 100644 mkspecs/unsupported/vxworks-ppc-g++/qplatformdefs.h create mode 100644 mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf create mode 100644 mkspecs/unsupported/vxworks-simpentium-dcc/qplatformdefs.h create mode 100644 mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf create mode 100644 mkspecs/unsupported/vxworks-simpentium-g++/qplatformdefs.h create mode 100644 src/3rdparty/patches/freetype-2.3.6-vxworks.patch create mode 100644 src/3rdparty/patches/libjpeg-6b-vxworks.patch create mode 100644 src/3rdparty/patches/libpng-1.2.20-vxworks.patch create mode 100644 src/3rdparty/patches/libtiff-3.8.2-vxworks.patch create mode 100644 src/3rdparty/patches/sqlite-3.5.6-vxworks.patch create mode 100644 src/corelib/arch/qatomic_vxworks.h create mode 100644 src/corelib/arch/vxworks/arch.pri create mode 100644 src/corelib/arch/vxworks/qatomic_ppc.s create mode 100644 src/corelib/kernel/qfunctions_vxworks.cpp create mode 100644 src/corelib/kernel/qfunctions_vxworks.h diff --git a/configure b/configure index 5faa45194d..142c4a3656 100755 --- a/configure +++ b/configure @@ -5723,6 +5723,13 @@ case "$PLATFORM,$CFG_MAC_COCOA" in ;; esac +# disable Qt 3 support on VxWorks +case "$XPLATFORM" in + unsupported/vxworks*) + CFG_QT3SUPPORT="no" + ;; +esac + # enable Qt 3 support functionality if [ "$CFG_QT3SUPPORT" = "yes" ]; then QT_CONFIG="$QT_CONFIG qt3support" @@ -6092,6 +6099,13 @@ case "$XPLATFORM" in ;; esac ;; + unsupported/vxworks-*-g++*) + canBuildWebKit="no" + ;; + unsupported/vxworks-*-dcc*) + canBuildWebKit="no" + canBuildQtXmlPatterns="no" + ;; *-g++*) # Check gcc's version case "$(${QMAKE_CONF_COMPILER} -dumpversion)" in diff --git a/doc/src/platform-notes-rtos.qdoc b/doc/src/platform-notes-rtos.qdoc new file mode 100644 index 0000000000..d2895d831e --- /dev/null +++ b/doc/src/platform-notes-rtos.qdoc @@ -0,0 +1,127 @@ +/*! + \page platform-notes-vxworks.html + \title Platform Notes - VxWorks + \contentspage Platform Notes + \target VxWorks + + \note VxWorks is a community supported platform. See the + \l{Supported Platforms} page for more information. + + This page contains information about the Qt for VxWorks port. More + information about the combinations of platforms and compilers supported + by Qt can be found on the \l{Supported Platforms} page. + + \tableofcontents + + \section1 Supported Versions + + Qt has been tested on WindRiver VxWorks 6.7 in kernel mode using the + vendor supplied GCC compiler, targetting both the x86 simulator + (simpentium) and Power-PC devices (ppc). + + \section1 Limitations + + The VxWorks kernel has an optional POSIX compatibility layer, but this + layer does not implement all POSIX functionality needed for a complete + Qt port. + + \table + \header \o Class \o Notes + \row \o QProcess + \o Not available - VxWorks has no concept of processes + \row \o QSharedMemory + \o Not available - VxWorks has only a global, flat address space + \row \o QSystemSemaphore + \o Not available - VxWorks has no concept of processes + \row \o QLibrary + \o QLibrary is only a small stub to make it possible to build + static plugins + \row \o QCoreApplication + \o Can only be instantiated once. Qt's Q(CoreE)Application is + tightly coupled to one address space and process, while VxWorks + only supports one global address space and has no concept of + processes. + + \endtable + + \section1 Build Instructions + + Qt for VxWorks needs to be \l{Cross-Compiling Qt for Embedded Linux + Applications}{cross-compiled} on a Linux host. \c configure and \c make + the build like you would with a standard \l{Cross-Compiling Qt for + Embedded Linux Applications}{embedded Linux cross build}. Building the + VxWorks simulator would be done like this: + + \code + /configure -xplatform unsupported/vxworks-simpentium-g++ -embedded vxworks -exceptions -no-gfx-linuxfb -no-mouse-linuxtp -no-mouse-pc -no-kbd-tty + make + \endcode + + \list + \o \c{-xplatform unsupported/qws/vxworks-simpentium-g++} - selects the x86 simulator mkspec for VxWorks + \o \c{-embedded vxworks} - builds the embedded version of Qt and sets the architecture to VxWorks + \o \c{-exceptions} - see General Notes below + \o \c{-no-gfx-linuxfb}, \c{-no-mouse-linuxtp}, \c{-no-mouse-pc} and \c{-no-kbd-tty} are Linux specific and won't work on VxWorks + \endlist + + \section1 General Notes + + \list + + \o Configuring with \c{-exceptions} is necessary, because the VxWorks + 6.7 g++ headers require exceptions to be enabled when compiling C++ + code. + + \o Configure's \c{-xplatform} can be any of + \c{unsupported/vxworks-(simpentium|ppc)-(g++|dcc)}, but \c{dcc} + (WindRiver DIAB compiler) has not yet tested been tested with Qt 4.6 and + VxWorks 6.7. + + \o Building shared libraries with \c{-shared} (the default) doesn't + really build shared libraries, like e.g. on Linux, since these are not + supported by VxWorks. Instead, qmake will created partially linked + objects, that can be loaded at runtime with \c{ld}. + + \o Creating static builds with \c{-static} is fully supported. + + \o "Munching" (generating constructors/destructors for static C++ + objects) is done automatically by a special qmake extension (for both + shared libraries and executables) + + \o VxWorks does not have a file system layer, but the low level storage + drivers have to supply a file system like interface to the applications. + Since each driver implements a different subset of the functionality + supported by this interface, Qt's file system auto-tests show wildly + differing results running on different "file systems". The best results + can be achieved when running on a (writable) NFS mount, since that + provides the most Unix-ish interface. The worst results come from the + FTP file system driver, which may crash when accessed by a + \c{QFileInfo}. + + \o Keep in mind that VxWorks doesn't call your \c{main()} function with + the standard \c{argc}/\c{argv} parameters. So either add a special + \c{vxmain()} function or use a tool like \c{callmain} to translate + VxWorks' commandline arguments to an \c{argc}/\c{argv} array. + + \o Some example will fail to build, due to some missing dependencies + (e.g. shared memory) - this will be fixed in a later release. + + \endlist +*/ + +/*! + \page platform-notes-qnx.html + \title Platform Notes - QNX + \contentspage Platform Notes + \target QNX + + \note QNX is a community supported platform. See the + \l{Supported Platforms} page for more information. + + This page contains information about the Qt for QNX port. More + information about the combinations of platforms and compilers supported + by Qt can be found on the \l{Supported Platforms} page. + + \tableofcontents + +*/ diff --git a/doc/src/platform-notes.qdoc b/doc/src/platform-notes.qdoc index c788024f93..4807f8ffd9 100644 --- a/doc/src/platform-notes.qdoc +++ b/doc/src/platform-notes.qdoc @@ -60,6 +60,10 @@ \tableofcontents{1 Platform Notes - Embedded Linux} \o \l{Platform Notes - Windows CE} \tableofcontents{1 Platform Notes - Windows CE} + \o \l{Platform Notes - QNX} + \tableofcontents{1 Platform Notes - QNX} + \o \l{Platform Notes - VxWorks} + \tableofcontents{1 Platform Notes - VxWorks} \endlist See also the \l{Compiler Notes} for information about compiler-specific @@ -374,6 +378,8 @@ improve support for this feature. */ + \row \o QNX \o Intel 32-bit, PowerPC \o unsupported/qnx--g++ \o QNX 6.4 GCC + \row \o VxWorks \o Intel 32-bit, PowerPC \o unsupported/vxworks--g++ \o VxWorks 6.7 GCC /*! \page platform-notes-windows-ce.html diff --git a/mkspecs/features/vxworks.prf b/mkspecs/features/vxworks.prf new file mode 100644 index 0000000000..a910c69d20 --- /dev/null +++ b/mkspecs/features/vxworks.prf @@ -0,0 +1,63 @@ +# VxWorks Munching Feature +# When compiling C++ sources on VxWorks in kernel mode, all .o files have to +# be processed by the so-called 'munch' script which will generate +# additional code for static c'tors and d'tors. The resulting .c file has to +# be compiled in turn and linked to the executable. +# This can only been done when linking applications, since the munch script +# generates a .c file containing static symbols: linking a lib that was +# already munched to a munched application would lead to duplicate symbols! + +isEmpty(VXWORKS_MUNCH_EXT):VXWORKS_MUNCH_EXT = vxm +isEmpty(VXWORKS_MUNCH_TOOL):VXWORKS_MUNCH_TOOL = $(WIND_BASE)/host/resource/hutils/tcl/munch.tcl + + +!exists($$VXWORKS_MUNCH_TOOL) { + error("Could not find VxWorks Munch tool: '$${VXWORKS_MUNCH_TOOL}'. Please set the environment variable WIND_BASE correctly.") +} + +# The following scope is entered for any project that specifies 'shared' as well +# as for any project specifying neither 'shared', nor 'lib', nor 'staticlib'. +# This means that for a static build only the executable is munched, while for +# a shared build, every lib, plugin and executable is munched separately. + +shared|!staticlib:!lib { + *-dcc { + VXWORKS_MUNCH_CMD = (targ=`basename $(TARGET)`; \ + ddump -Ng \"$(TARGET)\" | tclsh $$VXWORKS_MUNCH_TOOL -c $$VXWORKS_ARCH_MUNCH >\"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" && \ + $$QMAKE_CC -c $$QMAKE_CFLAGS \"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" -o \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" && \ + $$QMAKE_LINK $$QMAKE_LFLAGS -X -r5 -r4 \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" \"$(TARGET)\" -o \"$(TARGET).munched\" && \ + mv \"$(TARGET).munched\" \"$(TARGET)\" && \ + chmod +x \"$(TARGET)\") + } + *-g++ { + VXWORKS_MUNCH_CMD = (targ=`basename $(TARGET)`; \ + nm \"$(DESTDIR)$(TARGET)\" | tclsh $$VXWORKS_MUNCH_TOOL -c $$VXWORKS_ARCH_MUNCH >\"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" && \ + $$QMAKE_CC -c $$QMAKE_CFLAGS -fdollars-in-identifiers \"$(OBJECTS_DIR)/\$\${targ}_ctdt.c\" -o \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" && \ + $$QMAKE_LINK $$QMAKE_LFLAGS -nostdlib -Wl,-X -T $(WIND_BASE)/target/h/tool/gnu/ldscripts/link.OUT \"$(OBJECTS_DIR)/\$\${targ}_ctdt.o\" \"$(DESTDIR)$(TARGET)\" -o \"$(DESTDIR)$(TARGET).munched\" && \ + mv \"$(DESTDIR)$(TARGET).munched\" \"$(DESTDIR)$(TARGET)\" && \ + chmod +x \"$(DESTDIR)$(TARGET)\") + } + + # We need to create a dummy lib.a in case someone links against this lib. + # In VxWorks it's the responsibility of the run-time linker ld to resolve + # symbols, since there are no real shared libraries for the toolchain linker + # to link against. + + shared:contains(TEMPLATE, lib) { + VXWORKS_MUNCH_CMD += "&&" + VXWORKS_MUNCH_CMD += (atarg=`basename $(TARGET) .so.$${VERSION}`.a ; touch \"$(DESTDIR)\$\${atarg}\") + } + + QMAKE_POST_LINK = $$VXWORKS_MUNCH_CMD $$QMAKE_POST_LINK + silent:QMAKE_POST_LINK = @echo creating $@.$$VXWORKS_MUNCH_EXT && $$QMAKE_POST_LINK + + isEmpty(DESTDIR) { + target.targets += "`basename $(TARGET)`.$$VXWORKS_MUNCH_EXT" + QMAKE_DISTCLEAN += "`basename $(TARGET)`.$$VXWORKS_MUNCH_EXT" + } else { + target.targets += "$(DESTDIR)/`basename $(TARGET)`.$$VXWORKS_MUNCH_EXT" + QMAKE_DISTCLEAN += "$(DESTDIR)/`basename $(TARGET)`.$$VXWORKS_MUNCH_EXT" + } + *-g++:LIBS += -lgcc +} + diff --git a/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf new file mode 100644 index 0000000000..a8f7e49b56 --- /dev/null +++ b/mkspecs/unsupported/vxworks-ppc-dcc/qmake.conf @@ -0,0 +1,111 @@ +# +# qmake configuration for vxworks-ppc-dcc +# + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release incremental link_prl vxworks +QT += core gui network +QMAKE_INCREMENTAL_STYLE = sublib + +VXWORKS_ARCH = ppc +VXWORKS_CPU = PPC32 +VXWORKS_DIAB_SPEC = -tPPC7400FV:vxworks66 +VXWORKS_ARCH_MUNCH = ppc + +QMAKE_CC = dcc +QMAKE_CFLAGS += $$VXWORKS_DIAB_SPEC -Xkeywords=0x0 -Xcode-absolute-far -Xansi -Xforce-declarations -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -DCPU=$$upper($$VXWORKS_ARCH) -DVX_CPU_FAMILY=$$VXWORKS_ARCH -DTOOL_FAMILY=diab -DTOOL=diab -D_WRS_KERNEL -DVXWORKS -D_VSB_CONFIG_FILE=\'<../lib/h/config/vsbConfig.h>\' +QMAKE_CFLAGS_DEPS += +QMAKE_CFLAGS_WARN_ON += +QMAKE_CFLAGS_WARN_OFF += -Xsuppress-warnings +QMAKE_CFLAGS_RELEASE += +QMAKE_CFLAGS_DEBUG += -g +QMAKE_CFLAGS_SHLIB += +QMAKE_CFLAGS_STATIC_LIB += +QMAKE_CFLAGS_YACC += +QMAKE_CFLAGS_HIDESYMS += +QMAKE_CFLAGS_PRECOMPILE += +QMAKE_CFLAGS_USE_PRECOMPILE += + +QMAKE_CXX = dcc +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS +QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB +QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB +QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS +QMAKE_CXXFLAGS_PRECOMPILE += +QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE + +QMAKE_LINK = dld +QMAKE_LINK_SHLIB = dld +QMAKE_LFLAGS += $$VXWORKS_DIAB_SPEC +QMAKE_LFLAGS_RELEASE += +QMAKE_LFLAGS_DEBUG += +QMAKE_LFLAGS_APP += -r5 +QMAKE_LFLAGS_SHLIB += +QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_SONAME += +QMAKE_LFLAGS_THREAD += +QMAKE_LFLAGS_NOUNDEF += +QMAKE_RPATH = + +QMAKE_PCH_OUTPUT_EXT = .gch + +# -Bsymbolic-functions (ld) support +QMAKE_LFLAGS_BSYMBOLIC_FUNC = +QMAKE_LFLAGS_DYNAMIC_LIST = + +QMAKE_CFLAGS_THREAD += -D_REENTRANT +QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD + +QMAKE_INCDIR = +QMAKE_LIBDIR = +QMAKE_INCDIR_X11 = $(WIND_HOME)/GSS/include +QMAKE_LIBDIR_X11 = $(WIND_HOME)/GSS/lib +QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] +QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] +QMAKE_INCDIR_OPENGL = $$QMAKE_INCDIR_X11 +QMAKE_LIBDIR_OPENGL = $$QMAKE_LIBDIR_X11 + +QMAKE_LIBS = +QMAKE_LIBS_DYNLOAD = +QMAKE_LIBS_X11 = -lXext -lX11 +QMAKE_LIBS_X11SM = -lSM -lICE +QMAKE_LIBS_NIS = -lnsl +QMAKE_LIBS_OPENGL = -lGLU -lGL +QMAKE_LIBS_OPENGL_QT = -lGL +QMAKE_LIBS_THREAD = +QMAKE_LIBS_NETWORK = # -lnetwrap # only needed if kernel is missing gethostbyname and friends + + +QMAKE_MOC = $$[QT_INSTALL_BINS]/moc +QMAKE_UIC = $$[QT_INSTALL_BINS]/uic + +QMAKE_AR = ar cqs +QMAKE_OBJCOPY = objcopy +QMAKE_RANLIB = + +QMAKE_TAR = tar -cf +QMAKE_GZIP = gzip -9f + +QMAKE_COPY = cp -f +QMAKE_COPY_FILE = $(COPY) +QMAKE_COPY_DIR = $(COPY) -r +QMAKE_MOVE = mv -f +QMAKE_DEL_FILE = rm -f +QMAKE_DEL_DIR = rmdir +QMAKE_STRIP = strip +QMAKE_STRIPFLAGS_LIB += --strip-unneeded +QMAKE_CHK_DIR_EXISTS = test -d +QMAKE_MKDIR = mkdir -p +QMAKE_INSTALL_FILE = install -m 644 -p +QMAKE_INSTALL_PROGRAM = install -m 755 -p + +include(../../common/unix.conf) +load(qt_config) + diff --git a/mkspecs/unsupported/vxworks-ppc-dcc/qplatformdefs.h b/mkspecs/unsupported/vxworks-ppc-dcc/qplatformdefs.h new file mode 100644 index 0000000000..4b0c24c83a --- /dev/null +++ b/mkspecs/unsupported/vxworks-ppc-dcc/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../vxworks-simpentium-g++/qplatformdefs.h" diff --git a/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf b/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf new file mode 100644 index 0000000000..be8c13d0b6 --- /dev/null +++ b/mkspecs/unsupported/vxworks-ppc-g++/qmake.conf @@ -0,0 +1,37 @@ +# +# qmake configuration for vxworks-simpentium-g++ +# + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release incremental link_prl vxworks +QT += core gui network +QMAKE_INCREMENTAL_STYLE = sublib +DEFINES += VXWORKS + +VXWORKS_ARCH = ppc +VXWORKS_CPU = PPC32 +VXWORKS_ARCH_MUNCH = ppc + +include(../../common/g++.conf) +include(../../common/linux.conf) + +QMAKE_CC = cc$$VXWORKS_ARCH_MUNCH +QMAKE_CFLAGS = -fno-builtin -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -DCPU=$$upper($$VXWORKS_ARCH) -DVX_CPU_FAMILY=$$VXWORKS_ARCH -DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL -D_VSB_CONFIG_FILE=\'<../lib/h/config/vsbConfig.h>\' +QMAKE_CFLAGS_SHLIB = # remove -fPIC +QMAKE_CFLAGS_STATIC_LIB = # remove -fPIC +QMAKE_CXX = c++$$VXWORKS_ARCH_MUNCH +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_SHLIB= # remove -fPIC +QMAKE_CXXFLAGS_STATIC_LIB= # remove -fPIC +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX +QMAKE_LFLAGS_SHLIB = -Wl,-Ur -L $(WIND_BASE)/target/lib/$$VXWORKS_ARCH/$$VXWORKS_CPU/common # remove -shared +QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_APP += -Wl,-Ur -L $(WIND_BASE)/target/lib/$$VXWORKS_ARCH/$$VXWORKS_CPU/common +# QMAKE_LIBS_NETWORK = # -lnetwrap # only needed if kernel is missing gethostbyname() and friends +QMAKE_LIBS_DYNLOAD = +QMAKE_LIBS_THREAD = + +load(qt_config) + diff --git a/mkspecs/unsupported/vxworks-ppc-g++/qplatformdefs.h b/mkspecs/unsupported/vxworks-ppc-g++/qplatformdefs.h new file mode 100644 index 0000000000..4b0c24c83a --- /dev/null +++ b/mkspecs/unsupported/vxworks-ppc-g++/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../vxworks-simpentium-g++/qplatformdefs.h" diff --git a/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf new file mode 100644 index 0000000000..6228a6be3a --- /dev/null +++ b/mkspecs/unsupported/vxworks-simpentium-dcc/qmake.conf @@ -0,0 +1,110 @@ +# +# qmake configuration for vxworks-simpentium-dcc +# + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release incremental link_prl vxworks +QT += core gui network +QMAKE_INCREMENTAL_STYLE = sublib + +VXWORKS_ARCH = simlinux +VXWORKS_CPU = SIMLINUX +VXWORKS_DIAB_SPEC = -tX86LH:vxworks66 +VXWORKS_ARCH_MUNCH = pentium + +QMAKE_CC = dcc +QMAKE_CFLAGS += $$VXWORKS_DIAB_SPEC -Xkeywords=0x0 -Xcode-absolute-far -Xansi -Xforce-declarations -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -DCPU=$$upper($$VXWORKS_ARCH) -DVX_CPU_FAMILY=$$VXWORKS_ARCH -DTOOL_FAMILY=diab -DTOOL=diab -D_WRS_KERNEL -DVXWORKS -D_VSB_CONFIG_FILE=\'<../lib/h/config/vsbConfig.h>\' +QMAKE_CFLAGS_DEPS += +QMAKE_CFLAGS_WARN_ON += +QMAKE_CFLAGS_WARN_OFF += -Xsuppress-warnings +QMAKE_CFLAGS_RELEASE += +QMAKE_CFLAGS_DEBUG += -g +QMAKE_CFLAGS_SHLIB += +QMAKE_CFLAGS_STATIC_LIB += +QMAKE_CFLAGS_YACC += +QMAKE_CFLAGS_HIDESYMS += +QMAKE_CFLAGS_PRECOMPILE += +QMAKE_CFLAGS_USE_PRECOMPILE += + +QMAKE_CXX = dcc +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS +QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB +QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB +QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS +QMAKE_CXXFLAGS_PRECOMPILE += +QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE + +QMAKE_LINK = dld +QMAKE_LINK_SHLIB = dld +QMAKE_LFLAGS += $$VXWORKS_DIAB_SPEC -L $(WIND_BASE)/target/lib/$$VXWORKS_ARCH/$$VXWORKS_CPU/common +QMAKE_LFLAGS_RELEASE += +QMAKE_LFLAGS_DEBUG += +QMAKE_LFLAGS_APP += -r5 +QMAKE_LFLAGS_SHLIB += +QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_SONAME += +QMAKE_LFLAGS_THREAD += +QMAKE_LFLAGS_NOUNDEF += +QMAKE_RPATH = + +QMAKE_PCH_OUTPUT_EXT = .gch + +# -Bsymbolic-functions (ld) support +QMAKE_LFLAGS_BSYMBOLIC_FUNC = +QMAKE_LFLAGS_DYNAMIC_LIST = + +QMAKE_CFLAGS_THREAD += -D_REENTRANT +QMAKE_CXXFLAGS_THREAD += $$QMAKE_CFLAGS_THREAD + +QMAKE_INCDIR = +QMAKE_LIBDIR = +QMAKE_INCDIR_X11 = $(WIND_HOME)/GSS/include +QMAKE_LIBDIR_X11 = $(WIND_HOME)/GSS/lib +QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] +QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] +QMAKE_INCDIR_OPENGL = $$QMAKE_INCDIR_X11 +QMAKE_LIBDIR_OPENGL = $$QMAKE_LIBDIR_X11 + +QMAKE_LIBS = +QMAKE_LIBS_DYNLOAD = +QMAKE_LIBS_X11 = -lXext -lX11 +QMAKE_LIBS_X11SM = -lSM -lICE +QMAKE_LIBS_NIS = -lnsl +QMAKE_LIBS_OPENGL = -lGLU -lGL +QMAKE_LIBS_OPENGL_QT = -lGL +QMAKE_LIBS_THREAD = +QMAKE_LIBS_NETWORK = # -lnet # only needed if kernel is missing gethostbyname and friends + +QMAKE_MOC = $$[QT_INSTALL_BINS]/moc +QMAKE_UIC = $$[QT_INSTALL_BINS]/uic + +QMAKE_AR = ar cqs +QMAKE_OBJCOPY = objcopy +QMAKE_RANLIB = + +QMAKE_TAR = tar -cf +QMAKE_GZIP = gzip -9f + +QMAKE_COPY = cp -f +QMAKE_COPY_FILE = $(COPY) +QMAKE_COPY_DIR = $(COPY) -r +QMAKE_MOVE = mv -f +QMAKE_DEL_FILE = rm -f +QMAKE_DEL_DIR = rmdir +QMAKE_STRIP = strip +QMAKE_STRIPFLAGS_LIB += --strip-unneeded +QMAKE_CHK_DIR_EXISTS = test -d +QMAKE_MKDIR = mkdir -p +QMAKE_INSTALL_FILE = install -m 644 -p +QMAKE_INSTALL_PROGRAM = install -m 755 -p + +include(../../common/unix.conf) +load(qt_config) + diff --git a/mkspecs/unsupported/vxworks-simpentium-dcc/qplatformdefs.h b/mkspecs/unsupported/vxworks-simpentium-dcc/qplatformdefs.h new file mode 100644 index 0000000000..4b0c24c83a --- /dev/null +++ b/mkspecs/unsupported/vxworks-simpentium-dcc/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../vxworks-simpentium-g++/qplatformdefs.h" diff --git a/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf b/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf new file mode 100644 index 0000000000..29e9c70c5d --- /dev/null +++ b/mkspecs/unsupported/vxworks-simpentium-g++/qmake.conf @@ -0,0 +1,37 @@ +# +# qmake configuration for vxworks-simpentium-g++ +# + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release incremental link_prl vxworks +QT += core gui network +QMAKE_INCREMENTAL_STYLE = sublib +DEFINES += VXWORKS + +VXWORKS_ARCH = simlinux +VXWORKS_CPU = SIMLINUX +VXWORKS_ARCH_MUNCH = pentium + +include(../../common/g++.conf) +include(../../common/linux.conf) + +QMAKE_CC = cc$$VXWORKS_ARCH_MUNCH +QMAKE_CFLAGS = -fno-builtin -I$(WIND_BASE)/target/h -I$(WIND_BASE)/target/h/wrn/coreip -DCPU=$$upper($$VXWORKS_ARCH) -DVX_CPU_FAMILY=$$VXWORKS_ARCH -DTOOL_FAMILY=gnu -DTOOL=gnu -D_WRS_KERNEL -D_VSB_CONFIG_FILE=\'<../lib/h/config/vsbConfig.h>\' +QMAKE_CFLAGS_SHLIB = # remove -fPIC +QMAKE_CFLAGS_STATIC_LIB = # remove -fPIC +QMAKE_CXX = c++$$VXWORKS_ARCH_MUNCH +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_SHLIB= # remove -fPIC +QMAKE_CXXFLAGS_STATIC_LIB= # remove -fPIC +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX +QMAKE_LFLAGS_SHLIB = -Wl,-Ur -L $(WIND_BASE)/target/lib/$$VXWORKS_ARCH/$$VXWORKS_CPU/common # remove -shared +QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_APP += -Wl,-Ur -L $(WIND_BASE)/target/lib/$$VXWORKS_ARCH/$$VXWORKS_CPU/common +QMAKE_LIBS_NETWORK = # -lnetwrap # only needed if kernel is missing gethostbyname() and friends +QMAKE_LIBS_DYNLOAD = +QMAKE_LIBS_THREAD = + +load(qt_config) + diff --git a/mkspecs/unsupported/vxworks-simpentium-g++/qplatformdefs.h b/mkspecs/unsupported/vxworks-simpentium-g++/qplatformdefs.h new file mode 100644 index 0000000000..90eb9552ce --- /dev/null +++ b/mkspecs/unsupported/vxworks-simpentium-g++/qplatformdefs.h @@ -0,0 +1,128 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#include "qglobal.h" +#include "qfunctions_vxworks.h" + + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_STATBUF struct stat64 +#define QT_STATBUF4TSTAT struct stat64 +#define QT_STAT ::stat64 +#define QT_FSTAT ::fstat64 +#define QT_LSTAT ::stat64 +#define QT_OPEN ::open64 +#define QT_TRUNCATE ::truncate64 +#define QT_FTRUNCATE ::ftruncate64 +#define QT_LSEEK ::lseek64 +#else +#define QT_STATBUF struct stat +#define QT_STATBUF4TSTAT struct stat +#define QT_STAT ::stat +#define QT_FSTAT ::fstat +#define QT_LSTAT ::stat +#define QT_OPEN ::open +#define QT_TRUNCATE ::truncate +#define QT_FTRUNCATE ::ftruncate +#define QT_LSEEK ::lseek +#endif + +#ifdef QT_LARGEFILE_SUPPORT +#define QT_FOPEN ::fopen64 +#define QT_FSEEK ::fseeko64 +#define QT_FTELL ::ftello64 +#define QT_FGETPOS ::fgetpos64 +#define QT_FSETPOS ::fsetpos64 +#define QT_FPOS_T fpos64_t +#define QT_OFF_T off64_t +#else +#define QT_FOPEN ::fopen +#define QT_FSEEK ::fseek +#define QT_FTELL ::ftell +#define QT_FGETPOS ::fgetpos +#define QT_FSETPOS ::fsetpos +#define QT_FPOS_T fpos_t +#define QT_OFF_T long +#endif + +#define QT_STAT_REG S_IFREG +#define QT_STAT_DIR S_IFDIR +#define QT_STAT_MASK S_IFMT +#define QT_STAT_LNK S_IFLNK +#define QT_SOCKET_CONNECT(sd, to, tolen) \ + ::connect(sd, (struct sockaddr *) to, tolen) +#define QT_SOCKET_BIND ::bind +#define QT_FILENO fileno +#define QT_CLOSE ::close +#define QT_READ(fd, buf, len) ::read(fd, (char*) buf, len) +#define QT_WRITE(fd, buf, len) ::write(fd, (char*) buf, len) +#define QT_ACCESS ::access +#define QT_GETCWD ::getcwd +#define QT_CHDIR ::chdir +#define QT_MKDIR(dir, perm) ::mkdir(dir) +#define QT_RMDIR ::rmdir +#define QT_OPEN_LARGEFILE O_LARGEFILE +#define QT_OPEN_RDONLY O_RDONLY +#define QT_OPEN_WRONLY O_WRONLY +#define QT_OPEN_RDWR O_RDWR +#define QT_OPEN_CREAT O_CREAT +#define QT_OPEN_TRUNC O_TRUNC +#define QT_OPEN_APPEND O_APPEND + +#define QT_SIGNAL_RETTYPE void +#define QT_SIGNAL_ARGS int +#define QT_SIGNAL_IGNORE SIG_IGN + +// there IS a socklen_t in sys/socket.h (unsigned int), +// but sockLib.h uses int in all function declaration... +//#define QT_SOCKLEN_T socklen_t +#define QT_SOCKLEN_T int + +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf + + +#endif // QPLATFORMDEFS_H diff --git a/src/3rdparty/freetype/builds/unix/ftsystem.c b/src/3rdparty/freetype/builds/unix/ftsystem.c index 3a740fd02d..40fa8d09d7 100644 --- a/src/3rdparty/freetype/builds/unix/ftsystem.c +++ b/src/3rdparty/freetype/builds/unix/ftsystem.c @@ -69,6 +69,9 @@ #include #include +#ifdef VXWORKS +#include +#endif /*************************************************************************/ /* */ @@ -238,7 +241,7 @@ return FT_Err_Invalid_Stream_Handle; /* open the file */ - file = open( filepathname, O_RDONLY ); + file = open( filepathname, O_RDONLY, 0); if ( file < 0 ) { FT_ERROR(( "FT_Stream_Open:" )); @@ -317,7 +320,11 @@ read_count = read( file, +#ifndef VXWORKS stream->base + total_read_count, +#else + (char *) stream->base + total_read_count, +#endif stream->size - total_read_count ); if ( read_count <= 0 ) diff --git a/src/3rdparty/libjpeg/jmorecfg.h b/src/3rdparty/libjpeg/jmorecfg.h index 54a7d1c447..b0b587065e 100644 --- a/src/3rdparty/libjpeg/jmorecfg.h +++ b/src/3rdparty/libjpeg/jmorecfg.h @@ -157,7 +157,7 @@ typedef short INT16; /* INT32 must hold at least signed 32-bit values. */ -#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ +#if !defined(XMD_H) && !defined(VXWORKS) /* X11/xmd.h correctly defines INT32 */ typedef long INT32; #endif @@ -183,6 +183,9 @@ typedef unsigned int JDIMENSION; /* a function called through method pointers: */ #define METHODDEF(type) static type /* a function used only in its module: */ +#if defined(VXWORKS) && defined(LOCAL) +# undef LOCAL +#endif #define LOCAL(type) static type /* a function referenced thru EXTERNs: */ #define GLOBAL(type) type diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h index 19e4732fec..8eb7d351b5 100644 --- a/src/3rdparty/libpng/pngconf.h +++ b/src/3rdparty/libpng/pngconf.h @@ -344,7 +344,7 @@ # endif /* __linux__ */ #endif /* PNG_SETJMP_SUPPORTED */ -#ifdef BSD +#if defined(BSD) && !defined(VXWORKS) # include #else # include diff --git a/src/3rdparty/libtiff/libtiff/tif_config.h b/src/3rdparty/libtiff/libtiff/tif_config.h index e95f7a47d2..689421c2b3 100644 --- a/src/3rdparty/libtiff/libtiff/tif_config.h +++ b/src/3rdparty/libtiff/libtiff/tif_config.h @@ -104,7 +104,7 @@ /* #undef HAVE_PTHREAD */ /* Define to 1 if you have the header file. */ -#if !defined(Q_OS_WINCE) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_VXWORKS) #define HAVE_SEARCH_H 1 #endif diff --git a/src/3rdparty/patches/freetype-2.3.6-vxworks.patch b/src/3rdparty/patches/freetype-2.3.6-vxworks.patch new file mode 100644 index 0000000000..21e884cd59 --- /dev/null +++ b/src/3rdparty/patches/freetype-2.3.6-vxworks.patch @@ -0,0 +1,35 @@ +diff --git builds/unix/ftsystem.c builds/unix/ftsystem.c +index 3a740fd..40fa8d0 100644 +--- builds/unix/ftsystem.c ++++ builds/unix/ftsystem.c +@@ -69,6 +69,9 @@ + #include + #include + ++#ifdef VXWORKS ++#include ++#endif + + /*************************************************************************/ + /* */ +@@ -238,7 +241,7 @@ + return FT_Err_Invalid_Stream_Handle; + + /* open the file */ +- file = open( filepathname, O_RDONLY ); ++ file = open( filepathname, O_RDONLY, 0); + if ( file < 0 ) + { + FT_ERROR(( "FT_Stream_Open:" )); +@@ -317,7 +320,11 @@ + + + read_count = read( file, ++#ifndef VXWORKS + stream->base + total_read_count, ++#else ++ (char *) stream->base + total_read_count, ++#endif + stream->size - total_read_count ); + + if ( read_count <= 0 ) diff --git a/src/3rdparty/patches/libjpeg-6b-vxworks.patch b/src/3rdparty/patches/libjpeg-6b-vxworks.patch new file mode 100644 index 0000000000..263c8d00ed --- /dev/null +++ b/src/3rdparty/patches/libjpeg-6b-vxworks.patch @@ -0,0 +1,23 @@ +diff --git jmorecfg.h jmorecfg.h +index 54a7d1c..b0b5870 100644 +--- jmorecfg.h ++++ jmorecfg.h +@@ -157,7 +157,7 @@ typedef short INT16; + + /* INT32 must hold at least signed 32-bit values. */ + +-#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ ++#if !defined(XMD_H) && !defined(VXWORKS) /* X11/xmd.h correctly defines INT32 */ + typedef long INT32; + #endif + +@@ -183,6 +183,9 @@ typedef unsigned int JDIMENSION; + /* a function called through method pointers: */ + #define METHODDEF(type) static type + /* a function used only in its module: */ ++#if defined(VXWORKS) && defined(LOCAL) ++# undef LOCAL ++#endif + #define LOCAL(type) static type + /* a function referenced thru EXTERNs: */ + #define GLOBAL(type) type diff --git a/src/3rdparty/patches/libpng-1.2.20-vxworks.patch b/src/3rdparty/patches/libpng-1.2.20-vxworks.patch new file mode 100644 index 0000000000..4c49b3fc64 --- /dev/null +++ b/src/3rdparty/patches/libpng-1.2.20-vxworks.patch @@ -0,0 +1,13 @@ +diff --git pngconf.h pngconf.h +index 19e4732..8eb7d35 100644 +--- pngconf.h ++++ pngconf.h +@@ -344,7 +344,7 @@ + # endif /* __linux__ */ + #endif /* PNG_SETJMP_SUPPORTED */ + +-#ifdef BSD ++#if defined(BSD) && !defined(VXWORKS) + # include + #else + # include diff --git a/src/3rdparty/patches/libtiff-3.8.2-vxworks.patch b/src/3rdparty/patches/libtiff-3.8.2-vxworks.patch new file mode 100644 index 0000000000..b1b725e26d --- /dev/null +++ b/src/3rdparty/patches/libtiff-3.8.2-vxworks.patch @@ -0,0 +1,11 @@ +--- libtiff/tif_config.h.orig ++++ libtiff/tif_config.h +@@ -104,7 +104,7 @@ + /* #undef HAVE_PTHREAD */ + + /* Define to 1 if you have the header file. */ +-#if !defined(Q_OS_WINCE) ++#if !defined(Q_OS_WINCE) && !defined(Q_OS_VXWORKS) + #define HAVE_SEARCH_H 1 + #endif + diff --git a/src/3rdparty/patches/sqlite-3.5.6-vxworks.patch b/src/3rdparty/patches/sqlite-3.5.6-vxworks.patch new file mode 100644 index 0000000000..6ae65fd569 --- /dev/null +++ b/src/3rdparty/patches/sqlite-3.5.6-vxworks.patch @@ -0,0 +1,68 @@ +--- sqlite3.c.orig ++++ sqlite3.c +@@ -383,7 +383,7 @@ SQLITE_PRIVATE void sqlite3Coverage(int); + ** + ** See also ticket #2741. + */ +-#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE ++#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE && !defined(VXWORKS) + # define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ + #endif + +@@ -440,6 +440,13 @@ SQLITE_PRIVATE void sqlite3Coverage(int); + */ + #ifndef _SQLITE3_H_ + #define _SQLITE3_H_ ++ ++#ifdef VXWORKS ++# define SQLITE_HOMEGROWN_RECURSIVE_MUTEX ++# define NO_GETTOD ++# include ++#endif ++ + #include /* Needed for the definition of va_list */ + + /* +@@ -18792,7 +18799,11 @@ SQLITE_PRIVATE sqlite3_vfs *sqlite3OsDefaultVfs(void){ + #include + #include + #include +-#include ++#ifdef VXWORKS ++# include ++#else ++# include ++#endif + #include + #ifdef SQLITE_ENABLE_LOCKING_STYLE + #include +@@ -19728,7 +19739,11 @@ static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){ + if( newOffset!=offset ){ + return -1; + } ++# ifndef VXWORKS + got = write(id->h, pBuf, cnt); ++# else ++ got = write(id->h, (char *)pBuf, cnt); ++# endif + #endif + TIMER_END; + OSTRACE5("WRITE %-3d %5d %7lld %d\n", id->h, got, offset, TIMER_ELAPSED); +@@ -21554,12 +21569,16 @@ static int unixRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ + #if !defined(SQLITE_TEST) + { + int pid, fd; +- fd = open("/dev/urandom", O_RDONLY); ++ fd = open("/dev/urandom", O_RDONLY, 0); + if( fd<0 ){ + time_t t; + time(&t); + memcpy(zBuf, &t, sizeof(t)); ++#ifndef VXWORKS + pid = getpid(); ++#else ++ pid = (int)taskIdCurrent(); ++#endif + memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid)); + }else{ + read(fd, zBuf, nBuf); diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index 91ce30f556..7e604cb77a 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -383,7 +383,7 @@ SQLITE_PRIVATE void sqlite3Coverage(int); ** ** See also ticket #2741. */ -#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE +#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE && !defined(VXWORKS) # define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ #endif @@ -440,6 +440,13 @@ SQLITE_PRIVATE void sqlite3Coverage(int); */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ + +#ifdef VXWORKS +# define SQLITE_HOMEGROWN_RECURSIVE_MUTEX +# define NO_GETTOD +# include +#endif + #include /* Needed for the definition of va_list */ /* @@ -18792,7 +18799,11 @@ SQLITE_PRIVATE sqlite3_vfs *sqlite3OsDefaultVfs(void){ #include #include #include -#include +#ifdef VXWORKS +# include +#else +# include +#endif #include #ifdef SQLITE_ENABLE_LOCKING_STYLE #include @@ -19728,7 +19739,11 @@ static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){ if( newOffset!=offset ){ return -1; } +# ifndef VXWORKS got = write(id->h, pBuf, cnt); +# else + got = write(id->h, (char *)pBuf, cnt); +# endif #endif TIMER_END; OSTRACE5("WRITE %-3d %5d %7lld %d\n", id->h, got, offset, TIMER_ELAPSED); @@ -21554,12 +21569,16 @@ static int unixRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ #if !defined(SQLITE_TEST) { int pid, fd; - fd = open("/dev/urandom", O_RDONLY); + fd = open("/dev/urandom", O_RDONLY, 0); if( fd<0 ){ time_t t; time(&t); memcpy(zBuf, &t, sizeof(t)); +#ifndef VXWORKS pid = getpid(); +#else + pid = (int)taskIdCurrent(); +#endif memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid)); }else{ read(fd, zBuf, nBuf); diff --git a/src/corelib/arch/arch.pri b/src/corelib/arch/arch.pri index 20b9227ee7..dd3141a3cc 100644 --- a/src/corelib/arch/arch.pri +++ b/src/corelib/arch/arch.pri @@ -4,6 +4,8 @@ win32:HEADERS += arch/qatomic_windows.h \ mac:HEADERS += arch/qatomic_macosx.h \ arch/qatomic_generic.h +vxworks:HEADERS += arch/qatomic_vxworks.h + !wince*:!win32:!mac:HEADERS += arch/qatomic_alpha.h \ arch/qatomic_avr32.h \ arch/qatomic_ia64.h \ diff --git a/src/corelib/arch/qatomic_arch.h b/src/corelib/arch/qatomic_arch.h index 724cf7e991..17e4630aea 100644 --- a/src/corelib/arch/qatomic_arch.h +++ b/src/corelib/arch/qatomic_arch.h @@ -46,7 +46,9 @@ QT_BEGIN_HEADER #include "QtCore/qglobal.h" -#if defined(QT_ARCH_ALPHA) +#if defined(QT_ARCH_VXWORKS) +# include "QtCore/qatomic_vxworks.h" +#elif defined(QT_ARCH_ALPHA) # include "QtCore/qatomic_alpha.h" #elif defined(QT_ARCH_ARM) # include "QtCore/qatomic_arm.h" diff --git a/src/corelib/arch/qatomic_vxworks.h b/src/corelib/arch/qatomic_vxworks.h new file mode 100644 index 0000000000..573a44dbc9 --- /dev/null +++ b/src/corelib/arch/qatomic_vxworks.h @@ -0,0 +1,318 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QATOMIC_VXWORKS_H +#define QATOMIC_VXWORKS_H + +QT_BEGIN_HEADER + +#if defined(__ppc) +# include +#else // generic implementation with taskLock() + +#if 0 +// we don't want to include the system header here for two function prototypes, +// because it pulls in a _lot_ of stuff that pollutes the global namespace +# include +# include +#else +extern "C" int taskLock(); +extern "C" int taskUnlock(); +#endif + + + +QT_BEGIN_NAMESPACE + +#define Q_ATOMIC_INT_REFERENCE_COUNTING_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isReferenceCountingNative() +{ return false; } +inline bool QBasicAtomicInt::isReferenceCountingWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_TEST_AND_SET_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isTestAndSetNative() +{ return false; } +inline bool QBasicAtomicInt::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_STORE_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndStoreNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_INT_FETCH_AND_ADD_IS_NOT_NATIVE + +inline bool QBasicAtomicInt::isFetchAndAddNative() +{ return false; } +inline bool QBasicAtomicInt::isFetchAndAddWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_TEST_AND_SET_IS_NOT_NATIVE + +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::isTestAndSetNative() +{ return false; } +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::isTestAndSetWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_STORE_IS_NOT_NATIVE + +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::isFetchAndStoreNative() +{ return false; } +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::isFetchAndStoreWaitFree() +{ return false; } + +#define Q_ATOMIC_POINTER_FETCH_AND_ADD_IS_NOT_NATIVE + +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::isFetchAndAddNative() +{ return false; } +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::isFetchAndAddWaitFree() +{ return false; } + +// Reference counting + +inline bool QBasicAtomicInt::ref() +{ + taskLock(); + bool ret = (++_q_value != 0); + taskUnlock(); + return ret; +} + +inline bool QBasicAtomicInt::deref() +{ + taskLock(); + bool ret = (--_q_value != 0); + taskUnlock(); + return ret; +} + +// Test-and-set for integers + +inline bool QBasicAtomicInt::testAndSetOrdered(int expectedValue, int newValue) +{ + taskLock(); + if (_q_value == expectedValue) { + _q_value = newValue; + taskUnlock(); + return true; + } + taskUnlock(); + return false; +} + +inline bool QBasicAtomicInt::testAndSetRelaxed(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetAcquire(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +inline bool QBasicAtomicInt::testAndSetRelease(int expectedValue, int newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch-and-store for integers + +inline int QBasicAtomicInt::fetchAndStoreOrdered(int newValue) +{ + taskLock(); + int returnValue = _q_value; + _q_value = newValue; + taskUnlock(); + return returnValue; +} + +inline int QBasicAtomicInt::fetchAndStoreRelaxed(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreAcquire(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +inline int QBasicAtomicInt::fetchAndStoreRelease(int newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch-and-add for integers + +inline int QBasicAtomicInt::fetchAndAddOrdered(int valueToAdd) +{ + taskLock(); + int originalValue = _q_value; + _q_value += valueToAdd; + taskUnlock(); + return originalValue; +} + +inline int QBasicAtomicInt::fetchAndAddRelaxed(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddAcquire(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +inline int QBasicAtomicInt::fetchAndAddRelease(int valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +// Test and set for pointers + +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetOrdered(T *expectedValue, T *newValue) +{ + taskLock(); + if (_q_value == expectedValue) { + _q_value = newValue; + taskUnlock(); + return true; + } + taskUnlock(); + return false; +} + +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelaxed(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetAcquire(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +template +Q_INLINE_TEMPLATE bool QBasicAtomicPointer::testAndSetRelease(T *expectedValue, T *newValue) +{ + return testAndSetOrdered(expectedValue, newValue); +} + +// Fetch and store for pointers + +template +Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreOrdered(T *newValue) +{ + taskLock(); + T *returnValue = (_q_value); + _q_value = newValue; + taskUnlock(); + return returnValue; +} + +template +Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelaxed(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template +Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreAcquire(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +template +Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndStoreRelease(T *newValue) +{ + return fetchAndStoreOrdered(newValue); +} + +// Fetch and add for pointers + +template +Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddOrdered(qptrdiff valueToAdd) +{ + taskLock(); + T *returnValue = (_q_value); + _q_value += valueToAdd; + taskUnlock(); + return returnValue; +} + +template +Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddRelaxed(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template +Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddAcquire(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +template +Q_INLINE_TEMPLATE T *QBasicAtomicPointer::fetchAndAddRelease(qptrdiff valueToAdd) +{ + return fetchAndAddOrdered(valueToAdd); +} + +QT_END_NAMESPACE + +#endif // generic implementation with taskLock() + +QT_END_HEADER + +#endif // QATOMIC_VXWORKS_H diff --git a/src/corelib/arch/vxworks/arch.pri b/src/corelib/arch/vxworks/arch.pri new file mode 100644 index 0000000000..a7686186b0 --- /dev/null +++ b/src/corelib/arch/vxworks/arch.pri @@ -0,0 +1,6 @@ +# +# VxWorks generic +# +*-ppc-* { + SOURCES += qatomic_ppc.s +} diff --git a/src/corelib/arch/vxworks/qatomic_ppc.s b/src/corelib/arch/vxworks/qatomic_ppc.s new file mode 100644 index 0000000000..03971e89e8 --- /dev/null +++ b/src/corelib/arch/vxworks/qatomic_ppc.s @@ -0,0 +1,415 @@ + + .align 2 + .globl q_atomic_test_and_set_int + .globl .q_atomic_test_and_set_int +q_atomic_test_and_set_int: +.q_atomic_test_and_set_int: + lwarx 6,0,3 + xor. 6,6,4 + bne $+12 + stwcx. 5,0,3 + bne- $-16 + subfic 3,6,0 + adde 3,3,6 + blr +LT..q_atomic_test_and_set_int: + .long 0 + .byte 0,9,32,64,0,0,3,0 + .long 0 + .long LT..q_atomic_test_and_set_int-.q_atomic_test_and_set_int + .short 25 + .byte "q_atomic_test_and_set_int" + .align 2 + + .align 2 + .globl q_atomic_test_and_set_acquire_int + .globl .q_atomic_test_and_set_acquire_int +q_atomic_test_and_set_acquire_int: +.q_atomic_test_and_set_acquire_int: + lwarx 6,0,3 + xor. 6,6,4 + bne $+16 + stwcx. 5,0,3 + bne- $-16 + isync + subfic 3,6,0 + adde 3,3,6 + blr +LT..q_atomic_test_and_set_acquire_int: + .long 0 + .byte 0,9,32,64,0,0,3,0 + .long 0 + .long LT..q_atomic_test_and_set_acquire_int-.q_atomic_test_and_set_acquire_int + .short 33 + .byte "q_atomic_test_and_set_acquire_int" + .align 2 + + .align 2 + .globl q_atomic_test_and_set_release_int + .globl .q_atomic_test_and_set_release_int +q_atomic_test_and_set_release_int: +.q_atomic_test_and_set_release_int: + lwarx 6,0,3 + xor. 6,6,4 + bne $+12 + stwcx. 5,0,3 + bne- $-16 + subfic 3,6,0 + adde 3,3,6 + blr +LT..q_atomic_test_and_set_release_int: + .long 0 + .byte 0,9,32,64,0,0,3,0 + .long 0 + .long LT..q_atomic_test_and_set_release_int-.q_atomic_test_and_set_release_int + .short 33 + .byte "q_atomic_test_and_set_release_int" + .align 2 + + .align 2 + .globl q_atomic_test_and_set_ptr + .globl .q_atomic_test_and_set_ptr +q_atomic_test_and_set_ptr: +.q_atomic_test_and_set_ptr: + lwarx 6,0,3 + xor. 6,6,4 + bne $+12 + stwcx. 5,0,3 + bne- $-16 + subfic 3,6,0 + adde 3,3,6 + blr +LT..q_atomic_test_and_set_ptr: + .long 0 + .byte 0,9,32,64,0,0,3,0 + .long 0 + .long LT..q_atomic_test_and_set_ptr-.q_atomic_test_and_set_ptr + .short 25 + .byte "q_atomic_test_and_set_ptr" + .align 2 + + .align 2 + .globl q_atomic_test_and_set_acquire_ptr + .globl .q_atomic_test_and_set_acquire_ptr +q_atomic_test_and_set_acquire_ptr: +.q_atomic_test_and_set_acquire_ptr: + lwarx 6,0,3 + xor. 6,6,4 + bne $+16 + stwcx. 5,0,3 + bne- $-16 + isync + subfic 3,6,0 + adde 3,3,6 + blr +LT..q_atomic_test_and_set_acquire_ptr: + .long 0 + .byte 0,9,32,64,0,0,3,0 + .long 0 + .long LT..q_atomic_test_and_set_acquire_ptr-.q_atomic_test_and_set_acquire_ptr + .short 25 + .byte "q_atomic_test_and_set_acquire_ptr" + .align 2 + + .align 2 + .globl q_atomic_test_and_set_release_ptr + .globl .q_atomic_test_and_set_release_ptr +q_atomic_test_and_set_release_ptr: +.q_atomic_test_and_set_release_ptr: + lwarx 6,0,3 + xor. 6,6,4 + bne $+12 + stwcx. 5,0,3 + bne- $-16 + subfic 3,6,0 + adde 3,3,6 + blr +LT..q_atomic_test_and_set_release_ptr: + .long 0 + .byte 0,9,32,64,0,0,3,0 + .long 0 + .long LT..q_atomic_test_and_set_release_ptr-.q_atomic_test_and_set_release_ptr + .short 33 + .byte "q_atomic_test_and_set_release_ptr" + .align 2 + + .align 2 + .globl q_atomic_increment + .globl .q_atomic_increment +q_atomic_increment: +.q_atomic_increment: + lwarx 4,0,3 + addi 4,4,1 + stwcx. 4,0,3 + bne- $-12 + mr 3,4 + blr +LT..q_atomic_increment: + .long 0 + .byte 0,9,32,64,0,0,1,0 + .long 0 + .long LT..q_atomic_increment-.q_atomic_increment + .short 18 + .byte "q_atomic_increment" + .align 2 + + .align 2 + .globl q_atomic_decrement + .globl .q_atomic_decrement +q_atomic_decrement: +.q_atomic_decrement: + lwarx 4,0,3 + subi 4,4,1 + stwcx. 4,0,3 + bne- $-12 + mr 3,4 + blr +LT..q_atomic_decrement: + .long 0 + .byte 0,9,32,64,0,0,1,0 + .long 0 + .long LT..q_atomic_decrement-.q_atomic_decrement + .short 18 + .byte "q_atomic_decrement" + .align 2 + + .align 2 + .globl q_atomic_set_int + .globl .q_atomic_set_int +q_atomic_set_int: +.q_atomic_set_int: + lwarx 5,0,3 + stwcx. 4,0,3 + bne- $-8 + mr 3,5 + blr +LT..q_atomic_set_int: + .long 0 + .byte 0,9,32,64,0,0,2,0 + .long 0 + .long LT..q_atomic_set_int-.q_atomic_set_int + .short 16 + .byte "q_atomic_set_int" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_store_acquire_int + .globl .q_atomic_fetch_and_store_acquire_int +q_atomic_fetch_and_store_acquire_int: +.q_atomic_fetch_and_store_acquire_int: + lwarx 5,0,3 + stwcx. 4,0,3 + bne- $-8 + isync + mr 3,5 + blr +LT..q_atomic_fetch_and_store_acquire_int: + .long 0 + .byte 0,9,32,64,0,0,2,0 + .long 0 + .long LT..q_atomic_fetch_and_store_acquire_int-.q_atomic_fetch_and_store_acquire_int + .short 16 + .byte "q_atomic_fetch_and_store_acquire_int" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_store_release_int + .globl .q_atomic_fetch_and_store_release_int +q_atomic_fetch_and_store_release_int: +.q_atomic_fetch_and_store_release_int: + lwarx 5,0,3 + stwcx. 4,0,3 + bne- $-8 + mr 3,5 + blr +LT..q_atomic_fetch_and_store_release_int: + .long 0 + .byte 0,9,32,64,0,0,2,0 + .long 0 + .long LT..q_atomic_fetch_and_store_release_int-.q_atomic_fetch_and_store_release_int + .short 16 + .byte "q_atomic_fetch_and_store_release_int" + .align 2 + + .align 2 + .globl q_atomic_set_ptr + .globl .q_atomic_set_ptr +q_atomic_set_ptr: +.q_atomic_set_ptr: + lwarx 5,0,3 + stwcx. 4,0,3 + bne- $-8 + mr 3,5 + blr +LT..q_atomic_set_ptr: + .long 0 + .byte 0,9,32,64,0,0,2,0 + .long 0 + .long LT..q_atomic_set_ptr-.q_atomic_set_ptr + .short 16 + .byte "q_atomic_set_ptr" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_store_acquire_ptr + .globl .q_atomic_fetch_and_store_acquire_ptr +q_atomic_fetch_and_store_acquire_ptr: +.q_atomic_fetch_and_store_acquire_ptr: + lwarx 5,0,3 + stwcx. 4,0,3 + bne- $-8 + isync + mr 3,5 + blr +LT..q_atomic_fetch_and_store_acquire_ptr: + .long 0 + .byte 0,9,32,64,0,0,2,0 + .long 0 + .long LT..q_atomic_fetch_and_store_acquire_ptr-.q_atomic_fetch_and_store_acquire_ptr + .short 16 + .byte "q_atomic_fetch_and_store_acquire_ptr" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_store_release_ptr + .globl .q_atomic_fetch_and_store_release_ptr +q_atomic_fetch_and_store_release_ptr: +.q_atomic_fetch_and_store_release_ptr: + lwarx 5,0,3 + stwcx. 4,0,3 + bne- $-8 + mr 3,5 + blr +LT..q_atomic_fetch_and_store_release_ptr: + .long 0 + .byte 0,9,32,64,0,0,2,0 + .long 0 + .long LT..q_atomic_fetch_and_store_release_ptr-.q_atomic_fetch_and_store_release_ptr + .short 16 + .byte "q_atomic_fetch_and_store_release_ptr" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_add_int + .globl .q_atomic_fetch_and_add_int +q_atomic_fetch_and_add_int: +.q_atomic_fetch_and_add_int: + lwarx 5,0,3 + add 6,4,5 + stwcx. 6,0,3 + bne- $-12 + mr 3,5 + blr +LT..q_atomic_fetch_and_add_int: + .long 0 + .byte 0,9,32,64,0,0,1,0 + .long 0 + .long LT..q_atomic_fetch_and_add_int-.q_atomic_fetch_and_add_int + .short 18 + .byte "q_atomic_fetch_and_add_int" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_add_acquire_int + .globl .q_atomic_fetch_and_add_acquire_int +q_atomic_fetch_and_add_acquire_int: +.q_atomic_fetch_and_add_acquire_int: + lwarx 5,0,3 + add 6,4,5 + stwcx. 6,0,3 + bne- $-12 + isync + mr 3,5 + blr +LT..q_atomic_fetch_and_add_acquire_int: + .long 0 + .byte 0,9,32,64,0,0,1,0 + .long 0 + .long LT..q_atomic_fetch_and_add_acquire_int-.q_atomic_fetch_and_add_acquire_int + .short 18 + .byte "q_atomic_fetch_and_add_acquire_int" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_add_release_int + .globl .q_atomic_fetch_and_add_release_int +q_atomic_fetch_and_add_release_int: +.q_atomic_fetch_and_add_release_int: + lwarx 5,0,3 + add 6,4,5 + stwcx. 6,0,3 + bne- $-12 + mr 3,5 + blr +LT..q_atomic_fetch_and_add_release_int: + .long 0 + .byte 0,9,32,64,0,0,1,0 + .long 0 + .long LT..q_atomic_fetch_and_add_release_int-.q_atomic_fetch_and_add_release_int + .short 34 + .byte "q_atomic_fetch_and_add_release_int" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_add_ptr + .globl .q_atomic_fetch_and_add_ptr +q_atomic_fetch_and_add_ptr: +.q_atomic_fetch_and_add_ptr: + lwarx 5,0,3 + add 6,4,5 + stwcx. 6,0,3 + bne- $-12 + mr 3,5 + blr +LT..q_atomic_fetch_and_add_ptr: + .long 0 + .byte 0,9,32,64,0,0,1,0 + .long 0 + .long LT..q_atomic_fetch_and_add_ptr-.q_atomic_fetch_and_add_ptr + .short 26 + .byte "q_atomic_fetch_and_add_ptr" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_add_acquire_ptr + .globl .q_atomic_fetch_and_add_acquire_ptr +q_atomic_fetch_and_add_acquire_ptr: +.q_atomic_fetch_and_add_acquire_ptr: + lwarx 5,0,3 + add 6,4,5 + stwcx. 6,0,3 + bne- $-12 + isync + mr 3,5 + blr +LT..q_atomic_fetch_and_add_acquire_ptr: + .long 0 + .byte 0,9,32,64,0,0,1,0 + .long 0 + .long LT..q_atomic_fetch_and_add_acquire_ptr-.q_atomic_fetch_and_add_acquire_ptr + .short 34 + .byte "q_atomic_fetch_and_add_acquire_ptr" + .align 2 + + .align 2 + .globl q_atomic_fetch_and_add_release_ptr + .globl .q_atomic_fetch_and_add_release_ptr +q_atomic_fetch_and_add_release_ptr: +.q_atomic_fetch_and_add_release_ptr: + lwarx 5,0,3 + add 6,4,5 + stwcx. 6,0,3 + bne- $-12 + mr 3,5 + blr +LT..q_atomic_fetch_and_add_release_ptr: + .long 0 + .byte 0,9,32,64,0,0,1,0 + .long 0 + .long LT..q_atomic_fetch_and_add_release_ptr-.q_atomic_fetch_and_add_release_ptr + .short 34 + .byte "q_atomic_fetch_and_add_release_ptr" + .align 2 + +_section_.text: + .long _section_.text diff --git a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp index ee1ed3ade0..d0a37de967 100644 --- a/src/corelib/concurrent/qtconcurrentiteratekernel.cpp +++ b/src/corelib/concurrent/qtconcurrentiteratekernel.cpp @@ -52,6 +52,8 @@ #include #endif +#include "private/qfunctions_p.h" + #ifndef QT_NO_CONCURRENT diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index f7d651409a..99e373f17c 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -62,6 +62,10 @@ # endif #endif +#if defined(Q_OS_VXWORKS) +# include +#endif + #ifdef Q_CC_MWERKS #include #endif diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 4ceabeeee2..a631c6a3a7 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -251,6 +251,8 @@ namespace QT_NAMESPACE {} # define Q_OS_UNIXWARE #elif defined(__INTEGRITY) # define Q_OS_INTEGRITY +#elif defined(VXWORKS) /* there is no "real" VxWorks define - this has to be set in the mkspec! */ +# define Q_OS_VXWORKS #elif defined(__MAKEDEPEND__) #else # error "Qt has not been ported to this OS - talk to qt-bugs@trolltech.com" @@ -611,6 +613,13 @@ namespace QT_NAMESPACE {} # elif defined(__ghs) # define Q_CC_GHS +# elif defined(__DCC__) +# define Q_CC_DIAB +# undef Q_NO_BOOL_TYPE +# if !defined(__bool) +# define Q_NO_BOOL_TYPE +# endif + /* The UnixWare 7 UDK compiler is based on EDG and does define __EDG__ */ # elif defined(__USLC__) && defined(__SCO_VERSION__) # define Q_CC_USLC @@ -642,6 +651,11 @@ namespace QT_NAMESPACE {} # endif # endif +/* VxWorks' DIAB toolchain has an additional EDG type C++ compiler + (see __DCC__ above). This one is for C mode files (__EDG is not defined) */ +#elif defined(_DIAB_TOOL) +# define Q_CC_DIAB + /* Never tested! */ #elif defined(__HIGHC__) # define Q_CC_HIGHC @@ -1110,6 +1124,15 @@ class QDataStream; # define QT_NO_COP #endif +#if defined(Q_OS_VXWORKS) +# define QT_NO_CRASHHANDLER // no popen +# define QT_NO_PROCESS // no exec*, no fork +# define QT_NO_LPR +# define QT_NO_SHAREDMEMORY // only POSIX, no SysV and in the end... +# define QT_NO_SYSTEMSEMAPHORE // not needed at all in a flat address space +# define QT_NO_QWS_MULTIPROCESS // no processes +#endif + # include #define QT_SUPPORTS(FEATURE) (!defined(QT_NO_##FEATURE)) @@ -1552,7 +1575,7 @@ Q_CORE_EXPORT void qt_check_pointer(const char *, int); # define Q_CHECK_PTR(p) #endif -#if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) +#if (defined(Q_CC_GNU) && !defined(Q_OS_SOLARIS)) || defined(Q_CC_HPACC) || defined(Q_CC_DIAB) # define Q_FUNC_INFO __PRETTY_FUNCTION__ #elif defined(_MSC_VER) /* MSVC 2002 doesn't have __FUNCSIG__ nor can it handle QT_STRINGIFY. */ @@ -2142,6 +2165,17 @@ inline const QForeachContainer *qForeachContainer(const QForeachContainerBase qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk; \ --qForeachContainer(&_container_, true ? 0 : qForeachPointer(container))->brk) +#elif defined(Q_CC_DIAB) +// VxWorks DIAB generates unresolvable symbols, if container is a function call +# define Q_FOREACH(variable,container) \ + if(0){}else \ + for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \ + qForeachContainer(&_container_, (__typeof__(container) *) 0)->condition(); \ + ++qForeachContainer(&_container_, (__typeof__(container) *) 0)->i) \ + for (variable = *qForeachContainer(&_container_, (__typeof__(container) *) 0)->i; \ + qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk; \ + --qForeachContainer(&_container_, (__typeof__(container) *) 0)->brk) + #else # define Q_FOREACH(variable, container) \ for (const QForeachContainerBase &_container_ = qForeachContainerNew(container); \ diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 47e3db0252..c0b682067a 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -413,7 +413,7 @@ bool QFSFileEngine::mkdir(const QString &name, bool createParentDirectories) con if (QT_STAT(chunk, &st) != -1) { if ((st.st_mode & S_IFMT) != S_IFDIR) return false; - } else if (::mkdir(chunk, 0777) != 0) { + } else if (QT_MKDIR(chunk, 0777) != 0) { return false; } } @@ -424,7 +424,7 @@ bool QFSFileEngine::mkdir(const QString &name, bool createParentDirectories) con if (dirName[dirName.length() - 1] == QLatin1Char('/')) dirName = dirName.left(dirName.length() - 1); #endif - return (::mkdir(QFile::encodeName(dirName), 0777) == 0); + return (QT_MKDIR(QFile::encodeName(dirName), 0777) == 0); } bool QFSFileEngine::rmdir(const QString &name, bool recurseParentDirectories) const diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp index 16927ea0a5..42c57a4ddb 100644 --- a/src/corelib/io/qresource.cpp +++ b/src/corelib/io/qresource.cpp @@ -62,6 +62,15 @@ //#define DEBUG_RESOURCE_MATCH +#if defined(Q_OS_VXWORKS) +# if defined(m_data) +# undef m_data +# endif +# if defined(m_len) +# undef m_len +# endif +#endif + QT_BEGIN_NAMESPACE diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 7de5030962..e1a3b2615b 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -74,6 +74,10 @@ #endif // Q_OS_WIN #endif // QT_NO_QOBJECT +#ifdef Q_OS_VXWORKS +# include +#endif + #include #ifndef CSIDL_COMMON_APPDATA diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index b520bee6b9..e92e729d2e 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -73,7 +73,10 @@ #if defined(Q_OS_WINCE) # include -# include "qfunctions_wince.h" +#endif + +#if defined(Q_OS_VXWORKS) +# include #endif QT_BEGIN_NAMESPACE @@ -133,6 +136,8 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen) } #if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400 pid = _getpid(); +#elif defined(Q_OS_VXWORKS) + pid = (pid_t) taskIdCurrent; #else pid = getpid(); #endif @@ -234,7 +239,7 @@ static int _gettemp(char *path, int *doopen, int domkdir, int slen) #ifdef Q_OS_WIN if (QT_MKDIR(path) == 0) #else - if (mkdir(path, 0700) == 0) + if (QT_MKDIR(path, 0700) == 0) #endif return 1; if (errno != EEXIST) diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index 8759578db6..71772935b2 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -112,3 +112,10 @@ unix { contains(QT_CONFIG, clock-gettime):include($$QT_SOURCE_TREE/config.tests/unix/clock-gettime/clock-gettime.pri) } +vxworks { + SOURCES += \ + kernel/qfunctions_vxworks.cpp + HEADERS += \ + kernel/qfunctions_vxworks.h +} + diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 28c1d9cd92..0bc03cd792 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -41,8 +41,13 @@ #include "qcore_unix_p.h" -#include -#include +#ifndef Q_OS_VXWORKS +# include +# include +#else +# include +#endif + #include #include "qeventdispatcher_unix_p.h" // for the timeval operators diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index bffd67071d..fb0e6a581a 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -67,6 +67,10 @@ #include #include +#if defined(Q_OS_VXWORKS) +# include +#endif + struct sockaddr; #if defined(Q_OS_LINUX) && defined(__GLIBC__) && (__GLIBC__ * 0x100 + __GLIBC_MINOR__) >= 0x0204 @@ -129,6 +133,7 @@ static inline int qt_safe_open(const char *pathname, int flags, mode_t mode = 07 #undef QT_OPEN #define QT_OPEN qt_safe_open +#ifndef Q_OS_VXWORKS // no POSIX pipes in VxWorks // don't call ::pipe // call qt_safe_pipe static inline int qt_safe_pipe(int pipefd[2], int flags = 0) @@ -164,6 +169,8 @@ static inline int qt_safe_pipe(int pipefd[2], int flags = 0) return 0; } +#endif // Q_OS_VXWORKS + // don't call dup or fcntl(F_DUPFD) static inline int qt_safe_dup(int oldfd, int atleast = 0, int flags = FD_CLOEXEC) { @@ -238,6 +245,8 @@ static inline int qt_safe_close(int fd) #undef QT_CLOSE #define QT_CLOSE qt_safe_close +#ifndef Q_OS_VXWORKS // no processes in VxWorks + static inline int qt_safe_execve(const char *filename, char *const argv[], char *const envp[]) { @@ -267,6 +276,8 @@ static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options) return ret; } +#endif // Q_OS_VXWORKS + bool qt_gettime_is_monotonic(); timeval qt_gettime(); Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 706dc545c9..d0a4943d7e 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -61,6 +61,7 @@ #include #include #include +#include #ifdef Q_OS_UNIX # if !defined(QT_NO_GLIB) @@ -83,6 +84,10 @@ # include #endif +#ifdef Q_OS_VXWORKS +# include +#endif + QT_BEGIN_NAMESPACE #if defined(Q_WS_WIN) || defined(Q_WS_MAC) @@ -1821,8 +1826,9 @@ qint64 QCoreApplication::applicationPid() { #if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) return GetCurrentProcessId(); +#elif defined(Q_OS_VXWORKS) + return (pid_t) taskIdCurrent; #else - // UNIX return getpid(); #endif } diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 2943c6d2f3..51c7b9c523 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -55,6 +55,16 @@ #include #include +// VxWorks doesn't correctly set the _POSIX_... options +#if defined(Q_OS_VXWORKS) +# if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK <= 0) +# undef _POSIX_MONOTONIC_CLOCK +# define _POSIX_MONOTONIC_CLOCK 1 +# endif +# include +# include +#endif + #if (_POSIX_MONOTONIC_CLOCK-0 <= 0) || defined(QT_BOOTSTRAPPED) # include #endif @@ -77,7 +87,7 @@ static void signalHandler(int sig) } -#ifdef Q_OS_INTEGRITY +#if defined(Q_OS_INTEGRITY) || defined(Q_OS_VXWORKS) static void initThreadPipeFD(int fd) { int ret = fcntl(fd, F_SETFD, FD_CLOEXEC); @@ -98,20 +108,47 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() { extern Qt::HANDLE qt_application_thread_id; mainThread = (QThread::currentThreadId() == qt_application_thread_id); + bool pipefail = false; // initialize the common parts of the event loop -#ifdef Q_OS_INTEGRITY +#if defined(Q_OS_INTEGRITY) // INTEGRITY doesn't like a "select" on pipes, so use socketpair instead - if (socketpair(AF_INET, SOCK_STREAM, PF_INET, thread_pipe) == -1) + if (socketpair(AF_INET, SOCK_STREAM, PF_INET, thread_pipe) == -1) { perror("QEventDispatcherUNIXPrivate(): Unable to create socket pair"); - - initThreadPipeFD(thread_pipe[0]); - initThreadPipeFD(thread_pipe[1]); + pipefail = true; + } else { + initThreadPipeFD(thread_pipe[0]); + initThreadPipeFD(thread_pipe[1]); + } +#elif defined(Q_OS_VXWORKS) + char name[20]; + qsnprintf(name, sizeof(name), "/pipe/qt_%08x", int(taskIdCurrent)); + + // make sure there is no pipe with this name + pipeDevDelete(name, true); + // create the pipe + if (pipeDevCreate(name, 128 /*maxMsg*/, 1 /*maxLength*/) != OK) { + perror("QEventDispatcherUNIXPrivate(): Unable to create thread pipe device"); + pipefail = true; + } else { + if ((thread_pipe[0] = open(name, O_RDWR, 0)) < 0) { + perror("QEventDispatcherUNIXPrivate(): Unable to create thread pipe"); + pipefail = true; + } else { + initThreadPipeFD(thread_pipe[0]); + thread_pipe[1] = thread_pipe[0]; + } + } #else - if (qt_safe_pipe(thread_pipe, O_NONBLOCK) == -1) + if (qt_safe_pipe(thread_pipe, O_NONBLOCK) == -1) { perror("QEventDispatcherUNIXPrivate(): Unable to create thread pipe"); + pipefail = true; + } #endif + if (pipefail) + qFatal("QEventDispatcherUNIXPrivate(): Can not continue without a thread pipe"); + sn_highest = -1; interrupt = false; @@ -119,9 +156,18 @@ QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate() QEventDispatcherUNIXPrivate::~QEventDispatcherUNIXPrivate() { +#if defined(Q_OS_VXWORKS) + close(thread_pipe[0]); + + char name[20]; + qsnprintf(name, sizeof(name), "/pipe/qt_%08x", int(taskIdCurrent)); + + pipeDevDelete(name, true); +#else // cleanup the common parts of the event loop close(thread_pipe[0]); close(thread_pipe[1]); +#endif // cleanup timers qDeleteAll(timerList); @@ -226,9 +272,15 @@ int QEventDispatcherUNIXPrivate::doSelect(QEventLoop::ProcessEventsFlags flags, // select doesn't immediately return next time int nevents = 0; if (nsel > 0 && FD_ISSET(thread_pipe[0], &sn_vec[0].select_fds)) { +#if defined(Q_OS_VXWORKS) + char c[16]; + ::read(thread_pipe[0], c, sizeof(c)); + ::ioctl(thread_pipe[0], FIOFLUSH, 0); +#else char c[16]; while (::read(thread_pipe[0], c, sizeof(c)) > 0) ; +#endif if (!wakeUps.testAndSetRelease(1, 0)) { // hopefully, this is dead code qWarning("QEventDispatcherUNIX: internal error, wakeUps.testAndSetRelease(1, 0) failed!"); diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h index 61d94c902e..30d566d287 100644 --- a/src/corelib/kernel/qeventdispatcher_unix_p.h +++ b/src/corelib/kernel/qeventdispatcher_unix_p.h @@ -59,9 +59,13 @@ #include "private/qpodlist_p.h" #include -#include -#if !defined(Q_OS_HPUX) || defined(__ia64) -#include +#if defined(Q_OS_VXWORKS) +# include +#else +# include +# if !defined(Q_OS_HPUX) || defined(__ia64) +# include +# endif #endif #include diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h index a7f2f9d9a0..ad44a15f29 100644 --- a/src/corelib/kernel/qfunctions_p.h +++ b/src/corelib/kernel/qfunctions_p.h @@ -57,6 +57,8 @@ #if defined(Q_OS_WINCE) # include "QtCore/qfunctions_wince.h" +#elif defined(Q_OS_VXWORKS) +# include "QtCore/qfunctions_vxworks.h" #endif #ifdef Q_CC_RVCT diff --git a/src/corelib/kernel/qfunctions_vxworks.cpp b/src/corelib/kernel/qfunctions_vxworks.cpp new file mode 100644 index 0000000000..6d5e7ccb7f --- /dev/null +++ b/src/corelib/kernel/qfunctions_vxworks.cpp @@ -0,0 +1,202 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qglobal.h" + +#ifdef Q_OS_VXWORKS + +#include "qplatformdefs.h" +#include "qfunctions_vxworks.h" + +#include +#include +#include + +QT_USE_NAMESPACE + +#ifdef __cplusplus +extern "C" { +#endif + +// no lfind() - used by the TIF image format +void *lfind(const void* key, const void* base, size_t* elements, size_t size, + int (*compare)(const void*, const void*)) +{ + const char* current = (char*) base; + const char* const end = (char*) (current + (*elements) * size); + while (current != end) { + if (compare(current, key) == 0) + return (void*)current; + current += size; + } + return 0; +} + + +// no rand_r(), but rand() +// NOTE: this implementation is wrong for multi threaded applications, +// but there is no way to get it right on VxWorks (in kernel mode) +int rand_r(unsigned int * /*seedp*/) +{ + return rand(); +} + +// no usleep() support +int usleep(unsigned int usec) +{ + div_t dt = div(usec, 1000000); + struct timespec ts = { dt.quot, dt.rem * 1000 }; + + return nanosleep(&ts, 0); +} + + +// gettimeofday() is declared, but is missing from the library +// It IS however defined in the Curtis-Wright X11 libraries, so +// we have to make the symbol 'weak' +#if defined(Q_CC_DIAB) +# pragma weak gettimeofday +#endif +int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) +{ + // the compiler will optimize this and will only use one code path + if (sizeof(struct timeval) == sizeof(struct timespec)) { + int res = clock_gettime(CLOCK_REALTIME, (struct timespec *) tv); + if (!res) + tv->tv_usec /= 1000; + return res; + } else { + struct timespec ts; + + int res = clock_gettime(CLOCK_REALTIME, &ts); + if (!res) { + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; + } + return res; + } +} + +// neither getpagesize() or sysconf(_SC_PAGESIZE) are available +int getpagesize() +{ + return vmPageSizeGet(); +} + +// symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h) +int symlink(const char *, const char *) +{ + errno = EIO; + return -1; +} + +ssize_t readlink(const char *, char *, size_t) +{ + errno = EIO; + return -1; +} + +// there's no truncate(), but ftruncate() support... +int truncate(const char *path, off_t length) +{ + int fd = open(path, O_WRONLY, 00777); + if (fd >= 0) { + int res = ftruncate(fd, length); + int en = errno; + close(fd); + errno = en; + return res; + } + // errno is already set by open + return -1; +} + + + +// VxWorks doesn't know about passwd & friends. +// in order to avoid patching the unix fs path everywhere +// we introduce some dummy functions that simulate a single +// 'root' user on the system. + +uid_t getuid() +{ + return 0; +} + +gid_t getgid() +{ + return 0; +} + +uid_t geteuid() +{ + return 0; +} + +struct passwd *getpwuid(uid_t uid) +{ + static struct passwd pwbuf = { "root", 0, 0, 0, 0, 0, 0 }; + + if (uid == 0) { + return &pwbuf; + } else { + errno = ENOENT; + return 0; + } +} + +struct group *getgrgid(gid_t gid) +{ + static struct group grbuf = { "root", 0, 0, 0 }; + + if (gid == 0) { + return &grbuf; + } else { + errno = ENOENT; + return 0; + } +} + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // Q_OS_VXWORKS diff --git a/src/corelib/kernel/qfunctions_vxworks.h b/src/corelib/kernel/qfunctions_vxworks.h new file mode 100644 index 0000000000..cc989488b8 --- /dev/null +++ b/src/corelib/kernel/qfunctions_vxworks.h @@ -0,0 +1,153 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFUNCTIONS_VXWORKS_H +#define QFUNCTIONS_VXWORKS_H +#ifdef Q_OS_VXWORKS + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef QT_NO_IPV6IFNAME +#include +#endif + +QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + +#ifdef QT_BUILD_CORE_LIB +QT_MODULE(Core) +#endif + +QT_END_NAMESPACE +QT_END_HEADER + + +#ifndef RTLD_LOCAL +#define RTLD_LOCAL 0 +#endif + +#ifndef NSIG +#define NSIG _NSIGS +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +// isascii is missing (sometimes!!) +#ifndef isascii +inline int isascii(int c) { return (c & 0x7f); } +#endif + +// no lfind() - used by the TIF image format +void *lfind(const void* key, const void* base, size_t* elements, size_t size, + int (*compare)(const void*, const void*)); + +// no rand_r(), but rand() +// NOTE: this implementation is wrong for multi threaded applications, +// but there is no way to get it right on VxWorks (in kernel mode) +int rand_r(unsigned int * /*seedp*/); + +// no usleep() support +int usleep(unsigned int); + +// gettimeofday() is declared, but is missing from the library. +// It IS however defined in the Curtis-Wright X11 libraries, so +// we have to make the symbol 'weak' +int gettimeofday(struct timeval *tv, void /*struct timezone*/ *) __attribute__((weak)); + +// neither getpagesize() or sysconf(_SC_PAGESIZE) are available +int getpagesize(); + +// symlinks are not supported (lstat is now just a call to stat - see qplatformdefs.h) +int symlink(const char *, const char *); +ssize_t readlink(const char *, char *, size_t); + +// there's no truncate(), but ftruncate() support... +int truncate(const char *path, off_t length); + +// VxWorks doesn't know about passwd & friends. +// in order to avoid patching the unix fs path everywhere +// we introduce some dummy functions that simulate a single +// 'root' user on the system. + +uid_t getuid(); +gid_t getgid(); +uid_t geteuid(); + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* user password */ + uid_t pw_uid; /* user ID */ + gid_t pw_gid; /* group ID */ + char *pw_gecos; /* real name */ + char *pw_dir; /* home directory */ + char *pw_shell; /* shell program */ +}; + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group ID */ + char **gr_mem; /* group members */ +}; + +struct passwd *getpwuid(uid_t uid); +struct group *getgrgid(gid_t gid); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // Q_OS_VXWORKS +#endif // QFUNCTIONS_VXWORKS_H diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 6b9e1ad7f0..cc70589f8a 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE -#if !defined(QT_HPUX_LD) +#if !defined(QT_HPUX_LD) && !defined(Q_OS_VXWORKS) QT_BEGIN_INCLUDE_NAMESPACE #include QT_END_INCLUDE_NAMESPACE @@ -66,7 +66,9 @@ QT_END_INCLUDE_NAMESPACE static QString qdlerror() { -#if !defined(QT_HPUX_LD) +#if defined(Q_OS_VXWORKS) + const char *err = "VxWorks does not support dynamic libraries."; +#elif !defined(QT_HPUX_LD) const char *err = dlerror(); #else const char *err = strerror(errno); @@ -76,6 +78,8 @@ static QString qdlerror() bool QLibraryPrivate::load_sys() { + QString attempt; +#if !defined(Q_OS_VXWORKS) QFileInfo fi(fileName); QString path = fi.path(); QString name = fi.fileName(); @@ -163,7 +167,6 @@ bool QLibraryPrivate::load_sys() } #endif #endif // QT_HPUX_LD - QString attempt; bool retry = true; for(int prefix = 0; retry && !pHnd && prefix < prefixes.size(); prefix++) { for(int suffix = 0; retry && !pHnd && suffix < suffixes.size(); suffix++) { @@ -204,7 +207,8 @@ bool QLibraryPrivate::load_sys() attempt = str; } } -# endif +#endif +#endif // Q_OS_VXWORKS if (!pHnd) { errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName).arg(qdlerror()); } @@ -217,14 +221,16 @@ bool QLibraryPrivate::load_sys() bool QLibraryPrivate::unload_sys() { -#if defined(QT_HPUX_LD) +#if !defined(Q_OS_VXWORKS) +# if defined(QT_HPUX_LD) if (shl_unload((shl_t)pHnd)) { -#else +# else if (dlclose(pHnd)) { -#endif +# endif errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName).arg(qdlerror()); return false; } +#endif errorString.clear(); return true; } @@ -249,6 +255,8 @@ void* QLibraryPrivate::resolve_sys(const char* symbol) void* address = 0; if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0) address = 0; +#elif defined(Q_OS_VXWORKS) + void *address = 0; #else void* address = dlsym(pHnd, symbol); #endif diff --git a/src/corelib/thread/qmutex_unix.cpp b/src/corelib/thread/qmutex_unix.cpp index 43ba668486..02c7c6f919 100644 --- a/src/corelib/thread/qmutex_unix.cpp +++ b/src/corelib/thread/qmutex_unix.cpp @@ -49,6 +49,10 @@ #include +#if defined(Q_OS_VXWORKS) && defined(wakeup) +#undef wakeup +#endif + QT_BEGIN_NAMESPACE static void report_error(int code, const char *where, const char *what) diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 19b5104973..efe37ad45b 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -61,6 +61,13 @@ #ifdef Q_OS_BSD4 #include #endif +#ifdef Q_OS_VXWORKS +# if (_WRS_VXWORKS_MAJOR > 6) || ((_WRS_VXWORKS_MAJOR == 6) && (_WRS_VXWORKS_MINOR >= 6)) +# include +# include +# define QT_VXWORKS_HAS_CPUSET +# endif +#endif #if defined(Q_OS_MAC) # ifdef qDebug @@ -85,6 +92,13 @@ static pthread_key_t current_thread_data_key; static void destroy_current_thread_data(void *p) { +#if defined(Q_OS_VXWORKS) + // Calling setspecific(..., 0) sets the value to 0 for ALL threads. + // The 'set to 1' workaround adds a bit of an overhead though, + // since this function is called twice now. + if (p == (void *)1) + return; +#endif // POSIX says the value in our key is set to zero before calling // this destructor function, so we need to set it back to the // right value... @@ -93,7 +107,12 @@ static void destroy_current_thread_data(void *p) // ... but we must reset it to zero before returning so we aren't // called again (POSIX allows implementations to call destructor // functions repeatedly until all values are zero) - pthread_setspecific(current_thread_data_key, 0); + pthread_setspecific(current_thread_data_key, +#if defined(Q_OS_VXWORKS) + (void *)1); +#else + 0); +#endif } static void create_current_thread_data_key() @@ -267,7 +286,25 @@ int QThread::idealThreadCount() // IRIX cores = (int)sysconf(_SC_NPROC_ONLN); #elif defined(Q_OS_INTEGRITY) - // ### TODO - how to get the amound of CPUs on INTEGRITY? + // as of aug 2008 Integrity only supports one single core CPU + cores = 1; +#elif defined(Q_OS_VXWORKS) + // VxWorks +# if defined(QT_VXWORKS_HAS_CPUSET) + cpuset_t cpus = vxCpuEnabledGet(); + cores = 0; + + // 128 cores should be enough for everyone ;) + for (int i = 0; i < 128 && !CPUSET_ISZERO(cpus); ++i) { + if (CPUSET_ISSET(cpus, i)) { + CPUSET_CLR(cpus, i); + cores++; + } + } +# else + // as of aug 2008 VxWorks < 6.6 only supports one single core CPU + cores = 1; +# endif #else // the rest: Linux, Solaris, AIX, Tru64 cores = (int)sysconf(_SC_NPROCESSORS_ONLN); diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 85e49c734a..8608fe4067 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -2640,6 +2640,8 @@ static QString timeZone() # else return QString::fromLocal8Bit(_tzname[1]); # endif +#elif defined(Q_OS_VXWORKS) + return QString(); #else tzset(); return QString::fromLocal8Bit(tzname[1]); @@ -4938,6 +4940,9 @@ static inline void Storeinc(ULong *&a, const ULong &b, const ULong &c) #define Bletch 0x10 #define Bndry_mask 0xfffff #define Bndry_mask1 0xfffff +#if defined(LSB) && defined(Q_OS_VXWORKS) +#undef LSB +#endif #define LSB 1 #define Sign_bit 0x80000000 #define Log2P 1 diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp index 3527308211..c1d48ec72e 100644 --- a/src/corelib/tools/qregexp.cpp +++ b/src/corelib/tools/qregexp.cpp @@ -688,6 +688,10 @@ int qFindString(const QChar *haystack, int haystackLen, int from, {tools/regexp}{Regular Expression Example} */ +#if defined(Q_OS_VXWORKS) && defined(EOS) +# undef EOS +#endif + const int NumBadChars = 64; #define BadChar(ch) ((ch).unicode() % NumBadChars) diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri index 08c94ac2be..44fbb62a9a 100644 --- a/src/corelib/tools/tools.pri +++ b/src/corelib/tools/tools.pri @@ -109,4 +109,4 @@ SOURCES += ../3rdparty/harfbuzz/src/harfbuzz-buffer.c \ tools/qharfbuzz.cpp HEADERS += tools/qharfbuzz_p.h -!macx-icc:unix:LIBS += -lm +!macx-icc:!vxworks:unix:LIBS += -lm diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index f1614ea457..7a4d2a8f95 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -54,6 +54,10 @@ #ifndef QXMLSTREAM_P_H #define QXMLSTREAM_P_H +#if defined(Q_OS_VXWORKS) && defined(ERROR) +# undef ERROR +#endif + class QXmlStreamReader_Table { public: diff --git a/src/gui/dialogs/qfileinfogatherer.cpp b/src/gui/dialogs/qfileinfogatherer.cpp index 887eb71620..467822cbf4 100644 --- a/src/gui/dialogs/qfileinfogatherer.cpp +++ b/src/gui/dialogs/qfileinfogatherer.cpp @@ -44,8 +44,11 @@ #include #include #ifndef Q_OS_WIN -#include -#include +# include +# include +#endif +#if defined(Q_OS_VXWORKS) +# include "qplatformdefs.h" #endif QT_BEGIN_NAMESPACE diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri index 53a2512937..07d1dcc036 100644 --- a/src/gui/embedded/embedded.pri +++ b/src/gui/embedded/embedded.pri @@ -119,6 +119,7 @@ embedded { SOURCES += embedded/qscreenvfb_qws.cpp } + contains( gfx-drivers, vnc ) { VNCDIR = $$QT_SOURCE_TREE/src/plugins/gfxdrivers/vnc INCLUDEPATH += $$VNCDIR diff --git a/src/gui/inputmethod/qinputcontextplugin.h b/src/gui/inputmethod/qinputcontextplugin.h index 8ab8f84162..c0c127b92d 100644 --- a/src/gui/inputmethod/qinputcontextplugin.h +++ b/src/gui/inputmethod/qinputcontextplugin.h @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#if !defined(QT_NO_IM) && !defined(QT_NO_LIBRARY) +#if !defined(QT_NO_IM) class QInputContext; class QInputContextPluginPrivate; diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/gui/inputmethod/qximinputcontext_x11.cpp index 9b211631ac..074b189639 100644 --- a/src/gui/inputmethod/qximinputcontext_x11.cpp +++ b/src/gui/inputmethod/qximinputcontext_x11.cpp @@ -53,6 +53,7 @@ ** ****************************************************************************/ +#include "qplatformdefs.h" #include "qdebug.h" #include "qximinputcontext_p.h" diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 3453408f20..5181689b2d 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include "qplatformdefs.h" #include "qabstracteventdispatcher.h" #include "qaccessible.h" #include "qapplication.h" diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 347afc8fce..6deeaf4626 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -101,7 +101,11 @@ #include #include #include -#include +#ifdef Q_OS_VXWORKS +# include +#else +# include +#endif #include #include @@ -208,7 +212,7 @@ QString qws_dataDir() if (!S_ISDIR(buf.st_mode)) qFatal("%s is not a directory", dataDir.constData()); -#ifndef Q_OS_INTEGRITY +#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) if (buf.st_uid != getuid()) qFatal("Qt for Embedded Linux data directory is not owned by user %d", getuid()); diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h index 1c8394bc45..1ac51e01d7 100644 --- a/src/gui/kernel/qt_x11_p.h +++ b/src/gui/kernel/qt_x11_p.h @@ -74,11 +74,19 @@ #include #include #ifdef index -# undef index +# undef index #endif #ifdef rindex -# undef rindex +# undef rindex #endif +#ifdef Q_OS_VXWORS +# ifdef open +# undef open +# endif +# ifdef getpid +# undef getpid +# endif +#endif // Q_OS_VXWORKS #include //#define QT_NO_SHAPE diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp index 659331fb6a..359434e026 100644 --- a/src/gui/kernel/qx11embed_x11.cpp +++ b/src/gui/kernel/qx11embed_x11.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include "qplatformdefs.h" #include "qx11embed_x11.h" #include #include diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 34bc578201..01c6159929 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -39,6 +39,9 @@ ** ****************************************************************************/ + +#include "qplatformdefs.h" + #include "qbackingstore_p.h" #include diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 6dbb94b41c..13b5eba1c7 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -51,6 +51,15 @@ #include #include +#if defined(Q_OS_VXWORKS) +# if defined(m_data) +# undef m_data +# endif +# if defined(m_type) +# undef m_type +# endif +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 7a9eda354b..c41b040e0c 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -134,7 +134,9 @@ #define ErrRaster_MemoryOverflow -4 - +#if defined(VXWORKS) +# include /* needed for setjmp.h */ +#endif #include /* for qt_ft_memcpy() */ #include #include diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 6968f4e17c..a34c3546c6 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -60,6 +60,10 @@ #include +#if defined(Q_OS_VXWORKS) && defined(m_type) +# undef m_type +#endif + struct glyph_metrics_t; typedef unsigned int glyph_t; diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 291d35c734..69d4de2183 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -50,6 +50,10 @@ #include #include +#if defined(Q_OS_VXWORKS) && defined(m_type) +# undef m_type +#endif + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index b07acd5d28..9f046ff6bd 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -67,6 +67,11 @@ #ifndef QT_NO_CSSPARSER +// VxWorks defines NONE as (-1) "for times when NULL won't do" +#if defined(Q_OS_VXWORKS) && defined(NONE) +# undef NONE +#endif + QT_BEGIN_NAMESPACE namespace QCss diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp index 70ce8f9372..10bee2c946 100644 --- a/src/gui/text/qfontengine_qws.cpp +++ b/src/gui/text/qfontengine_qws.cpp @@ -396,7 +396,7 @@ QFontEngineQPF1::QFontEngineQPF1(const QFontDef&, const QString &fn) uchar* data = (uchar*)mmap( 0, // any address st.st_size, // whole file PROT_READ, // read-only memory -#if !defined(Q_OS_SOLARIS) && !defined(Q_OS_QNX4) && !defined(Q_OS_INTEGRITY) +#if !defined(Q_OS_SOLARIS) && !defined(Q_OS_QNX4) && !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) MAP_FILE | MAP_PRIVATE, // swap-backed map from file #else MAP_PRIVATE, diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index ea37e044c0..e66b07c8a4 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -60,6 +60,15 @@ QT_BEGIN_NAMESPACE #define PMDEBUG if(0) qDebug +// The VxWorks DIAB compiler crashes when initializing the anonymouse union with { a7 } +#if !defined(Q_CC_DIAB) +# define QT_INIT_TEXTUNDOCOMMAND(c, a1, a2, a3, a4, a5, a6, a7, a8) \ + QTextUndoCommand c = { a1, a2, a3, a4, a5, a6, { a7 }, a8 } +#else +# define QT_INIT_TEXTUNDOCOMMAND(c, a1, a2, a3, a4, a5, a6, a7, a8) \ + QTextUndoCommand c = { a1, a2, a3, a4, a5, a6 }; c.blockFormat = a7; c.revision = a8 +#endif + /* Structure of a document: @@ -406,9 +415,9 @@ int QTextDocumentPrivate::insertBlock(const QChar &blockSeparator, int b = blocks.findNode(pos); QTextBlockData *B = blocks.fragment(b); - QTextUndoCommand c = { QTextUndoCommand::BlockInserted, editBlock != 0, - op, charFormat, strPos, pos, { blockFormat }, - B->revision }; + QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::BlockInserted, editBlock != 0, + op, charFormat, strPos, pos, blockFormat, + B->revision); appendUndoItem(c); Q_ASSERT(undoState == undoStack.size()); @@ -447,9 +456,9 @@ void QTextDocumentPrivate::insert(int pos, int strPos, int strLength, int format int b = blocks.findNode(pos); QTextBlockData *B = blocks.fragment(b); - QTextUndoCommand c = { QTextUndoCommand::Inserted, editBlock != 0, - QTextUndoCommand::MoveCursor, format, strPos, pos, { strLength }, - B->revision }; + QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::Inserted, editBlock != 0, + QTextUndoCommand::MoveCursor, format, strPos, pos, strLength, + B->revision); appendUndoItem(c); B->revision = undoState; Q_ASSERT(undoState == undoStack.size()); @@ -606,12 +615,12 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O int blockRevision = B->revision; QTextFragmentData *X = fragments.fragment(x); - QTextUndoCommand c = { QTextUndoCommand::Removed, editBlock != 0, - op, X->format, X->stringPosition, key, { X->size_array[0] }, - blockRevision }; - QTextUndoCommand cInsert = { QTextUndoCommand::Inserted, editBlock != 0, - op, X->format, X->stringPosition, dstKey, { X->size_array[0] }, - blockRevision }; + QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::Removed, editBlock != 0, + op, X->format, X->stringPosition, key, X->size_array[0], + blockRevision); + QT_INIT_TEXTUNDOCOMMAND(cInsert, QTextUndoCommand::Inserted, editBlock != 0, + op, X->format, X->stringPosition, dstKey, X->size_array[0], + blockRevision); if (key+1 != blocks.position(b)) { // qDebug("remove_string from %d length %d", key, X->size_array[0]); @@ -723,8 +732,8 @@ void QTextDocumentPrivate::setCharFormat(int pos, int length, const QTextCharFor fragment->format = newFormatIdx; } - QTextUndoCommand c = { QTextUndoCommand::CharFormatChanged, true, QTextUndoCommand::MoveCursor, oldFormat, - 0, pos, { length }, 0 }; + QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::CharFormatChanged, true, QTextUndoCommand::MoveCursor, oldFormat, + 0, pos, length, 0); appendUndoItem(c); pos += length; @@ -783,8 +792,8 @@ void QTextDocumentPrivate::setBlockFormat(const QTextBlock &from, const QTextBlo block(it)->invalidate(); - QTextUndoCommand c = { QTextUndoCommand::BlockFormatChanged, true, QTextUndoCommand::MoveCursor, oldFormat, - 0, it.position(), { 1 }, 0 }; + QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::BlockFormatChanged, true, QTextUndoCommand::MoveCursor, oldFormat, + 0, it.position(), 1, 0); appendUndoItem(c); if (group != oldGroup) { @@ -1298,8 +1307,8 @@ void QTextDocumentPrivate::changeObjectFormat(QTextObject *obj, int format) if (f) documentChange(f->firstPosition(), f->lastPosition() - f->firstPosition()); - QTextUndoCommand c = { QTextUndoCommand::GroupFormatChange, editBlock != 0, QTextUndoCommand::MoveCursor, oldFormatIndex, - 0, 0, { obj->d_func()->objectIndex }, 0 }; + QT_INIT_TEXTUNDOCOMMAND(c, QTextUndoCommand::GroupFormatChange, editBlock != 0, QTextUndoCommand::MoveCursor, oldFormatIndex, + 0, 0, obj->d_func()->objectIndex, 0); appendUndoItem(c); endEditBlock(); diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index a940aa4c37..cb09452fd1 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -54,7 +54,11 @@ QT_BEGIN_NAMESPACE QTextCopyHelper::QTextCopyHelper(const QTextCursor &_source, const QTextCursor &_destination, bool forceCharFormat, const QTextCharFormat &fmt) +#if defined(Q_CC_DIAB) // compiler bug + : formatCollection(*_destination.d->priv->formatCollection()), originalText((const QString)_source.d->priv->buffer()) +#else : formatCollection(*_destination.d->priv->formatCollection()), originalText(_source.d->priv->buffer()) +#endif { src = _source.d->priv; dst = _destination.d->priv; diff --git a/src/gui/util/qdesktopservices_x11.cpp b/src/gui/util/qdesktopservices_x11.cpp index f0202d4a65..0a3c2d0757 100644 --- a/src/gui/util/qdesktopservices_x11.cpp +++ b/src/gui/util/qdesktopservices_x11.cpp @@ -56,7 +56,11 @@ QT_BEGIN_NAMESPACE inline static bool launch(const QUrl &url, const QString &client) { +#if !defined(QT_NO_PROCESS) return (QProcess::startDetached(client + QLatin1Char(' ') + QString::fromLatin1(url.toEncoded().constData()))); +#else + return (::system((client + QLatin1Char(' ') + QString::fromLatin1(url.toEncoded().constData())).toLocal8Bit().constData()) != -1); +#endif } static bool openDocument(const QUrl &url) diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp index fef488b29c..64e9e29c42 100644 --- a/src/network/kernel/qhostinfo_unix.cpp +++ b/src/network/kernel/qhostinfo_unix.cpp @@ -57,7 +57,11 @@ static const int RESOLVER_TIMEOUT = 2000; #include #include #include -#include +#if defined(Q_OS_VXWORKS) +# include +#else +# include +#endif #if defined (QT_NO_GETADDRINFO) #include @@ -275,10 +279,12 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName) results.setError(QHostInfo::UnknownError); results.setErrorString(tr("Unknown address type")); } +#if !defined(Q_OS_VXWORKS) } else if (h_errno == HOST_NOT_FOUND || h_errno == NO_DATA || h_errno == NO_ADDRESS) { results.setError(QHostInfo::HostNotFound); results.setErrorString(tr("Host not found")); +#endif } else { results.setError(QHostInfo::UnknownError); results.setErrorString(tr("Unknown error")); @@ -315,6 +321,7 @@ QString QHostInfo::localHostName() QString QHostInfo::localDomainName() { +#if !defined(Q_OS_VXWORKS) resolveLibrary(); if (local_res_ninit) { // using thread-safe version @@ -344,7 +351,7 @@ QString QHostInfo::localDomainName() domainName = QUrl::fromAce(local_res->dnsrch[0]); return domainName; } - +#endif // nothing worked, try doing it by ourselves: QFile resolvconf; #if defined(_PATH_RESCONF) diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp index c2e05cdfdd..3df6b6aa4a 100644 --- a/src/network/socket/qlocalserver_unix.cpp +++ b/src/network/socket/qlocalserver_unix.cpp @@ -54,6 +54,10 @@ #include #include +#ifdef Q_OS_VXWORKS +# include +#endif + QT_BEGIN_NAMESPACE void QLocalServerPrivate::init() diff --git a/src/network/socket/qlocalsocket_unix.cpp b/src/network/socket/qlocalsocket_unix.cpp index d038794e2b..08d94efa55 100644 --- a/src/network/socket/qlocalsocket_unix.cpp +++ b/src/network/socket/qlocalsocket_unix.cpp @@ -56,6 +56,10 @@ #include #include +#ifdef Q_OS_VXWORKS +# include +#endif + #define QT_CONNECT_TIMEOUT 30000 QT_BEGIN_NAMESPACE diff --git a/src/network/socket/qnativesocketengine_p.h b/src/network/socket/qnativesocketengine_p.h index a9479d31db..24dc344484 100644 --- a/src/network/socket/qnativesocketengine_p.h +++ b/src/network/socket/qnativesocketengine_p.h @@ -56,9 +56,9 @@ #include "QtNetwork/qhostaddress.h" #include "private/qabstractsocketengine_p.h" #ifndef Q_OS_WIN -# include "qplatformdefs.h" +# include "qplatformdefs.h" #else -# include +# include #endif QT_BEGIN_NAMESPACE diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index b4b673a4ec..6f9ee1afb0 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -237,7 +237,7 @@ int QNativeSocketEnginePrivate::option(QNativeSocketEngine::SocketOption opt) co int v = -1; QT_SOCKOPTLEN_T len = sizeof(v); - if (getsockopt(socketDescriptor, level, n, (char *) &v, &len) != -1) + if (::getsockopt(socketDescriptor, level, n, (char *) &v, &len) != -1) return v; return -1; } @@ -267,6 +267,7 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt break; case QNativeSocketEngine::NonBlockingSocketOption: { // Make the socket nonblocking. +#if !defined(Q_OS_VXWORKS) int flags = ::fcntl(socketDescriptor, F_GETFL, 0); if (flags == -1) { #ifdef QNATIVESOCKETENGINE_DEBUG @@ -280,7 +281,15 @@ bool QNativeSocketEnginePrivate::setOption(QNativeSocketEngine::SocketOption opt #endif return false; } - +#else // Q_OS_VXWORKS + int onoff = 1; + if (qt_safe_ioctl(socketDescriptor, FIONBIO, &onoff) < 0) { +#ifdef QNATIVESOCKETENGINE_DEBUG + perror("QNativeSocketEnginePrivate::setOption(): ioctl(FIONBIO, 1) failed"); +#endif + return false; + } +#endif // Q_OS_VXWORKS return true; } case QNativeSocketEngine::AddressReusable: @@ -652,11 +661,8 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l // ignore the SIGPIPE signal qt_ignore_sigpipe(); - ssize_t sentBytes; - do { - sentBytes = qt_safe_sendto(socketDescriptor, data, len, - 0, sockAddrPtr, sockAddrSize); - } while (sentBytes == -1 && errno == EINTR); + ssize_t sentBytes = qt_safe_sendto(socketDescriptor, data, len, + 0, sockAddrPtr, sockAddrSize); if (sentBytes < 0) { switch (errno) { @@ -722,7 +728,7 @@ bool QNativeSocketEnginePrivate::fetchConnectionParameters() // Determine the socket type (UDP/TCP) int value = 0; QT_SOCKOPTLEN_T valueSize = sizeof(int); - if (::getsockopt(socketDescriptor, SOL_SOCKET, SO_TYPE, &value, &valueSize) == 0) { + if (::getsockopt(socketDescriptor, SOL_SOCKET, SO_TYPE, (char *) &value, &valueSize) == 0) { if (value == SOCK_STREAM) socketType = QAbstractSocket::TcpSocket; else if (value == SOCK_DGRAM) @@ -767,7 +773,7 @@ qint64 QNativeSocketEnginePrivate::nativeWrite(const char *data, qint64 len) // of an interrupting signal. ssize_t writtenBytes; do { - writtenBytes = ::write(socketDescriptor, data, len); + writtenBytes = QT_WRITE(socketDescriptor, data, len); } while (writtenBytes < 0 && errno == EINTR); if (writtenBytes < 0) { @@ -828,6 +834,9 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize) setError(QAbstractSocket::NetworkError, ReadErrorString); break; case ECONNRESET: +#if defined(Q_OS_VXWORKS) + case ESHUTDOWN: +#endif r = 0; break; default: diff --git a/src/network/socket/qnet_unix_p.h b/src/network/socket/qnet_unix_p.h index 03ed3b4c96..f38c2fcfa4 100644 --- a/src/network/socket/qnet_unix_p.h +++ b/src/network/socket/qnet_unix_p.h @@ -59,11 +59,18 @@ #include #include +#if defined(Q_OS_VXWORKS) +# include +#endif + // for inet_addr #include #include -#include - +#if defined(Q_OS_VXWORKS) +# include +#else +# include +#endif QT_BEGIN_NAMESPACE @@ -155,17 +162,28 @@ static inline int qt_safe_connect(int sockfd, const struct sockaddr *addr, QT_SO # undef listen #endif +// VxWorks' headers specify 'int' instead of '...' for the 3rd ioctl() parameter. template static inline int qt_safe_ioctl(int sockfd, int request, T arg) { +#ifdef Q_OS_VXWORKS + return ::ioctl(sockfd, request, (int) arg); +#else return ::ioctl(sockfd, request, arg); +#endif } +// VxWorks' headers do not specify any const modifiers static inline in_addr_t qt_safe_inet_addr(const char *cp) { +#ifdef Q_OS_VXWORKS + return ::inet_addr((char *) cp); +#else return ::inet_addr(cp); +#endif } +// VxWorks' headers do not specify any const modifiers static inline int qt_safe_sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *to, QT_SOCKLEN_T tolen) { #ifdef MSG_NOSIGNAL @@ -173,7 +191,11 @@ static inline int qt_safe_sendto(int sockfd, const void *buf, size_t len, int fl #endif register int ret; +#ifdef Q_OS_VXWORKS + EINTR_LOOP(ret, ::sendto(sockfd, (char *) buf, len, flags, (struct sockaddr *) to, tolen)); +#else EINTR_LOOP(ret, ::sendto(sockfd, buf, len, flags, to, tolen)); +#endif return ret; } diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 6381bc2152..cf70991e28 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -66,6 +66,14 @@ #include #include #include +#ifdef Q_OS_VXWORS +# ifdef open +# undef open +# endif +# ifdef getpid +# undef getpid +# endif +#endif // Q_OS_VXWORKS #include #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) @@ -823,10 +831,12 @@ void QGLContext::swapBuffers() const if (!glXGetVideoSyncSGI) #endif { +#if !defined(QT_NO_LIBRARY) extern const QString qt_gl_library_name(); QLibrary lib(qt_gl_library_name()); glXGetVideoSyncSGI = (qt_glXGetVideoSyncSGI) lib.resolve("glXGetVideoSyncSGI"); glXWaitVideoSyncSGI = (qt_glXWaitVideoSyncSGI) lib.resolve("glXWaitVideoSyncSGI"); +#endif } } resolved = true; @@ -1067,9 +1077,11 @@ void *QGLContext::getProcAddress(const QString &proc) const if (!glXGetProcAddressARB) #endif { +#if !defined(QT_NO_LIBRARY) extern const QString qt_gl_library_name(); QLibrary lib(qt_gl_library_name()); glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); +#endif } } resolved = true; diff --git a/src/opengl/qglpixelbuffer_x11.cpp b/src/opengl/qglpixelbuffer_x11.cpp index 9e1f85d328..ac2e705d26 100644 --- a/src/opengl/qglpixelbuffer_x11.cpp +++ b/src/opengl/qglpixelbuffer_x11.cpp @@ -115,6 +115,7 @@ static bool qt_resolve_pbuffer_extensions() if (!qt_glXChooseFBConfig) #endif { +#if !defined(QT_NO_LIBRARY) extern const QString qt_gl_library_name(); QLibrary gl(qt_gl_library_name()); qt_glXChooseFBConfig = (_glXChooseFBConfig) gl.resolve("glXChooseFBConfig"); @@ -123,6 +124,7 @@ static bool qt_resolve_pbuffer_extensions() qt_glXDestroyPbuffer = (_glXDestroyPbuffer) gl.resolve("glXDestroyPbuffer"); qt_glXGetFBConfigAttrib = (_glXGetFBConfigAttrib) gl.resolve("glXGetFBConfigAttrib"); qt_glXMakeContextCurrent = (_glXMakeContextCurrent) gl.resolve("glXMakeContextCurrent"); +#endif } resolved = qt_glXMakeContextCurrent ? true : false; diff --git a/src/script/qscriptbuffer_p.h b/src/script/qscriptbuffer_p.h index 9db32a869c..4b829ee24c 100644 --- a/src/script/qscriptbuffer_p.h +++ b/src/script/qscriptbuffer_p.h @@ -44,6 +44,11 @@ #include +#if defined(Q_OS_VXWORKS) && defined(m_data) +# undef m_data +#endif + + QT_BEGIN_NAMESPACE // diff --git a/src/script/qscriptclassinfo_p.h b/src/script/qscriptclassinfo_p.h index fb40d15ea3..8f4d4fee81 100644 --- a/src/script/qscriptclassinfo_p.h +++ b/src/script/qscriptclassinfo_p.h @@ -53,6 +53,10 @@ // We mean it. // +#if defined(Q_OS_VXWORKS) && defined(m_type) +# undef m_type +#endif + #include "qscriptclassdata_p.h" #ifndef QT_NO_SCRIPT diff --git a/src/script/qscriptecmadate.cpp b/src/script/qscriptecmadate.cpp index 9b5372429b..8c91a25376 100644 --- a/src/script/qscriptecmadate.cpp +++ b/src/script/qscriptecmadate.cpp @@ -58,10 +58,14 @@ #include #ifndef Q_WS_WIN -# include -# include +# include +# ifndef Q_OS_VXWORKS +# include +# else +# include "qplatformdefs.h" +# endif #else -# include +# include #endif QT_BEGIN_NAMESPACE diff --git a/src/script/qscriptgc_p.h b/src/script/qscriptgc_p.h index 313519ab44..769e136b9b 100644 --- a/src/script/qscriptgc_p.h +++ b/src/script/qscriptgc_p.h @@ -53,6 +53,10 @@ // We mean it. // +#if defined(Q_OS_VXWORKS) && defined(m_free) +# undef m_free +#endif + #include #ifndef QT_NO_SCRIPT diff --git a/src/script/qscriptmemberfwd_p.h b/src/script/qscriptmemberfwd_p.h index 056876b9ae..6c12feff10 100644 --- a/src/script/qscriptmemberfwd_p.h +++ b/src/script/qscriptmemberfwd_p.h @@ -53,6 +53,10 @@ // We mean it. // +#if defined(Q_OS_VXWORKS) && defined(m_flags) +# undef m_flags +#endif + #include QT_BEGIN_NAMESPACE diff --git a/src/script/qscriptsyntaxcheckresult_p.h b/src/script/qscriptsyntaxcheckresult_p.h index d6049f8fcd..9b51f7deeb 100644 --- a/src/script/qscriptsyntaxcheckresult_p.h +++ b/src/script/qscriptsyntaxcheckresult_p.h @@ -53,6 +53,10 @@ // We mean it. // +#if defined(Q_OS_VXWORKS) && defined(m_type) +# undef m_type +#endif + #ifndef QT_NO_SCRIPT #include diff --git a/src/script/qscriptvalueimplfwd_p.h b/src/script/qscriptvalueimplfwd_p.h index c30b32a9f5..0953713c36 100644 --- a/src/script/qscriptvalueimplfwd_p.h +++ b/src/script/qscriptvalueimplfwd_p.h @@ -64,6 +64,10 @@ QT_BEGIN_NAMESPACE // We mean it. // +#if defined(Q_OS_VXWORKS) && defined(m_type) +# undef m_type +#endif + class QScriptValueImpl; typedef QList QScriptValueImplList; diff --git a/src/src.pro b/src/src.pro index 9bff20d41e..34db728c45 100644 --- a/src/src.pro +++ b/src/src.pro @@ -7,7 +7,7 @@ wince*:{ SRC_SUBDIRS += src_corelib src_xml src_gui src_sql src_network src_script src_testlib } else { SRC_SUBDIRS += src_tools_bootstrap src_tools_moc src_tools_rcc src_tools_uic src_corelib src_xml src_network src_gui src_sql src_script src_testlib - contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_qt3support + !vxworks:contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_qt3support contains(QT_CONFIG, dbus):SRC_SUBDIRS += src_dbus !cross_compile { contains(QT_CONFIG, qt3support): SRC_SUBDIRS += src_tools_uic3 diff --git a/src/svg/qsvghandler.cpp b/src/svg/qsvghandler.cpp index 5857e1c44f..7a5b000a93 100644 --- a/src/svg/qsvghandler.cpp +++ b/src/svg/qsvghandler.cpp @@ -354,7 +354,7 @@ static qreal toDouble(const QChar *&str) if (neg) val = -val; } else { -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) && !defined(Q_OS_VXWORKS) if(sizeof(qreal) == sizeof(float)) val = strtof(temp, 0); else diff --git a/src/xmlpatterns/parser/qquerytransformparser_p.h b/src/xmlpatterns/parser/qquerytransformparser_p.h index bb017882e0..06953d042c 100644 --- a/src/xmlpatterns/parser/qquerytransformparser_p.h +++ b/src/xmlpatterns/parser/qquerytransformparser_p.h @@ -154,6 +154,18 @@ #ifdef SELF # undef SELF #endif +/* These tokens are defined in VxWorks kernel mode + * + * Hence this un-break fix. Note that this file was auto generated. */ +#ifdef ERROR +# undef ERROR +#endif +#ifdef IMPORT +# undef IMPORT +#endif +#ifdef MAP +# undef MAP +#endif /* These tokens are defined to nothing on Windows because they're * used in their documentation parser, for use in things like: diff --git a/src/xmlpatterns/parser/winCEWorkaround.sed b/src/xmlpatterns/parser/winCEWorkaround.sed index d1c09e83e5..46f18aeb7e 100644 --- a/src/xmlpatterns/parser/winCEWorkaround.sed +++ b/src/xmlpatterns/parser/winCEWorkaround.sed @@ -17,4 +17,16 @@ \#ifdef SELF\ \# undef SELF\ \#endif\ +\/\* These tokens are defined in VxWorks kernel mode\ + \*\ + \* Hence this un-break fix. Note that this file was auto generated. *\/\ +\#ifdef ERROR\ +\# undef ERROR\ +\#endif\ +\#ifdef IMPORT\ +\# undef IMPORT\ +\#endif\ +\#ifdef MAP\ +\# undef MAP\ +\#endif\ diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index e5b23ab3f4..e900ed065a 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -51,7 +51,9 @@ #include "../network-settings.h" - +#if defined(Q_OS_VXWORKS) +#define Q_NO_SYMLINKS +#endif //TESTED_CLASS= //TESTED_FILES= @@ -370,6 +372,20 @@ void tst_QDir::compare() QVERIFY(dir == QDir::currentPath()); } +static QStringList filterLinks(const QStringList &list) +{ +#ifndef Q_NO_SYMLINKS + return list; +#else + QStringList result; + foreach (QString str, list) { + if (!str.endsWith(QLatin1String(".lnk"))) + result.append(str); + } + return result; +#endif +} + void tst_QDir::entryList_data() { QTest::addColumn("dirName"); // relative from current path or abs @@ -411,94 +427,95 @@ void tst_QDir::entryList_data() QTest::newRow("nofilter") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::NoFilter) << int(QDir::Name) - << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','); + << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',')); QTest::newRow("QDir::AllEntries") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllEntries) << int(QDir::Name) - << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','); + << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',')); QTest::newRow("QDir::Files") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::Files) << int(QDir::Name) - << QString("file,linktofile.lnk,writable").split(','); + << filterLinks(QString("file,linktofile.lnk,writable").split(',')); QTest::newRow("QDir::Dirs") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::Dirs) << int(QDir::Name) - << QString(".,..,directory,linktodirectory.lnk").split(','); + << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(',')); QTest::newRow("QDir::Dirs | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::Dirs | QDir::NoDotAndDotDot) << int(QDir::Name) - << QString("directory,linktodirectory.lnk").split(','); + << filterLinks(QString("directory,linktodirectory.lnk").split(',')); QTest::newRow("QDir::AllDirs") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllDirs) << int(QDir::Name) - << QString(".,..,directory,linktodirectory.lnk").split(','); + << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(',')); QTest::newRow("QDir::AllDirs | QDir::Dirs") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllDirs | QDir::Dirs) << int(QDir::Name) - << QString(".,..,directory,linktodirectory.lnk").split(','); + << filterLinks(QString(".,..,directory,linktodirectory.lnk").split(',')); QTest::newRow("QDir::AllDirs | QDir::Files") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllDirs | QDir::Files) << int(QDir::Name) - << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','); + << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',')); QTest::newRow("QDir::AllEntries | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllEntries | QDir::NoSymLinks) << int(QDir::Name) - << QString(".,..,directory,file,writable").split(','); + << filterLinks(QString(".,..,directory,file,writable").split(',')); QTest::newRow("QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot) << int(QDir::Name) - << QString("directory,file,writable").split(','); + << filterLinks(QString("directory,file,writable").split(',')); QTest::newRow("QDir::Files | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::Files | QDir::NoSymLinks) << int(QDir::Name) - << QString("file,writable").split(','); + << filterLinks(QString("file,writable").split(',')); QTest::newRow("QDir::Dirs | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::Dirs | QDir::NoSymLinks) << int(QDir::Name) - << QString(".,..,directory").split(','); + << filterLinks(QString(".,..,directory").split(',')); QTest::newRow("QDir::Drives | QDir::Files | QDir::NoDotAndDotDot") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::Drives | QDir::Files | QDir::NoDotAndDotDot) << int(QDir::Name) - << QString("file,linktofile.lnk,writable").split(','); + << filterLinks(QString("file,linktofile.lnk,writable").split(',')); QTest::newRow("QDir::System") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::System) << int(QDir::Name) - << QStringList("brokenlink.lnk"); + << filterLinks(QStringList("brokenlink.lnk")); QTest::newRow("QDir::Hidden") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::Hidden) << int(QDir::Name) << QStringList(); QTest::newRow("QDir::System | QDir::Hidden") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::System | QDir::Hidden) << int(QDir::Name) - << QStringList("brokenlink.lnk"); + << filterLinks(QStringList("brokenlink.lnk")); QTest::newRow("QDir::AllDirs | QDir::NoSymLinks") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllDirs | QDir::NoSymLinks) << int(QDir::Name) - << QString(".,..,directory").split(','); + << filterLinks(QString(".,..,directory").split(',')); #ifdef QT3_SUPPORT QTest::newRow("QDir::All | QDir::Hidden | QDir::System") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::All | QDir::Hidden | QDir::System) << int(QDir::Name) - << QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','); + << filterLinks(QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',')); QTest::newRow("QDir::All | QDir::Readable") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::All | QDir::Readable) << int(QDir::Name) - << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','); + << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',')); QTest::newRow("QDir::All | QDir::Writable") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::All | QDir::Writable) << int(QDir::Name) - << QString(".,..,directory,linktodirectory.lnk,writable").split(','); + << filterLinks(QString(".,..,directory,linktodirectory.lnk,writable").split(',')); #else QTest::newRow("QDir::AllEntries | QDir::Hidden | QDir::System") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllEntries | QDir::Hidden | QDir::System) << int(QDir::Name) - << QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','); + << filterLinks(QString(".,..,brokenlink.lnk,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',')); QTest::newRow("QDir::AllEntries | QDir::Readable") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllEntries | QDir::Readable) << int(QDir::Name) - << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','); + << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',')); QTest::newRow("QDir::AllEntries | QDir::Writable") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::AllEntries | QDir::Writable) << int(QDir::Name) - << QString(".,..,directory,linktodirectory.lnk,writable").split(','); + << filterLinks(QString(".,..,directory,linktodirectory.lnk,writable").split(',')); #endif QTest::newRow("Namefilters b*") << SRCDIR "entrylist/" << QStringList("d*") << int(QDir::NoFilter) << int(QDir::Name) - << QString("directory").split(','); + << filterLinks(QString("directory").split(',')); QTest::newRow("Namefilters f*") << SRCDIR "entrylist/" << QStringList("f*") << int(QDir::NoFilter) << int(QDir::Name) - << QString("file").split(','); + << filterLinks(QString("file").split(',')); QTest::newRow("Namefilters link*") << SRCDIR "entrylist/" << QStringList("link*") << int(QDir::NoFilter) << int(QDir::Name) - << QString("linktodirectory.lnk,linktofile.lnk").split(','); + << filterLinks(QString("linktodirectory.lnk,linktofile.lnk").split(',')); QTest::newRow("Namefilters *to*") << SRCDIR "entrylist/" << QStringList("*to*") << int(QDir::NoFilter) << int(QDir::Name) - << QString("directory,linktodirectory.lnk,linktofile.lnk").split(','); + << filterLinks(QString("directory,linktodirectory.lnk,linktofile.lnk").split(',')); QTest::newRow("Sorting QDir::Name") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::NoFilter) << int(QDir::Name) - << QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(','); + << filterLinks(QString(".,..,directory,file,linktodirectory.lnk,linktofile.lnk,writable").split(',')); QTest::newRow("Sorting QDir::Name | QDir::Reversed") << SRCDIR "entrylist/" << QStringList("*") << int(QDir::NoFilter) << int(QDir::Name | QDir::Reversed) - << QString("writable,linktofile.lnk,linktodirectory.lnk,file,directory,..,.").split(','); + << filterLinks(QString("writable,linktofile.lnk,linktodirectory.lnk,file,directory,..,.").split(',')); + QTest::newRow("Sorting QDir::Type") << SRCDIR "types/" << QStringList("*") << int(QDir::NoFilter) << int(QDir::Type) << QString(".,..,a,b,c,d,e,f,a.a,b.a,c.a,d.a,e.a,f.a,a.b,b.b,c.b,d.b,e.b,f.b,a.c,b.c,c.c,d.c,e.c,f.c").split(','); @@ -635,6 +652,7 @@ void tst_QDir::entryListSimple() void tst_QDir::entryListWithSymLinks() { +#ifndef Q_NO_SYMLINKS QFile::remove("myLinkToDir.lnk"); QFile::remove("myLinkToFile.lnk"); QFile::remove("testfile.cpp"); @@ -667,6 +685,7 @@ void tst_QDir::entryListWithSymLinks() QFile::remove("myLinkToFile.lnk"); QFile::remove("testfile.cpp"); dir.rmdir("myDir"); +#endif } void tst_QDir::canonicalPath_data() diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/qdiriterator/tst_qdiriterator.cpp index 2d5758e99e..79e44d18a9 100644 --- a/tests/auto/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp @@ -48,6 +48,10 @@ #include #include +#if defined(Q_OS_VXWORKS) +#define Q_NO_SYMLINKS +#endif + Q_DECLARE_METATYPE(QDirIterator::IteratorFlags) Q_DECLARE_METATYPE(QDir::Filters) @@ -87,6 +91,7 @@ tst_QDirIterator::tst_QDirIterator() QFile::remove("entrylist/directory/entrylist3.lnk"); QFile::remove("entrylist/directory/entrylist4.lnk"); +#ifndef Q_NO_SYMLINKS #ifdef Q_OS_WIN // ### Sadly, this is a platform difference right now. QFile::link("entrylist/file", "entrylist/linktofile.lnk"); @@ -96,6 +101,7 @@ tst_QDirIterator::tst_QDirIterator() QFile::link("file", "entrylist/linktofile.lnk"); QFile::link("directory", "entrylist/linktodirectory.lnk"); QFile::link("nothing", "entrylist/brokenlink.lnk"); +#endif #endif QFile("entrylist/writable").open(QIODevice::ReadWrite); } @@ -135,9 +141,13 @@ void tst_QDirIterator::iterateRelativeDirectory_data() "entrylist/..," #endif "entrylist/file," +#ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," +#endif "entrylist/directory," +#ifndef Q_NO_SYMLINKS "entrylist/linktodirectory.lnk," +#endif "entrylist/writable").split(','); QTest::newRow("QDir::Subdirectories | QDir::FollowSymlinks") @@ -151,10 +161,14 @@ void tst_QDirIterator::iterateRelativeDirectory_data() "entrylist/directory/..," #endif "entrylist/file," +#ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," +#endif "entrylist/directory," "entrylist/directory/dummy," +#ifndef Q_NO_SYMLINKS "entrylist/linktodirectory.lnk," +#endif "entrylist/writable").split(','); QTest::newRow("QDir::Subdirectories / QDir::Files") @@ -162,14 +176,18 @@ void tst_QDirIterator::iterateRelativeDirectory_data() << QDir::Filters(QDir::Files) << QStringList("*") << QString("entrylist/directory/dummy," "entrylist/file," +#ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," +#endif "entrylist/writable").split(','); QTest::newRow("QDir::Subdirectories | QDir::FollowSymlinks / QDir::Files") << QString("entrylist") << QDirIterator::IteratorFlags(QDirIterator::Subdirectories | QDirIterator::FollowSymlinks) << QDir::Filters(QDir::Files) << QStringList("*") << QString("entrylist/file," +#ifndef Q_NO_SYMLINKS "entrylist/linktofile.lnk," +#endif "entrylist/directory/dummy," "entrylist/writable").split(','); } diff --git a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro index 89f3541ab3..55f3b5c5a4 100644 --- a/tests/auto/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/qfilesystemmodel/qfilesystemmodel.pro @@ -3,6 +3,8 @@ CONFIG += qttest_p4 include(../../src/qfiledialog.pri) include(../../../../modeltest/modeltest.pri) +QT = core gui + SOURCES += tst_qfilesystemmodel.cpp TARGET = tst_qfilesystemmodel diff --git a/tests/auto/qhttp/qhttp.pro b/tests/auto/qhttp/qhttp.pro index 9186140491..9c2f5cb1b7 100644 --- a/tests/auto/qhttp/qhttp.pro +++ b/tests/auto/qhttp/qhttp.pro @@ -13,6 +13,8 @@ wince*: { addFiles.path = . DEPLOYMENT = addFiles webFiles cgi DEFINES += SRCDIR=\\\"\\\" +} else:vxworks*: { + DEFINES += SRCDIR=\\\"\\\" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } diff --git a/tests/auto/qline/qline.pro b/tests/auto/qline/qline.pro index ea15cfe375..56718d038c 100644 --- a/tests/auto/qline/qline.pro +++ b/tests/auto/qline/qline.pro @@ -1,6 +1,6 @@ load(qttest_p4) QT -= gui SOURCES += tst_qline.cpp -unix:!mac:LIBS+=-lm +unix:!mac:!vxworks:LIBS+=-lm diff --git a/tests/auto/qmetaobject/qmetaobject.pro b/tests/auto/qmetaobject/qmetaobject.pro index 22119bc7bb..1df54f73bf 100644 --- a/tests/auto/qmetaobject/qmetaobject.pro +++ b/tests/auto/qmetaobject/qmetaobject.pro @@ -1,4 +1,7 @@ load(qttest_p4) + +QT = core gui + SOURCES += tst_qmetaobject.cpp diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 788be1e34b..03b1474146 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2642,6 +2642,8 @@ void tst_QNetworkReply::ioPutToFileFromProcess() QCOMPARE(file.size(), qint64(data.size())); QByteArray contents = file.readAll(); QCOMPARE(contents, data); + + delete reply; #endif } diff --git a/tests/auto/qnumeric/tst_qnumeric.cpp b/tests/auto/qnumeric/tst_qnumeric.cpp index fb01e1b1ea..0c83db4733 100644 --- a/tests/auto/qnumeric/tst_qnumeric.cpp +++ b/tests/auto/qnumeric/tst_qnumeric.cpp @@ -41,6 +41,7 @@ #include +#include #include @@ -97,8 +98,12 @@ void tst_QNumeric::qNan() if (0 > nan) QFAIL("compiler thinks 0 > nan"); +# if defined(Q_CC_DIAB) + QWARN("!(0 < nan) would fail due to a bug in dcc"); +# else if (0 < nan) QFAIL("compiler thinks 0 < nan"); +# endif #endif QVERIFY(qIsNaN(nan)); QVERIFY(qIsNaN(nan + 1)); diff --git a/tests/auto/qobjectrace/tst_qobjectrace.cpp b/tests/auto/qobjectrace/tst_qobjectrace.cpp index 98c7a30394..66841253d8 100644 --- a/tests/auto/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/qobjectrace/tst_qobjectrace.cpp @@ -121,10 +121,10 @@ signals: private slots: void checkStopWatch() { -#ifndef Q_OS_WINCE - if (stopWatch.elapsed() >= OneMinute) -#else +#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS) if (stopWatch.elapsed() >= OneMinute / 2) +#else + if (stopWatch.elapsed() >= OneMinute) #endif quit(); @@ -138,7 +138,7 @@ void tst_QObjectRace::moveToThreadRace() { RaceObject *object = new RaceObject; - enum { ThreadCount = 10 }; + enum { ThreadCount = 6 }; RaceThread *threads[ThreadCount]; for (int i = 0; i < ThreadCount; ++i) { threads[i] = new RaceThread; diff --git a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp index 78ddc9954f..f2988120f1 100644 --- a/tests/auto/qreadwritelock/tst_qreadwritelock.cpp +++ b/tests/auto/qreadwritelock/tst_qreadwritelock.cpp @@ -719,6 +719,8 @@ void tst_QReadWriteLock::multipleReadersLoop() int wait=0; #if defined (Q_OS_HPUX) const int numthreads=50; +#elif defined(Q_OS_VXWORKS) + const int numthreads=40; #else const int numthreads=75; #endif diff --git a/tests/auto/qregexp/qregexp.pro b/tests/auto/qregexp/qregexp.pro index 0712496e95..d467cda0e1 100644 --- a/tests/auto/qregexp/qregexp.pro +++ b/tests/auto/qregexp/qregexp.pro @@ -1,5 +1,8 @@ load(qttest_p4) +QT = core + + QT = core SOURCES += tst_qregexp.cpp diff --git a/tests/auto/qresourceengine/qresourceengine.pro b/tests/auto/qresourceengine/qresourceengine.pro index cdbbbd2622..8f3ca5ce32 100644 --- a/tests/auto/qresourceengine/qresourceengine.pro +++ b/tests/auto/qresourceengine/qresourceengine.pro @@ -15,6 +15,7 @@ runtime_resource.commands = $$QMAKE_RCC -root /runtime_resource/ -binary $${runt QMAKE_EXTRA_TARGETS = runtime_resource ALL_DEPS += $${runtime_resource.target} +QT = core wince*:{ deploy.sources += runtime_resource.rcc parentdir.txt test.sources = testqrc/* diff --git a/tests/auto/qresourceengine/tst_resourceengine.cpp b/tests/auto/qresourceengine/tst_resourceengine.cpp index a5e701a551..e133a72e61 100644 --- a/tests/auto/qresourceengine/tst_resourceengine.cpp +++ b/tests/auto/qresourceengine/tst_resourceengine.cpp @@ -108,7 +108,7 @@ void tst_ResourceEngine::checkStructure_data() << QLatin1String("runtime_resource") << QLatin1String("searchpath1") << QLatin1String("searchpath2") << QLatin1String("secondary_root") - << QLatin1String("test") << QLatin1String("trolltech") + << QLatin1String("test") << QLatin1String("withoutslashes")) << QLocale::c() << qlonglong(0); diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro index b5aa621779..7c74b32a04 100644 --- a/tests/auto/qscriptengine/qscriptengine.pro +++ b/tests/auto/qscriptengine/qscriptengine.pro @@ -1,5 +1,5 @@ load(qttest_p4) -QT += script +QT = core gui script SOURCES += tst_qscriptengine.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/qscriptqobject/qscriptqobject.pro b/tests/auto/qscriptqobject/qscriptqobject.pro index e4e2b56cff..be3a98042e 100644 --- a/tests/auto/qscriptqobject/qscriptqobject.pro +++ b/tests/auto/qscriptqobject/qscriptqobject.pro @@ -1,5 +1,5 @@ load(qttest_p4) -QT += script +QT = core gui script SOURCES += tst_qscriptqobject.cpp diff --git a/tests/auto/qscriptvalue/qscriptvalue.pro b/tests/auto/qscriptvalue/qscriptvalue.pro index 98fd63d0e2..9efde800d6 100644 --- a/tests/auto/qscriptvalue/qscriptvalue.pro +++ b/tests/auto/qscriptvalue/qscriptvalue.pro @@ -1,5 +1,5 @@ load(qttest_p4) -QT += script +QT = core gui script SOURCES += tst_qscriptvalue.cpp diff --git a/tests/auto/qstring/qstring.pro b/tests/auto/qstring/qstring.pro index 02253c214b..eb52d907a1 100644 --- a/tests/auto/qstring/qstring.pro +++ b/tests/auto/qstring/qstring.pro @@ -1,8 +1,6 @@ load(qttest_p4) SOURCES += tst_qstring.cpp -QT -= gui - QT = core DEFINES += QT_NO_CAST_TO_ASCII diff --git a/tests/auto/qtcpsocket/qtcpsocket.pro b/tests/auto/qtcpsocket/qtcpsocket.pro index 6924309720..6a96889e5a 100644 --- a/tests/auto/qtcpsocket/qtcpsocket.pro +++ b/tests/auto/qtcpsocket/qtcpsocket.pro @@ -3,3 +3,4 @@ TEMPLATE = subdirs !wince*: SUBDIRS = test stressTest wince*: SUBDIRS = test +vxworks*: SUBDIRS = test diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/qtcpsocket/test/test.pro index fecbf112fd..696375d9d9 100644 --- a/tests/auto/qtcpsocket/test/test.pro +++ b/tests/auto/qtcpsocket/test/test.pro @@ -9,6 +9,7 @@ wince*: { } } QT += network +vxworks:QT -= gui DEFINES += TEST_QNETWORK_PROXY diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 9e55764ada..6b0a5be08c 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -60,10 +60,12 @@ #include #include #include +#ifndef Q_OS_VXWORKS #include +#include +#endif #include #include -#include #include #include #include @@ -172,9 +174,7 @@ private slots: void connectToLocalHostNoService(); #endif void waitForConnectedInHostLookupSlot(); -#ifndef Q_OS_WIN void waitForConnectedInHostLookupSlot2(); -#endif void readyReadSignalsAfterWaitForReadyRead(); #ifdef Q_OS_LINUX void linuxKernelBugLocalSocket(); @@ -1573,6 +1573,7 @@ void tst_QTcpSocket::remoteCloseErrorSlot() void tst_QTcpSocket::messageBoxSlot() { +#if !defined(Q_OS_VXWORKS) // no gui QTcpSocket *socket = qobject_cast(sender()); socket->deleteLater(); QMessageBox box; @@ -1583,10 +1584,14 @@ void tst_QTcpSocket::messageBoxSlot() // Fire a non-0 singleshot to leave time for the delete QTimer::singleShot(250, this, SLOT(exitLoopSlot())); +#endif } //---------------------------------------------------------------------------------- void tst_QTcpSocket::openMessageBoxInErrorSlot() { +#if defined(Q_OS_VXWORKS) // no gui + QSKIP("no default gui available on VxWorks", SkipAll); +#else QTcpSocket *socket = newSocket(); QPointer p(socket); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(messageBoxSlot())); @@ -1594,6 +1599,7 @@ void tst_QTcpSocket::openMessageBoxInErrorSlot() socket->connectToHost("hostnotfoundhostnotfound.troll.no", 9999); // Host not found, fyi enterLoop(30); QVERIFY(!p); +#endif } //---------------------------------------------------------------------------------- @@ -1712,9 +1718,11 @@ public slots: }; //---------------------------------------------------------------------------------- -#ifndef Q_OS_WIN void tst_QTcpSocket::waitForConnectedInHostLookupSlot2() { +#if defined(Q_OS_WIN) || defined(Q_OS_VXWORKS) + QSKIP("waitForConnectedInHostLookupSlot2 is not run on Windows and VxWorks", SkipAll); +#else Foo foo; QPushButton top("Go", 0); @@ -1730,8 +1738,8 @@ void tst_QTcpSocket::waitForConnectedInHostLookupSlot2() QVERIFY(foo.attemptedToConnect); QCOMPARE(foo.count, 1); -} #endif +} //---------------------------------------------------------------------------------- void tst_QTcpSocket::readyReadSignalsAfterWaitForReadyRead() @@ -1965,7 +1973,7 @@ void tst_QTcpSocket::suddenRemoteDisconnect_data() void tst_QTcpSocket::suddenRemoteDisconnect() { -#if defined(Q_OS_WINCE) +#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS) QSKIP("stressTest subprocess needs Qt3Support", SkipAll); #else QFETCH(QString, client); @@ -2022,6 +2030,9 @@ void tst_QTcpSocket::connectToMultiIP() { QSKIP("TODO: setup DNS in the new network", SkipAll); +#if defined(Q_OS_VXWORKS) + QSKIP("VxSim in standard config doesn't even run a DNS resolver", SkipAll); +#else QFETCH_GLOBAL(bool, ssl); if (ssl) return; @@ -2049,6 +2060,7 @@ void tst_QTcpSocket::connectToMultiIP() QCOMPARE(socket->error(), QAbstractSocket::SocketTimeoutError); delete socket; +#endif } //---------------------------------------------------------------------------------- diff --git a/tests/auto/qthreadonce/tst_qthreadonce.cpp b/tests/auto/qthreadonce/tst_qthreadonce.cpp index 590de0fb22..5d9062d6d5 100644 --- a/tests/auto/qthreadonce/tst_qthreadonce.cpp +++ b/tests/auto/qthreadonce/tst_qthreadonce.cpp @@ -134,7 +134,7 @@ void tst_QThreadOnce::sameThread() void tst_QThreadOnce::multipleThreads() { -#ifdef Q_OS_WINCE +#if defined(Q_OS_WINCE) || defined(Q_OS_VXWORKS) const int NumberOfThreads = 20; #else const int NumberOfThreads = 100; diff --git a/tests/auto/qthreadpool/tst_qthreadpool.cpp b/tests/auto/qthreadpool/tst_qthreadpool.cpp index 1111ecc9a0..d4c131d01a 100644 --- a/tests/auto/qthreadpool/tst_qthreadpool.cpp +++ b/tests/auto/qthreadpool/tst_qthreadpool.cpp @@ -205,7 +205,8 @@ void tst_QThreadPool::runTask() ran = false; manager.start(new TestTask()); // Hang if task is not runned. - while (ran == false); + while (ran == false) + QTest::qSleep(100); // no busy loop - this doesn't work with FIFO schedulers } /* @@ -215,7 +216,8 @@ void tst_QThreadPool::singleton() { ran = false; QThreadPool::globalInstance()->start(new TestTask()); - while (ran == false); + while (ran == false) + QTest::qSleep(100); // no busy loop - this doesn't work with FIFO schedulers } int *value = 0; diff --git a/tests/auto/qxmlsimplereader/parser/main.cpp b/tests/auto/qxmlsimplereader/parser/main.cpp index 4834428a2f..ffb2ecdc40 100644 --- a/tests/auto/qxmlsimplereader/parser/main.cpp +++ b/tests/auto/qxmlsimplereader/parser/main.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include -- cgit v1.2.1