Commit Graph

9103 Commits

Author SHA1 Message Date
Oswald Buddenhagen
7251683085 remove unused checkMultipleDefinition()
Change-Id: I533c2091333942f145063ad04f4420b7a2de0a37
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
2012-08-28 20:48:03 +02:00
Oswald Buddenhagen
7033560e54 remove dead variable assignments
Change-Id: I032e9116ca1b7250497f56ea26103f2173f0fc09
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-08-28 20:47:55 +02:00
Oswald Buddenhagen
8a879a6148 de-duplicate code
Change-Id: Ic3f2bfeb5a16da86b1cd471b55dfc79f12dfadee
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-28 20:47:11 +02:00
Peter Kümmel
5408225286 cmake: use .exe suffix only on Windows
Change-Id: I36ba61bd4690de0bfe4a44e579eb554c82b53bb4
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-08-28 19:55:03 +02:00
Stephen Kelly
a861e7ea14 Fix CMake file INSTALLS with debug_and_release configurations.
Change-Id: Iad0161969e3632862102703fcc239358387e2181
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Peter Kümmel <syntheticpp@gmx.net>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-08-28 18:30:57 +02:00
Stephen Kelly
a912b14c75 Add automatic metatype registration for invokable methods.
This works similarly to the automatic registration for Q_PROPERTY types,
but in this case it mostly affects the need for users to
call qRegisterMetaType<T>() before using queued connections
with methods using non-built-in metatypes, or before using invokeMethod
manually.

Change-Id: Ib17d0606b77b0130624b6a88b57c36d26e97d12d
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-08-28 18:30:39 +02:00
Stephen Kelly
62c2061a50 Add automatic metatype registration for Q_PROPERTY types.
In Qt 4, the user needs to call qRegisterMetaType if the property
could otherwise be read before the type is registered with the metatype
system. This patch makes that unnecessary and automatic by registering
it when the first read indicates that it is not yet registered instead
or when QMetaProperty::userType is called before it is registered.

The types which are automatically registered exclude the built-in
types, which do not need to be registered, and include metatypes which
are automatically declared, such as pointers to QObject derived types
and containers of existing metatypes.

Change-Id: I0a06d8efdcb64121618e2378366d0142fa0771f5
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
2012-08-28 18:30:32 +02:00
Mitch Curtis
f29896840c Handle invalid dates properly for QDataStream versions < 5.
In Qt 5, when streaming an invalid QDate using a QDataStream version
earlier than Qt_5_0, QDate.jd is written and read as 0, which is an
invalid julian day for Qt versions earlier than 5.0. For Qt 5.0
however, 0 is a valid julian day, so when comparing a deserialised
invalid date (read using a QDataStream version < Qt_5_0) against a
default-constructed invalid date, they won't compare equal when they
should.

Task-number: QTBUG-26989

Change-Id: Ia76df493471f3b068c7d7187be20e3178eff2cc7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-28 18:23:06 +02:00
Friedemann Kleint
37320e36cd Fix some warnings in tests.
- Unused variables
- Signed/Unsigned comparisons.

Change-Id: I0f4cc92a8366ad501d703d19c3358ac24db47270
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
2012-08-28 17:07:15 +02:00
Miikka Heikkinen
62b0f41ae0 Remove automatic drive letter lowercasing from Option::fixString()
This enforced lowercasing causes subtle errors, like changing the
drive letter case when doing $$files(), which makes it difficult
to do any string matching against the result later.

Task-number: QTBUG-26985
Change-Id: I4973e3ac3e851e24af944295edf290cc98f02fb6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-08-28 00:10:45 +02:00
Stephen Kelly
81b275b1dc Deprecate qWaitForWindowShown QWidget* overload since 5.0.
It is already documented as deprecated in 5.0, so marking it as deprecated
since 6.0 is silly.

Change-Id: If72cc81bdad18c907022c48b9aa8e7d87eb88e59
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-08-27 23:25:30 +02:00
Stephen Kelly
ae6d4c77eb Make it possible to use static builds of Qt with CMake.
Parse the prl files generated by qmake to get the link dependencies. They
contain all the information we need, and they are the only location with
all the right information.

Change-Id: Id9dcc988f20a744297502eff008de085326cdbcf
Reviewed-by: Brad King <brad.king@kitware.com>
Reviewed-by: Clinton Stimpson <clinton@elemtech.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-08-27 23:23:57 +02:00
Peter Kümmel
9a5ade8abe cmake: define QT_NO_DEBUG in client release builds
Change-Id: Ife224bf908c5e9bc1e62a830a3750de88a082eb7
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-08-27 23:23:51 +02:00
Stephen Kelly
6c27c74ace Add some error checking to the qt5_use_modules function.
Change-Id: I8fa2f10edbee1080646324c0689b23eda44aa75d
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-08-27 23:23:23 +02:00
Stephen Kelly
6263e9078a Fix plugin docs regarding location of json files.
The commit 2ef52ca124 introduced
an error regarding where the json file must reside.

Change-Id: I296c93abebb3e9f8c9e7e29a4a433201064969f0
Reviewed-by: Peter Kümmel <syntheticpp@gmx.net>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-08-27 23:22:25 +02:00
Frederik Gladhorn
3be101bee0 doc: key -> uicontrol
Change-Id: I42e5e2dc2d7cf7030ee9bc7dfa97ddaa66958370
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
2012-08-27 10:59:50 +02:00
Marc Mutz
37a660c594 qcompilerdetection.h: set Q_DECL_OVERRIDE/Q_DECL_FINAL for 2005 <= MSVC <= 2010
This enables Q_DECL_FINAL and Q_DECL_OVERRIDE backed by VC's
non-standard extensions from VC 2005 on. VC 2012 will support
the standard-compliant version, so use that there.

Change-Id: I96874fe3d36fcaa283d2d1f53d5eb6825e55f259
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-27 10:59:09 +02:00
Eskil Abrahamsen Blomfeldt
4712d88c0e Make letter spacing APIs in QTextFormat more consistent
Change d060b6f04f introduced some
new properties to QTextFormat which were unfinished and did not
match the documentation in the same change. I've updated the API
and docs to use the regular QFont enum for letter spacing type
instead of introducing bools (which inhibits expansions later)
or mutually exclusive properties in the text format.

Change-Id: Ife44993b6746c413e421fdaf92ebaaab6ba95977
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-08-27 10:58:03 +02:00
Sean Harmer
bc80ee36f8 QNX: Enable pre-compiled header support for QNX
Change-Id: I6af69965b19c5d0d7a46de8000433bc5f1f2abcb
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-08-27 10:52:20 +02:00
Sean Harmer
bf5e3247ae Enable symbol visibility support on QNX
Change-Id: Ie6015f87976cf16e0474dfa66da885ef24738f6c
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-08-27 10:50:35 +02:00
Frederik Gladhorn
757709f0d5 Remove mentioning of Phonon.
Change-Id: I78ce6d42ee043a35b520bf8567a1874cf8e2e43e
Reviewed-by: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
2012-08-27 10:37:01 +02:00
Frederik Gladhorn
d3dfe55fd4 doc: clean up model view overview links
Change-Id: I4aaf0cb254ffa4c7369e51b35af0226c98ec293c
Reviewed-by: Gabriel de Dietrich <gabriel.dietrich-de@nokia.com>
2012-08-27 10:36:38 +02:00
Jani Honkonen
547a1bea49 Fix limitting shortcuts to keypad only
The Qt::KeypadModifier modifier is internally masked away from all
shortcuts. So it is not possible to set a keypad only shortcut.
Changed the implementation so that first a full keysequence match is
searched. Then if no match is found the same sequence is tried
without the keypad modifer.

Added a autotest for this also to cover the basic use cases relating
to this.

Task-number: QTBUG-20191

Change-Id: Ibe7740c705fd0ab1eece4809b9a0b48882172933
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-08-27 10:27:30 +02:00
Peter Kümmel
2ef52ca124 Update Q_PLUGIN_METADATA docu.
Change-Id: I7e451a15de392552609ef549118600684429e0ea
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-08-26 22:12:03 +02:00
Marc Mutz
3de60970e5 QMetaTypeId: optimize qt_metatype_id() in special cases
Same change as for Q_DECLARE_METATYPE, but in the container and
smart pointer specialisations of it.

Change-Id: If9390ccc43eb3b07122f5ea5b8094139b5e1ded0
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 16:54:27 +02:00
Marc Mutz
56603a8d83 QMetaTypeId: optimize qt_metatype_id()
The old code resulted in one memory fetch for the test plus another one
for the return value (at the assembler level). The new code reuses the
already-loaded value:

-       movl    _ZZN11QMetaTypeIdI12QDBusMessageE14qt_metatype_idEvE11metatype_id(%rip), %edx
-       testl   %edx, %edx
-       je      .L158
        movl    _ZZN11QMetaTypeIdI12QDBusMessageE14qt_metatype_idEvE11metatype_id(%rip), %eax
-       ret
+       testl   %eax, %eax
+       je      .L160
+       rep; ret

It also saves one load in the not-yet-initialised case:

-.L158:
+.L160:
        leaq    .LC7(%rip), %rdi
        subq    , %rsp
        .cfi_def_cfa_offset 16
        movq    himBH1, %rsi
        call    _Z17qRegisterMetaTypeI12QDBusMessageEiPKcPT_
        movl    %eax, _ZZN11QMetaTypeIdI12QDBusMessageE14qt_metatype_idEvE11metatype_id(%rip)
-       movl    _ZZN11QMetaTypeIdI12QDBusMessageE14qt_metatype_idEvE11metatype_id(%rip), %eax
        addq    , %rsp
        .cfi_def_cfa_offset 8
        ret

Change-Id: I769950449822f2b1587680e05518be0a4f3120a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 16:54:23 +02:00
Marc Mutz
e6c50609c8 QSlotObjectBase: make 'impl' and 'ref' private
This allows to fold the deref() and the destroy() operations into one,
destroyIfLastRef().

The member variables were renamed since there's now a member function
of the same name (ref()).

Change-Id: Ib94416d9e658065bbf5d3711ecafaf0eb063af17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:34:13 +02:00
Marc Mutz
2d78e24191 QSlotObjectBase: make Operation enum protected
We don't want people to go and call through the function pointer
directly.

Change-Id: I386645239974f008d513eaa62593c1141b294b60
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:34:06 +02:00
Marc Mutz
4570d0ac24 QSlotObjectBase: remove misleading comment
These constructors might not benefit from being constexpr (as the objects are
only created on the heap), so don't suggest so. There's no disadvantage of them
begin constexpr, but their constexpr'ability depends on whether QAtomic has
a constexpr constructor, and the added complexity of finding that out isn't
worth it.

Change-Id: I089a29dcb98ba935c339dce09d71f283522a9afd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:34:01 +02:00
Marc Mutz
bd1a7ed26b moc: test slots marked final/override in various ways
While writing the test, I found that moc doesn't yet support
volatile slots. I left the tests in, commented, for a time
when it does.

Change-Id: Ib5fa00b25600618aedcc66739630054f3c879b99
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:29:52 +02:00
Marc Mutz
80694dd614 moc: parse classes that use Q_DECL_FINAL|final|sealed
This only works with the C++11 contextual keyword
directly, the MSVC equivalent 'sealed', or the Qt
define for it.

While this isn't a problem for syncqt, being an
internal tool, moc should eventually be able to parse
user code using local C++11-final-wrapping macros.
For this, I guess moc would have to be taught to
expand macros in code and not just test #if clauses,
potentially driven by something like
  #pragma qt-moc expand-this
  #define MY_FINAL_CLASS final
but that's something for someone more intimately
familiar with moc's source than I am.

Change-Id: Id6aec961a881e8d5a9b76a7fc8e1c02c71913f64
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:29:52 +02:00
Marc Mutz
d811b2434b syncqt: parse classes that use Q_DECL_FINAL|final|sealed
I've introduced a variable $post_kw (post-class-keywords) that
contains the patterns which are expected after a class name.
This variable is used both for a negative look-ahead assertion
in the class-name capture (so the regex doesn't parse the
keywords as the class-name), as well as to carry the parser
over the keywords into the subclass clauses.

Change-Id: Ia534ca01a511e1c773d007f1b0b4f448e8d009d0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-08-26 14:29:51 +02:00
Marc Mutz
c09eeff2ab QtGlobal: document Q_DECL_FINAL and Q_DECL_OVERRIDE
Change-Id: I9b292ae3319c30ad878aade4416fb88155465a54
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:29:50 +02:00
Marc Mutz
f45080e142 QtGlobal: remove Q_DECL_FINAL_CLASS
Now that qvariant_p.h's HasIsNullMethod check is fixed
so that it doesn't require Q_COMPILER_DECLTYPE anymore
to be able to deal with final classes, there's no point
in distinguishing Q_DECL_FINAL and Q_DECL_FINAL_CLASS
anymore, so remove the latter.

Change-Id: I31de5b63e7d2e44171a13e928997c946d93e05c9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:29:50 +02:00
Marc Mutz
7e0fa2fc75 QVariant: make the HasIsNullMethod check work across all compilers (maybe)
Currently, we have a C++11 version that requires Q_COMPILER_DECLTYPE
support, and can deal with final classes, and a C++98 version that
doesn't require any C++11 features, but fails on final classes.

What we're missing is a version that works for MSVC v8 and v9
(2005 and 2008), which sport the 'sealed' non-standard keywords
but lack decltype support. So far, we tried to solve the problem
by making class-level final special (Q_DECL_FINAL_CLASS), not
defining that macro for these two compilers, even though we did
define Q_DECL_FINAL, the method-level keyword.

This new formulation, taken from
  http://stackoverflow.com/a/9655327/134841
supposedly supports all compilers with a minor #ifdef for
MSVC which doesn't like applying sizeof() the way we do.

However, testing has shown this to blow up on OSX.

So we use the less intrusive approach: add this variant as
a third version, only used by VC 2005 and 2008.

Change-Id: If1945f8a6e9ed36cb68212fa781d5e29eb2a082d
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:29:49 +02:00
Marc Mutz
9090e0d9c6 qcompilerdetection.h: add MSVC 2012 features
These are taken from the table at
  http://blogs.msdn.com/b/vcblog/archive/2011/09/12/10209291.aspx

Change-Id: Ifd2f88ca5d92092a6a025bef3da36fde0a802a66
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:29:48 +02:00
Marc Mutz
bf186ceebb qcompilerdetection.h: stream-line MSVC feature detection
Reformat the MSVC feature detection to be similar to other compilers, ie.

1. Inside the C++11 features section instead of where the compilers
   are detected
2. In one block for the compiler, with sub-blocks for the version.

However, it's now not 100% compatible with the previous version,
since Q_CC_INTEL is now explicitly excluded while before it was
implicitly included in the MSVC case. I have no idea whether
that matters, since Q_CC_INTEL is handled for itself further up
already.

Change-Id: Id9e8da0a5394ad5643bcb29493f14bc6e8264c13
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 14:29:48 +02:00
Thiago Macieira
3717802653 Small optimisation to recursive mutexes
A recursive mutex operates on top of a non-recursive mutex. Therefore,
we can bypass the test for recursive.

The end result is simply that the compiler can inline the locking and
unlocking a little better inside the lock() and unlock() functions

Change-Id: Ic06d1344ccd411c22cbdef74536f3a4d368d75d7
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 13:57:58 +02:00
Michael Brasser
8e7b86de2c blockSignals should block QML signal emission.
Change-Id: Ief35f3ca326173a87240e3cb558e47f721bd04b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-26 11:08:42 +02:00
David Faure
ac2b452616 QUrl: port thread-safety autotest from Qt4.
This detected the same missing detach()s in QUrl::resolve.
Everything else works, no need for a mutex in Qt5's QUrl.

Change-Id: I0da51b7b0c6b810d314a26d4b638383cd17de12b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-26 11:08:42 +02:00
Marc Mutz
2b69159fd8 QFileSystemModel: remove incorrect #ifndef
No other call to fileInfoGatherer.getInfo(info) is #ifndef'ed on
QT_NO_FILESYSTEMWATCHER, so this one shouldn't be, either.

Change-Id: If145226c13d77460d6169a9ed3028647b0f565b5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Majid Khan <mkhan3189@gmail.com>
2012-08-26 09:07:37 +02:00
Marc Mutz
feeaa1302c HarfBuzz: fix unused parameter / variable warnings
Change-Id: I362c80081ac4e4d0b9126385bab5a77826810926
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
2012-08-25 23:21:55 +02:00
Markku Heikkila
70758cbf15 Fix infinite recursion while dragging toolbar of QMainWindow.
Prevent recursion in QMainWindowLayout::endSeparatorMove().

Manually cherry-picked from Qt 4.8 change
90b71dc0ff4ec9bb150a0de9933d6eb06d995a34

Task-number: QTBUG-21378

Change-Id: I901ebfd96be0bdc6ab03dd8c3335d2622db843db
Reviewed-by: Janne Anttila <janne.anttila@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-08-25 19:04:56 +02:00
Shawn Rutledge
dfe7bdbe9c explain specifically how to make a transparent window
Change-Id: I136d8d9709d4fae914f12919e513641a6e76e3f0
Task-number: QTBUG-20768
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-08-25 19:04:56 +02:00
Christoph Schleifenbaum
77e57387ac OSX: Drag and Drop QMimeData.
When dragging and dropping within the same application, the QDropEvent
should contain exactly the same instance of QMimeData as it was set to
QDrag.

This solves the problem in
https://bugreports.qt-project.org/browse/QTBUG-26953

Change-Id: I3bc4da845ff4293c509343c1c8c62fc331416ec0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-08-25 19:04:56 +02:00
Eskil Abrahamsen Blomfeldt
c008420eb5 doc: Fix doc warnings for qtextlayout.cpp
\Auml for a with umlaut doesn't seem to work with qdoc anymore,
so replace this with the unicode value instead. Also, add
reference to arguments in glyphRuns() function.

Change-Id: I31861b384b822d1fbdcafbeeac07ea68a0e5fd07
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
2012-08-25 19:04:56 +02:00
Eskil Abrahamsen Blomfeldt
1349299f45 doc: Fix several text-related qdoc warnings
Also adds a new snippet which is just copy-pasted from the
old documentation, because the snippet-file previously referenced
seems to have disappeared.

Change-Id: I0180715544321e076acda769cbdcbf19d50a971b
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
2012-08-25 19:04:56 +02:00
Oswald Buddenhagen
72a7c43e90 filter standard paths from mysql_config & pg_config
standard paths should never be added to compiler/linker lines, as they
are likely to mess up the lookup order.
pkg-config does that filtering for us, but the home-grown config tools
don't, so we need to take care of it.

configure.exe does not have such auto-detection, so the change is not
necessary there.

Task-number: QTBUG-26850
Change-Id: I2f523d5cffb27c3d0a16cdef6ca8a4877c9983c0
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
Reviewed-by: Mitch Curtis <mitch.curtis@nokia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
2012-08-25 17:03:17 +02:00
Thiago Macieira
ab9fde6c0c Split the futexFlags() function in two: a hot and a cold path
We could mark the cold path with __attribute__((cold)) (since GCC 4.3),
but quick tests locally indicate that the compiler is smart enough to
determine that by itself.

It will inline the hot path in _q_futex, which in turn is inlined in the
lockInternal and unlockInternal functions, whereas the cold path is kept
outside.

Change-Id: I8ae7d851d4f050498bfb491ba87d3e25453a14f8
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2012-08-25 10:35:34 +02:00
Thiago Macieira
c28204066c Mark mutex locking and unlocking functions with noexcept
Unlocking a mutex can never throw an exception. That doesn't make
sense and our code should make sure it can't happen. Right now,
provided that the system-level functions don't throw, we don't either.

Locking a mutex cannot throw on Linux because we use futexes
directly. A non-recursive mutex is just a futex, whereas a recursive
mutex uses a mutex (a futex) to manage a lock count.

However, on other platforms, due to the freelist, there can be memory
allocation, which means it might throw std::bad_alloc. Not because of
the freelist itself (that uses malloc and will just crash if malloc
fails) but because of Q_GLOBAL_STATIC. In 5.1, the global static will
be noexcept provided the type's constructor is so too (it is, in this
case).

Change-Id: I4c562383f48de1be7827b9afb512d73eaf0792d5
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-08-25 10:35:26 +02:00