tst_qdebug didn't test adding something else after the MyLine object,
so I didn't realize that a space was missing there. All debug operators
should end with maybeSpace(), but with the settings of the caller, so this
requires restoring the settings before calling it. To make it convenient
for all << operators, the destructor of QDebugStateSaver takes care of that.
Change-Id: I18ab78d99d7ee3be951082b5b5d34718ee60e21d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Check also for rules set in an environment variable QT_LOGGING_RULES.
This makes it even more convenient to set rules e.g. for just one run of an
application, without having to create a logging configuration file. It
is also more in place with the current way we enable/disable debugging
of parts of Qt via environment variables.
Change-Id: I4d05976f2b6c12bca472552ffa22345475cd01de
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Tomasz Olszak <olszak.tomasz@gmail.com>
Use QStringRef to speed up the parsing of the left side of logging rules.
Change-Id: Idd4d75496e3865d092f2802c45928a414c14c615
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Do not accept rules with wildcards in the middle.
Change-Id: If6fa71629c46bc4127aa8bd475643bc0e8a9f57c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The documentation says that the left side of a logging rule has the syntax
<category>[.<type>]
with optional wildcard '*' as the first or the last character (or at
both positions.
However, so far we didn't allow
qt.*.debug
But what we did allow is implicit dropping of trailing '.', e.g.
qt.* matched also 'qt'
Fix these by splitting up the '.type' in advance, and then do string
matching only on the 'real' category names.
Change-Id: Iab50ad0fc673464e870f5ab8dfb3245d829b3107
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use the QTextStream stream operator for formatting 64 bit numbers,
just like we do for other numbers, too. This ensures all numbers in
a QDebug stream e.g. respect the hex and showbase modifiers.
The original reason for formatting qin64, quint64 with QString::number
is unclear (pre-dates the original qt4 git import). Maybe QTextStream
did lack proper support for 64 bit numbers back then.
Task-number: QTBUG-36841
Change-Id: I049516c2a8394c9c1a708f86c3d950418a20a957
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This reverts commits f12b0f9a38
("QByteArrayList: optimize op+"),
f96f2fe367 ("Enable QByteArrayList
tests"), and 4f23f0530a ("new
QByteArrayList class").
This class is coming back in Qt 5.4.
[ChangeLog][CHANGELOG FIX] Remove the line about QByteArrayList being
added.
Change-Id: I890ab2b34a9b3e575512eb306d0f241143a867cf
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This patch adds the Objective-C NSData/CDataRef converters to
QByteArray
This will replace the current converters offered in QMacExtras
[ChangeLog][QtCore][Objective-C] Added NSData/CDataRef converters for
QByteArray
Change-Id: I7a0f14bee4271798db345f3c5efd26ac671a3ea4
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The test instantiates enormous amounts of templates in one compilation
unit. All clang versions, that I tested, suffers from performance issues
while compiling the test, the cost depends on the version. The most
affected are shipped by Apple.
Task-number: QTBUG-37237
Change-Id: I0959c1a4a6faee448ae1dae5c1e70ee06cefbd9c
Reviewed-by: Simo Fält <simo.falt@digia.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
We do not need to check all possible basic type combinations in
the autoregistration test.
Change-Id: Ibfb97a93d9d1862e669d843988976690bbc83c74
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Redundant and unused variadic macro arguments were removed. For macros
with known count of arguments, named arguments are preferred.
Common code was moved out from macros so it is not generated over and
over.
Change-Id: Ib5106555d0d3c6cadfbdbdbd614831240b6d762f
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
- QVariant can store (U)Int, (U)LongLong, Float and Double numbers.
Previously, QJsonValue::fromVariant() converted Floats into Strings
while converting the others to Doubles.
- Add unit tests for QJsonValue::fromVariant()
[ChangeLog][QtCore][JSON] QJsonValue::fromVariant() will now convert
single-precision Floats into Doubles instead of Strings
Change-Id: I457adbe29c37ada611d1c6d711c42866d63d4024
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
And takes a very long time to build if it doesn't run out of memory.
Task-number: QTBUG-37237
Change-Id: I8c7fae4d2d99ad59c6d6306da2df554a05955446
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
In the original change - cfb44c6528 - when
querying for the path of a file that did not contain a slash after the
drive indicator it would get the current path and return that as the path
that the file resided on.
However this meant that it would take the current path at that time which
may not be the actual path that was expected. So it was decided that
it should revert back to the original behavior which was to just return
the drive letter followed by the colon which would thus indicate still
that it represented whatever the current path was on that drive.
Change-Id: Ic57ae9227882a66e9a4c4d6537d7f2cae829165a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
MSVC 2008 is confused by TypeInStruct being a template, resulting in
\tst_qatomicinteger.cpp(189) : error C2027: use of undefined type 'QStaticAssertFailure<Test>'
with
[
Test=false
]
for int (and thus for all unsupported types). This appears to be a real
Heisenbug-nature compiler bug as it can also be fixed by adding
qDebug() << Q_ALIGNOF(TypeInStruct<T>)
before the static assert.
Task-number: QTBUG-37195
Change-Id: Ib2b60f3c1ffeb0b8bdeb1fb0c659655ce4ab10d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This causes frequent compiler errors on Windows CE.
tests\auto\corelib\global\qtendian\tst_qtendian.cpp(140) : fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'd:\orcas\compiler\utc\src\P2\main.c[0xCCCCCCCC:0xCCCCCCCC]', line 243)
Task-number: QTBUG-37194
Change-Id: I2adbc1e3b1896fbe86780aa26a15e918333a09f2
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
by default QT contains both core and gui already
Change-Id: I6f5b551104e40a024468e7cb62e302134e9472ec
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
These tests seem to fail because denormalized numbers are not
supported on QNX yet, so marking them as expected failures.
- floatDistance(denormal)
- floatDistance_double(denormal)
Task-number: QTBUG-37094
Change-Id: I79dbc78da6e9bef8466264fd2cab4af0ee8b868f
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
These tests seem to fail because denormalized numbers are not
supported on QNX yet, so marking them as expected failures.
- testNumbers_2()
- toJsonLargeNumericValues()
- parseNumbers()
Task-number: QTBUG-37066
Change-Id: Ifec95b936fb70253395dee4d1ca18e85870486a3
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
This is more consistent with e.g. qt.conf, where section names also
start with an upper case character.
Change-Id: I9ddaf72baeb9334d081807412512242d5d46cbbf
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Unit-test this by making the QList, QVector, QHash and QMap unit tests
be duplicated under strict-iterator mode. There's no test for
QLinkedList.
The tst_Collections test does not compile under strict-iterator
mode. It generated over 15000 errors when I tried.
The strict iterators required a small change: the difference_type
typedef needs to match the operators that get distances
(operator-(iterator)) and move the iterator around (+, -, +=, -=, etc.).
Task-number: QTBUG-29608
Change-Id: I834873934c51d0f139a994cd395818da4ec997e2
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Add a new QMarginsF class to complement QMargins in the style of
QSize/QSizeF and QRect/QRectF.
[ChangeLog][QtCore] Added class QMarginsF to support handling margins
with floating-point values.
Change-Id: Iaaa95ec85f5d126d9d864fc4b607241a8c8a8f3a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
So far we did bind the definition of Q_COMPILER_VARIADIC_MACROS to
C++11 (so gcc, clang will not define it in default gnu++98 standard).
However, variadic macros are a feature of the gcc preprocessor since
version 2.97, and are enabled in the default configurations on gcc, clang,
icc.
This might cause warnings and errors though if one enables additional
warnings in gcc, clang (e.g. by -pedantic). Anyhow, as a precedent
qglobal.h already relies on 'long long' ... The warning can be disabled
by adding '-Wno-variadic-macros'.
[ChangeLog][Compiler Specific Changes] Variadic macros are now enabled
more liberally for gcc, clang, icc. If you have warnings (because you e.g.
compile with -pedantic), disable them by -Wno-variadic-macros.
Change-Id: Ie979b85809508ad70cab75e6981f20496429f463
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This partially reverts 5764f5e6ea and
fixes the problem differently.
After this commit, "file:///foo" is still equal to "file:/foo", but
"foo:///foo" becomes different from "foo:/foo", as it should be.
Task-number: QTBUG-36151
Change-Id: Ia38638b0f30a7dcf110aa89aa427254c007fc107
Reviewed-by: David Faure <david.faure@kdab.com>
This is extremely useful, since the most common action after a failed
compare-and-swap is to loop around, trying again with the current
value as found in memory.
Code currently written as:
do {
Type value = atomic.load();
...
} while (!atomic.testAndSetRelaxed(value, desired));
Becomes:
Type value = atomic.load();
do {
...
} while (!atomic.testAndSetRelaxed(value, desired, value));
In most CPU architectures, the value that was found in memory is known
to the compare-and-swap code, so this is more efficient than the
previous code. In architectures where the value is not known, the new
code is no worse than before.
The implementation sometimes modified an existing function, sometimes
it added a new one, depending on whether more registers were needed in
the assembly (like ARMv6-7), the code became more complex (ARMv5), the
optimizer failed (C++11), or it was just plain equivalent (MIPS).
Change-Id: I7d6d200ea9746ec8978a0c1e1969dbc3580b9285
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This implementation is based on GCC's implementation of std::hash<FP>, but only
to the extent of checking for zero before hashing the bits. The bit hasher is
the Qt one; I didn't even look what GCC uses.
The check against 0.0 is mandated by the requirement to have
\forall x,y: x == y => qHash(x) == qHash(y)
which would be violated for x = 0.0 and y = -0.0 if we only hashed the bits.
Implemented out-of-line to avoid potential FP-comparison warnings, as well
as to be able to use the file-static hash() functions, which gets inlined
unlike qHashBits(), which cannot be.
[ChangeLog][QtCore][QHash/QSet] Allowed to use float, double and long double
as QHash/QSet keys.
Change-Id: I38cec4afb860f17e9f8be7b67544e58b330f8fff
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
This test can assume that the QObject::signalsBlocked property works as
advertized, so just check signalsBlocked() in repsonse to QSignalBlocker
manipulations.
Change-Id: I99e4ef9c4ed05c3840233d92a587636d2d78f59a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Change 85e57653 caused a compile error for code that does
Q_DECLARE_LOGGING_CATEGORY(cat);
//..
qCDebug(cat()) << // ...
error: C3848: expression having type 'const QLoggingCategory' would lose
some const-volatile qualifiers in order to call 'QLoggingCategory
&QLoggingCategory::operator ()(void)'
This is a regression from Qt 5.2. Fix the error by adding a const version
of operator()().
Change-Id: I2fb04f2e155962adee0f98089fc5a159000bef56
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Added basic functionality to socket for WinRT. Even though not
all auto tests pass yet, this patch can be seen as a foundation
for upcoming work in this area. Reading from and writing to TCP
socket works and one can listen for tcp connections.
Change-Id: Id4c25ba1c7187ed92b6368c785c4f62837faded7
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Conversion from UTC to local time will result in same datetime value,
if local time is in UTC.
Change-Id: Icd4ea57cb46cc97bcc8fce4f4e579bf64a4d4b10
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
It was not possible to get the actual process ID (in a cross-platform
manner) from QProcess, as the user would need to handle the returned
typedef (Q_PID) differently on Unix and Windows.
On Unix Q_PID is the actual process ID, but on Windows it's a pointer
to a PROCESS_INFORMATION structure, which among other fields contains
the process ID. Instead of returning a pointer on Windows,
QProcess::processId() will return the actual process ID on both Windows
and Unix.
[ChangeLog][QtCore][QProcess] Added processId() to QProcess. This
function will, unlike pid(), return the actual process identifier on
both Window and Unix.
Task-number: QTBUG-26136
Change-Id: I853ab721297e2dd9cda006666144179a9e25b73d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Initial submission of a new class QByteArrayList with the
purpose of aggregating and then joining QByteArray instances.
[ChangeLog][QtCore] Added new QByteArrayList class.
Change-Id: I2a9dc71ff7aadb19ebc129a0d47ac8cd33895924
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Allow configuration of logging rules from outside of the application,
either through a configuration file (.config/QtProject/qtlogging.ini),
or through a file specified by a QT_LOGGING_CONF environment
variable.
The logging rules from the different sources are concatenated: First
the rules from QtProject/qtlogging.ini are applied, then
QLoggingCategory::setLoggingRules(), finally from the environment.
This allows an application to overwrite/augment the system wide rules,
and in turn that can be tailored for a specific run by setting a
configuration in the environment variable.
[ChangeLog][QtCore][Logging] The logging framework can now be configured
with an .ini file.
Change-Id: I442efde1b7e0a2ebe135c6f6e0a4b656483fe4b1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Passing a constructor as second argument to foreach didn't work when
building with gcc.
For MSVC this already worked as a different foreach implementation is
used.
Change-Id: Id98444c699b4cebc14ea62076c5f7cba33ffb824
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
The debug output of all categories will be visible by default,
except from the "qt.*" categories. "qt.*" categories are private
and their default debug output will be hidden.
[ChangeLog][QtCore][Logging] Enable qCDebug's for all categories except qt one's
Change-Id: Ibe147c8bbe0835a63b3de782288b9c3251321d8f
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
The basedir xdg spec says:
"All paths set in these environment variables must be absolute.
If an implementation encounters a relative path in any of these variables it
should consider the path invalid and ignore it."
Therefore we ignore relative paths including the empty string.
Change-Id: I8f779b78981018051b16de23b2514f2e62b7ab39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The slot object was deleted after the mutex was relocked, which caused
a deadlock in case the functor destructor locked the same mutex again.
Change-Id: I5b4fb22fdb4483f91c89915872bfd548c31b0eea
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Code units 0xD800 .. 0xDFFF are not UCS-4, so we can't happily return them.
Instead, if we encounter a stray surrogate, replace it with 0xFFFD, which
is what Unicode recommends anyhow.
References:
§3.9 Unicode Encoding Forms
D76: Unicode scalar value: Any Unicode code point except high-surrogate
and low surrogate code points.
As a result of this definition, the set of Unicode scalar values consists
of the ranges 0 to D7FF_16 and E000_16 to 10FFFF_16, inclusive.
[...]
UTF-32 encoding form: The Unicode encoding form that assigns each Unicode
scalar value to a single unsigned 32-bit code unit with the same numeric
value as the Unicode scalar value.
§ C.2 Encoding Forms in ISO/IEC 10646
UCS-4. UCS-4 stands for “Universal Character Set coded in 4 octets.” It is
now treated simply as a synonym for UTF-32, and is considered the canonical
form for representation of characters in 10646.
§ 3.9 Unicode Encoding Forms (Best Practices for Using U+FFFD)
and
§ 5.22 Best Practice for U+FFFD Substitution
Whenever an unconvertible offset is reached during conversion of a code
unit sequence:
1. The maximal subpart at that offset should be replaced by a single
U+FFFD.
2. The conversion should proceed at the offset immediately after the
maximal subpart.
[...]
Whenever an unconvertible offset is reached during conversion of a code
unit sequence to Unicode:
1. Find the longest code unit sequence that is the initial subsequence of
some sequence that could be converted. If there is such a sequence, replace
it with a single U+FFFD; otherwise replace a single code unit with a single
U+FFFD.
2. The conversion should proceed at the offset immediately after the
subsequence which has been replaced.
[ChangeLog][QtCore][QString] QString::toUcs4 now does not return invalid
UCS-4 code units belonging to the surrogate range (U+D800 to U+DFFF)
when the QString contains malformed UTF-16 data. Instead, U+FFFD
is returned in place of the malformed subsequence.
Change-Id: I19d7af03e749fea680fd5d9635439bc9d56558a9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>