summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Publish qEnvironmentVariableIs{Set,Empty}()Marc Mutz2013-03-301-7/+5
| | | | | Change-Id: I81b960495c206024b4124cebf88b48b0c0d73619 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Document Q_OS_WIN* macrosTopi Reinio2013-03-291-1/+16
| | | | | | | | | | | Fix the documentation for Q_OS_WIN32 and document Q_OS_WIN64 and Q_OS_WIN. Task-number: QTBUG-23120 Change-Id: Ie040c8deb6aeba326b6fafab302fadf4d93fa49f Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-03-051-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure qmake/generators/mac/pbuilder_pbx.cpp src/corelib/kernel/qtimerinfo_unix.cpp src/plugins/platforms/cocoa/qcocoabackingstore.mm src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowswindow.cpp src/plugins/platforms/xcb/qglxintegration.cpp Change-Id: I8d125fe498f5304874e6976b53f588d3e98a66ac
| * Add snippet for QT_VERSION_CHECK.Mitch Curtis2013-02-271-0/+4
| | | | | | | | | | | | Change-Id: I048771f21ce694329a7e9acd4dbfbebfec964b05 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-02-201-2/+20
|\| | | | | | | | | | | | | | | | | | | Conflicts: mkspecs/features/unix/separate_debug_info.prf src/gui/kernel/qwindow_p.h src/plugins/platforms/cocoa/qcocoacursor.mm tests/auto/tools/moc/tst_moc.cpp Change-Id: Ieb57834c00f961a747ffe51e6eb9fc9612cebccf
| * Document the qintptr for public usageLaszlo Papp2013-02-201-2/+20
| | | | | | | | | | | | | | | | | | | | | | | | The QAbstractSocket API has been already using this as a return type. Hence, this has already been exposed to the public API users, anyhow. http://qt-project.org/doc/qt-5.0/qtnetwork/qabstractsocket.html#socketDescriptor A minor mistake has also been fixed in this commit at the quintptr section. Change-Id: I8143b3050428548ff6baee2e3a0bce4058ea8701 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add qunsetenv(), next to qputenv() and friends.David Faure2013-02-071-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing tst_qgetputenv shows that qputenv with an empty value doesn't lead to the same result on Windows and on Unix, and there was no way to fully delete an env var on Unix (which is needed for some env vars where not-set and empty are different, such as TZ, see `man tzset`). This is also why qglobal has qEnvironmentVariableIsSet() vs qEnvironmentVariableIsEmpty(), on the getter side. Qt4's ifdefs around unsetenv in qapplication_x11.cpp show that this is needed within Qt too (although this particular startup notification code has to be re-imported into Qt5 still). Change-Id: I631c8cddbcf933d4b9008f11aefc59f5a3c7c866 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Remove left-overs of QT_{BEGIN,END}_HEADERSSergio Ahumada2013-01-311-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This macro is useless from Qt 5.1 on, so: - Remove comment about using QT_BEGIN_NAMESPACE after QT_BEGIN_HEADER - There is no need to blacklist these in qt-cpp-ignore.qdocconf Change-Id: I2c3ceb3d77d294a606b87f7486071a2350b3d42f Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: hjk <hjk121@nokiamail.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* | Merge "Merge remote-tracking branch 'origin/stable' into dev" into ↵Frederik Gladhorn2013-01-231-1/+1
|\| | | | | | | refs/staging/dev
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | VxWorks header only available in DKM mode and not in RTP mode.Pasi Petäjäjärvi2013-01-231-1/+1
|/ | | | | | | Check if _WRS_KERNEL is defined so we are compiling for DKM mode. Change-Id: I15801b0575d3fe6e543f81a177fd01d015d9085f Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Protect Q_UNREACHABLE and Q_ASSUME by Q_ASSERT.Jędrzej Nowacki2013-01-101-0/+4
| | | | | | | | | Both Q_UNREACHABLE and Q_ASSUME with an invalid condition can produce really weird side effects and crashes. Change-Id: I4d808c705ae98388ef5853e6539b70bd5e5ad34b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* doc: Remove documentation for removed TRUE and FALSE macrosSergio Ahumada2012-12-061-20/+0
| | | | | | | These macros were removed by 158f39ec7870c54ff3a15f72fe151062d6daa172 Change-Id: I2aabef1dd2c9cb3949040c167a4e5cf1a9390ba6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Use slogger2 for logging on Blackberry instead of writing to stderrFabian Bumberger2012-10-041-5/+7
| | | | | | | Change-Id: Id0137400f18c8dfe7be7ca44670c16615401d424 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Peter Hartmann <phartmann@rim.com>
* QFlags: use unsigned int when the enum's underlying is unsignedMarc Mutz2012-09-281-1/+12
| | | | | | | | | | | Replace storage and operator int() return types with unsigned int if the enum is unsigned. This fixes a number of exisiting warnings, in particular with Qt::MouseButton under GCC. Change-Id: Ia12d36212329aec3e9d62a5fbd38809a6c2b36d0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* [docs] QFlags: fix a whitespace errorMarc Mutz2012-09-261-1/+1
| | | | | Change-Id: I316ceb3d630d6697466a46fa14bdbd8379079875 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove duplicate words and punctuation from documentation.Mitch Curtis2012-09-261-1/+1
| | | | | Change-Id: I5550c62d412510bc2c5acceb2cae7d2f2ef6a8d3 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix build with QT_NO_EXCEPTIONSHarald Fernengel2012-09-121-0/+2
| | | | | | | | | qTerminate is declared within a #ifndef QT_NO_EXCEPTIONS block, so the implementation must use the same #ifdef Change-Id: I5d2d58a55fce5084c0538d18a9dd3998b12ed703 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Arvid Picciani <aep@exys.org>
* Use setenv in qputenv if possible, since it won't leakThiago Macieira2012-09-071-0/+3
| | | | | | | | | | | | | | | | | putenv(3) is evil: SUSv2 requires that the pointer passed to it be added to the environment and that modifying the contents of that pointer later will also cause the environment to change. That means we needed to strdup before calling it and that memory was never freed. This shows up all the time in valgrind's leak check. Instead, let's use the 4.3BSD & POSIX.1-2001 setenv(3) function, which does copy. That means there are either no leaks or, if there are, they're not our fault. Change-Id: I4576f91cc718b6b3cae790c4f2854c4976dded37 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QtGlobal: mark qVersion() and qSharedBuild() as nothrowMarc Mutz2012-09-071-2/+2
| | | | | Change-Id: Id9dcf71363754cf6aae94012b22d144455e213eb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix docs of qAbs to have the correct function signature.Jan-Arve Saether2012-09-031-1/+1
| | | | | Change-Id: I984032dc58387ae8f28318beeb053af28ccc8885 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QtGlobal: document Q_DECL_FINAL and Q_DECL_OVERRIDEMarc Mutz2012-08-261-0/+56
| | | | | | Change-Id: I9b292ae3319c30ad878aade4416fb88155465a54 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Doc: Add \inmodule QtCore to all QtCore class doc bodiesThiago Macieira2012-08-231-0/+3
| | | | | Change-Id: I19100755c97cc155c76a859e19940e9f9222d34e Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Fix more qdoc errorsLars Knoll2012-08-201-0/+3
| | | | | Change-Id: Ieed340068327f37ea0f549d24ea49235994118f4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix a couple of qdoc errorsLars Knoll2012-08-181-1/+1
| | | | | Change-Id: I79f689e08ed4a496052529af38fca72c3d4e04cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make the "\internal" qdoc command stand on its own lineLaszlo Papp2012-08-151-2/+4
| | | | | | | | | | The qdoc manual currently claims that the command must stand on its own line. The change follows the consistency with the rest and how the example looks like inside the qdoc manual for this command. Change-Id: I6b653dc95cf9d84e4adf32220dace5d313678419 Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* QtGlobal: (new) qEnvironmentVariableIs{Set,Empty}()Marc Mutz2012-08-091-0/+56
| | | | | | | | | | | | | These functions are a faster version of {,!}qgetenv().is{Null,Empty}(), a common pattern in Qt code. Their main advantage is that they don't need to allocate memory, so they can be used in noexcept functions, or dynamic initialisation of namespace-scope statics, because throwing in these contexts invokes std::terminate(). Change-Id: I651c5bd72f450b5d7df76590f8791572fe992af5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Logging: mark qt_assert()/qt_assert_x()/qFatal() as nothrowMarc Mutz2012-08-091-2/+43
| | | | | | | | | | | | | | | | | | | | | | These functions are not supposed to return, not even by exception. qt_message() _can_ throw, but we're fine with the compiler calling std::terminate() then, since the backtrace will still include the assertion location. This behaviour is ensured by a new macro, QT_TERMINATE_ON_EXCEPTION, which expands to something like try { expr; } catch(...) { std::terminate(); } if the compiler doesn't support Q_DECL_NOEXCEPT (but maybe Q_DECL_NOTHROW), and to something like just expr; otherwise (including in the QT_NO_EXCEPTION case). The real macro preserves scopes in all cases, and aims to work even if <exception> isn't included in the TU it's used in, so is a little bit more complex than that. Change-Id: Ie6a2b7776e6aa77e57bd9aea6e184e5fa1cec81c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Q_DECL_NOTHROW: stronger and more widely available version of Q_DECL_NOEXCEPTMarc Mutz2012-08-071-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 1adca807 defined Q_DECL_NOEXCEPT to be the same as throw() for the Microsoft compiler. However, the two are not equivalent: - C++11 noexcept is defined to call std::terminate() if a noexcept function nevertheless encounters an exception. - MSVC throw() has essentially undefined behaviour in this situation: http://msdn.microsoft.com/en-us/library/wfa0edys%28v=vs.100%29 "Due to code optimizations that might be performed by the C++ compiler [...] if a function does throw an exception, the program may not execute correctly." So define two macros: 1. Q_DECL_NOEXCEPT/Q_DECL_NOEXCEPT_EXPR always have C++11 behaviour. This is expected to be the more efficient implementation if the function can actually throw. 2. Q_DECL_NOTHROW means that the function gives the nothrow guarantee. It is stronger than noexcept, but not all functions that can be marked Q_DECL_NOEXCEPT can be marked Q_DECL_NOTHROW. In general Q_DECL_NOTHROW functions need to use a try/catch block in order to prevent exceptions from leaving the functions, unless you can proove that none of the operations can throw. For the caller, both macros are equivalent: it can be relied on that no exception leaves the function. Change-Id: I32f822a82e06a31cb71d38db438387aee5ec3334 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
* Fix q_check_ptr typo in QtGlobal documentation.Mitch Curtis2012-07-231-1/+1
| | | | | | Task-number: QTBUG-24093 Change-Id: Ia6b4ef49e07910ceddd826b3b7cc81ca41f33d01 Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* Fix some spelling errorsSergio Ahumada2012-07-111-1/+1
| | | | | | Change-Id: I19d3b2e9a5180b13deb828b55195404ef20be295 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fix MinGW-w64 compilationJonathan Liu2012-07-021-1/+1
| | | | | | Task-number: QTBUG-24699 Change-Id: If6210315926f0266045766bb5d3b00a6d0bdf703 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Add qMove macro to support std::moveOlivier Goffart2012-06-201-0/+8
| | | | | Change-Id: I373e07f479c11b172dab35ed7e5b62724aa50a1a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Export qMemSet and qMemCopy properlyThiago Macieira2012-06-121-0/+5
| | | | | | | | | | Commit d839564c94a73e3dd2816a8c2196e612e1f5cb79 was incomplete. It added the Q_CORE_EXPORT macro to qmalloc.cpp, but the qMemSet and qMemCopy function bodies are in qglobal.cpp. Change-Id: I24ee44f04365d8dbdf3f1c0f22b6a72cae9f96bb Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Add Mac OS 10.8 QSysInfo enumsMorten Sorvig2012-05-251-0/+1
| | | | | Change-Id: I79ce06ead836478ff6816e6631742db91ba256fe Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Properly guard rand_r use with _POSIX_THREAD_SAFE_FUNCTIONS for Android.Robin Burchell2012-05-041-1/+1
| | | | | | | | Android does not support this, or other thread-safe functions. Change-Id: Id2a918f83e6138795196c45f89613c5b46911901 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-05-031-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/gui/kernel/qguiapplication.h src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow.h tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp Change-Id: I62a8805577a7940d4d36bed985eb3e7019d22f2e
| * Allow qDebug output to be configured by qSetMessagePattern()Kai Koehne2012-04-241-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add qSetMessagePattern() to configure the default message pattern. This one can still be overwritten by setting the QT_MESSAGE_PATTERN environment variable. Without this method, there's actually no way to change the default output programatically. Since QT_MESSAGE_PATTERN is evaluated when the first message arrives, setting it via e.g. qputenv might have no effect/be too late. Change-Id: I115e0c30606f128fdbf5c169a951ffa2a6a48517 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Logging: Change arguments of message handler to avoid conversionsKai Koehne2012-04-201-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new QtMessageHandler that takes QString instead of char *: This avoids converting to local8bit , only to convert it back to utf16 for Windows. The old QMessageHandler is kept for a transition period, but will be removed before Qt 5.0. Also fix qEmergencyOut (that is called in OOM situations) to not rely on the default message handler. Change-Id: Iee0ce5838f97175c98788b847964273dd22d4a37 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Doc: Prepare for building modular QtCore docs.Casper van Donderen2012-04-191-146/+57
| | | | | | | | | | | | | | | | | | | | | | | | This change fixes most qdoc errors in QtCore. There are about 900 left. The main thing this change does is moving documentation from qtcore from /doc/src to /src/corelib/doc. Other issues resolved are mis-use of qdoc commands. Change-Id: I002d01edfb13575e8bf27ce91596a577a92562d1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
* | Change coreservices -> iosIan Dean2012-04-191-4/+4
|/ | | | | | | | Replace "contains(QT_CONFIG, coreservices)" with "!ios" in config files. Replace "QT_NO_CORESERVICES" with "Q_OS_IOS" in source files. Change-Id: Id3b02316b245a24ce550e0b47596d18a4a409e4f Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
* Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-161-1/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/corelib/io/qurl.cpp src/gui/kernel/qwindow.cpp src/tools/moc/generator.cpp src/widgets/kernel/qwidget_qpa.cpp src/widgets/styles/qstyle.h src/widgets/widgets/qtabbar.cpp tests/auto/corelib/codecs/utf8/tst_utf8.cpp Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
| * Add OS version detection for windows 8Shane Kearns2012-04-121-0/+4
| | | | | | | | | | | | | | Based on consumer preview, the internal version is 6.2 Change-Id: I9d6ff6c7614f46a20d489e8a8f4aefeb60c547f6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * QTypeInfo: document Q_PRIMITIVE_TYPE existing practiceMarc Mutz2012-04-091-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Despite the documentation requiring Q_PRIMITIVE_TYPEs to be PODs, existing practice in Qt (QFixed, QFlags, QUuid) is to allow constructors on primitive types as long as every bit pattern represents a valid object (ie. memory doesn't have to be initialised to hold an object of the type) and memcpy() can be used to create an independent copy of the object (memcpy()ing QString, e.g., while creating two valid objects, doesn't create independent copies). Change-Id: Ia85d48b89f6cc84e69ea76719eab9a858d247ad6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* | Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.Robin Burchell2012-04-111-7/+0
|/ | | | | | | | | | | | | | | | | | Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these functions just to avoid an include, except to pay for it with worse runtime performance. On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15% faster(!) than adding an additional call to qMemSet. The advantage on sizes above that is unmeasurable. For qMemCopy, the benefits are a little more modest: 16-7%. Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Logging: Make sure documentation shows upKai Koehne2012-04-021-0/+199
| | | | | | | | | | | | | Move the documentation for qDebug, qWarning, qCritical, qFatal, QMessageHandler, QtMsgHandler, qtInstallMsgHandler, qInstallMessageHandler from qlogging.cpp to qglobal.cpp. For some reason it's not picked up from qlogging.cpp otherwise. Also, tweak the output so that e.g. qDebug and friends are correctly listed as macros. Change-Id: I8cabf04bae0e8ae9a31a40ebe2d3272c3a33653b Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
* Add macros for assuming and unreachable codeThiago Macieira2012-03-241-0/+57
| | | | | | | | | | Use these macros to tell the compiler about conditions that may happen, so it will generate better code. But do not assume that they will do anything special. Change-Id: I89ec4f65f48a9340ccf5ffc4ae4b8c3d8897c8b1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Remove codecForTr().Robin Burchell2012-03-061-3/+1
| | | | | | | | | | Similarly to change id I2f429fa7ef93bd75bb93a7f64c56db15b7283388, the capability to arbitrarily alter the encoding of literals is very destructive, especially in a world with libraries and plugins. Change-Id: If0d4cd8dcf89792e39c1984cbde6b036cebfc02f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-021-7/+7
| | | | | | | | | | | QDoc now has support for Doxygen style commands for italics, bold and list items. This change applies that change in QDoc to the actual documentation. Task-number: QTBUG-24578 Change-Id: I519bf9c29b14092e3ab6067612f42bf749eeedf5 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>