Do not pass /Za to MSVC to generate moc_predefs.h, because this option
is incompatible with compiler options like /fp:fast that may be
user-specified.
The /Za option added, because moc failed parsing header files that
contain MSVC extensions. Moc was fixed in 94a2aec0, and we can safely
remove the /Za option.
Task-number: QTBUG-58391
Change-Id: I9791224b1773d0f81d2bbb7915787a7c5e68430c
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
there isn't really a point in doing strict shadow builds of them, and
it complicates stand-alone building of sub-projects (because it points
below the build root).
Task-number: QTBUG-58372
Change-Id: Ia3bde3826baac44749b27452fd4aeb9491ecb94e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
... and rename those determined by toolchain.prf to QMAKE_* (this was
already the case for the newly introduced msvc and icc variables).
this restores the ability for user projects to query the toolchain qt
itself was built with, which is necessary for compatibility checks.
in fact, we may do such validation in toolchain.prf itself at a later
point.
Change-Id: I35f4c393c5e4e0fe987c0844714b7a8f8687c24e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
The Linux kernel gives us 16 bytes of random data and sets a pointer to
it in the ELF AuxV (the same one that allows us to get HWCAP on ARM
systems). So if we end up in the fallback generator, at leat we'll get a
good amount of entropy to seed the Mersenne Twister.
This could happen if the application is run in a chroot(2) or container
without /dev/random or /dev/urandom. That is probably an installation
mistake, so we don't optimize this case for performance.
With this commit, we have now good, high-quality fallbacks for Windows
(rand_s), for BSDs (arc4random) and for Linux. The only missing,
supported OS without a good entropy source is QNX.
Change-Id: Ia3e896da908f42939148fffd14c5b1084051f1a8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
If we've never read any samples from hardware RNG or from /dev/urandom,
then there are no stored samples for us to seed the Mersenne Twister. In
that case, attempt to obtain an emergency sample that consists of some
random bits from the variable addresses (ASLR should help) and from the
clock (using nanosecond quality, instead of seconds).
There's still the possibility that we'll get poor entropy: very close to
boot, if the kernel entropy pool is empty, ASLR could be poor and the
monotonic clock value could be consistent from boot to boot. There's
nothing we can do about that.
Change-Id: Ia3e896da908f42939148fffd14c5b0c7b608371b
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This function works even in chroots where /dev is not available. Since
it's part of the OS, it may have better ways of gathering entropy even
when we don't.
Change-Id: Ia3e896da908f42939148fffd14c5afedc8569dbc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit adds support for the x86 RDRAND instruction for
QRandomGenerator. This is the same that libstdc++-v3 uses for
std::random_device() by default. If it fails because the hardware does
not have enough entropy collected, we fall back to the operating system
generator, which often has more entropy collected from other sources.
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5167214e1ea3f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The instruction is "RDRAND", but the feature name, according to GCC, is
RDRND, so I had to change some macros in qsimd_p.h.
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5166779137e63
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QRandomGenerator can produce more than 31 bits of data. And it uses
/dev/urandom for us on Unix, so QHash does not need to duplicate that
part.
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b52a0d91f179eb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
First and most importantly, let's not use more than half of the template
for the application's PID. With over 71% of all PIDs on a typical Linux
system and 90% of those on a Darwin system having 5 decimal digits,
using them all in a template that is usually 6 characters long is
wasteful. That leaves only 1 character for the random part, thereby
reducing the number of temporary files possible to only 52. So limit the
PID to half the characters of the template.
Second, let's use QRandomGenerator::bounded to create the the random
part, instead of qrand (which is often unseeded at this point).
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b52eda5e467395
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This class provides a reasonably-secure random number generator that
does not need seeding. That is quite unlike qrand(), which requires a
seed and is low-quality (definitely not secure).
This class is also like std::random_device, but better. It provides an
operator() like std::random_device, but unlike that, it also provides a
way to fill a buffer with random data, not just one 32-bit quantity.
It's also stateless.
Finally, it also implements std::seed_seq-like generate(). It obeys the
standard requirement of the range (32-bit) but not that of the algorithm
(if you wanted that, you'd use std::seed_seq itself). Instead,
generate() fills with pure random data.
Change-Id: Icd0e0d4b27cb4e5eb892fffd14b4e3ba9ea04da8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The test fails as sendmsg() on the socket trying to deliver a packet to
the IPv6 link-local fe80 address returns with -ENETDOWN. I cannot figure
out why this happens when RHEL 6.6 is run under qemu/kvm but not under
vmware. More details are in the task, but meanwhile the result of this
test is ignored.
This affects only RHEL 6.6, it passes on RHEL 7.2.
Change-Id: I4ade5cd249dd0d1901368ab571dad324e0fd10c2
Task-number: QTQAINFRA-1042
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Use python more fluently; DRY - use functions to avoid repetition; use
dict-comprehensions; use os.path.join() in preference to arithmetic
with path strings; use elsif to avoid the need for a local variable;
set() can take a generator directly, no need to go via a list; don't
end lines in semicolon (this is python). Test isdir() once instead of
exists() twice on the same name.
Just, generally, use python's feature-set.
Change-Id: Ib114aa016f70b3be09e968d9cfc069b057f49d41
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
load{Language,Script,Country}Map() were all structurally very similar,
so replace them with a single loadMap() that takes a second argument
to say *which* map to load. At the same time, use a dict
comprehension to simplify constructing the result.
Change-Id: Ie43a71156010277200543a8937056efd35251955
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This simplifies a duplicated iteration pattern in the calling code.
It also frees the first-node function to raise an Error (which the
iterator now catches) if it finds no node, where it used to return
False (instead of a node, so other code using it would raise confusing
errors from trying to use False as a node, where now it'll get a clear
Error about a missing node). There were also no callers passing an
empty name, so the test for matching nodes (here moved to its own
short function) didn't need to handle that as a special case.
Change-Id: Ife6cad8943cf5dc2c6ed68429d4a217cb9bea446
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
It had a separate variable for each of three lists for each day of the
week; and used each list only once. Iterate the days of the week for
each lookup, discarding it once used.
Change-Id: I32c8bd5bfcbb99f0a8697d374e63112761f18dbb
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Each StringData object got its own block, of common form, to output
its C array; give each object a name so that we can automate this as
an iteration over StringData objects. One (endonyms_data) gains a
blank line that the others all had but it lacked.
Change-Id: I96c014728a58343c82304c5117b474fee980d9c7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
... because copy-and-paste is worth discouraging. Moved code that
writes and digests our Q Local XML form of the data into a common
class, localexml.Locale, for use by the scripts that write and read
it. Hopefully, it'll be easier to keep what's written and read in
sync hereafter.
Inlined some trivial functions in the process; and only create a
day-number mapping dictionary once, instead of once per use. Also
made it easier to see which attributes get which special handling (and
documented this); and revised an assertion to be more helpful.
Change-Id: I711b6a193a4ad94b5ff714c025f2732cd1a965a7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
To avoid repetition, remove the individual style gallery topics.
Add images of the Styles and Calendar widget examples and use
them instead of individual images of each widget.
Task-number: QTBUG-5894
Change-Id: I1231824df60e39e8fb89ac2a764e12151636c019
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Move at-spi dbus xml definitions into platformsupport, these files
simply describe the DBus protocol and should not be in 3rdparty.
The header files can just as well be picked up by pkg-config.
Change-Id: I326d9b3cb69223bf2c8646099f211d9a9f3fa0af
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We need to actually run the linker, otherwise clang will just
run the preprocessing step as we asked for. We build as a shared
library to not have to provide a main() function.
Change-Id: Ied34757bb5c43a862bf2d9778340c497b93d572f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The call does nothing as it's always called from the Android thread,
meaning there are no events, or even eventloop.
Change-Id: I6c03b6ebe74bc52af45bc295b42aa01ad6d51157
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This is amends commit 9091a058bc to make sure we don't drop
geometry updates that are set before the platform plugins is ready.
Task-number: QTBUG-60963
Change-Id: I4489eb9329bb8983458ad328a43b85382bba3cf6
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Include headers for all fields (several were missing).
Make field widths explicit to headers can line up with content.
Use the same format for the (common part of the) all-zeros line.
Document and lay-out headers and format string, to make them easier to
keep in sync. Make a pair of comments clearer.
Re-ran the script to regenerate the table: the result is best viewed
with git show -w, to ignore the spacing changes (or git show -b to
notice only the one harmless discrepancy exposed in old all-zeros
data). Aside from spacing, locale_data[] has gained some missing
columns in its header comment, which now lines headings up properly
above actual data.
Change-Id: I44242f38391353f2ec8e144cb7e8b54b0a359341
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Say where to find the scripts and make clear what to update to get
changes.
Change-Id: I424b7fdf846f7141c6df81eef90eb1ca0378bcf8
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Make the python2 dependency explicit (sooner or later, python3 shall
be the default /bin/env python), make time-zone script executable (it
had a shebang). Use triple-quoted strings, or single quotes, to avoid
extra backslashes, remove some simply spurious backslashes. Use
generators rather than map or filter with lambdas and iterate rather
than duplicating code. Clarify some comments.
Regenerated headers: this upates the date of generation, cuts back a
double-blank-line to single and skips a spurious trailing
comma-newline on an array's data.
Change-Id: I54439f0dec132865991fe5147d509cea0f9419a0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
We were using "Han With Bopomofo" (capitalized With) so that an enum
member in qlocale.h would be suitably camel-case; however, this lead
to spurious changes in qlocale_data_p.h where it names the script.
Use the correct (lower-case with) form and arrange for the enum
members to be generated with first letter of each word upper-case (but
not with each word capitalize()d; some words in there are already
camel-case, so .capitalize()ing would lower-case the later sub-words
in these).
Change-Id: I974c89dd40814eaf3bd538f06b9b4ebf17492f20
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Say where to find the data, how to unpack it and how to run the
scripts to update our source tree from it.
Change-Id: I5b680090bb5850f29c1e7d61efd1d450856b9949
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Rearranged existing top-level example to let the ci example make some
kind of sense.
Change-Id: I0a5dd6270aef419c8a33d390c801460f23e10667
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
When an archer lets go of the bow-string, she looses an arrow; when
the hounds are straining at their leashes and the handler lets go, he
looses the dogs. It's archaic usage now; we'd normally say "lets
loose", "lets go" or "releases". In any case what was meant here was
that something got lost; a widget loses focus or a network loses its
connection.
Change-Id: Ic1fbe9e1f76185bcb7caf034d6be97ebfeb2e270
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Martin Smith <martin.smith@qt.io>
A QFreeList's MaxIndex is clearly meant to be the sum of its Sizes;
but the parentheses in MaxIndex - (16 - 128 - 1024) doesn't give the
same as without the parentheses. Noticed while reviewing a copy of
this code now used by QReadWriteLock (which has this fix).
Change-Id: I9f68171475b3c6edc18896056b5532183fee92b2
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Due to popular demand. It does have it benefits (especially when
it comes to convenience) to allow grabbing QOpenGLWidgets even
when they are not part of an actual window and are not actually
visible.
Does not involve much more than dropping the warnings and bailouts
when there is active native window (because the QOpenGLWidget/its
parents are still hidden).
In addition the device pixel ratio from metric() has to be fixed
as well.
[ChangeLog][Qt Widgets] QOpenGLWidget is now able to render and
return its content via grabFramebuffer(), QWidget::grab() or
QWidget::render() even when the widget has not been made visible.
Task-number: QTBUG-47185
Task-number: QTBUG-61280
Change-Id: Icc2b0b3ce9778a3eb6409d54744238568abb0f0d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Makes it easier to pull out data from a document when the structure is
known up front, while still supporting default values if the structure
does not match the expectation, eg:
int age = QJsonDocument::fromJson(ba)["users"][0]["age"].toInt(-1);
Change-Id: Ief0899bbb81610f6f22a56e2ac846121bffe77a0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Saves a lot of manual toArray() and toObject() calls when the
JSON structure is usually known anyways. Read only access for now.
Change-Id: I5fd787144198e0443e4da285a11ce2597b66f99f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
All code paths leading up to this line unconditionally dereference the pointer,
so it cannot be nullptr.
Remove the check. It only confuses readers of the code and probably will trigger
warnings with tomorrow's compilers.
Change-Id: I31a643738e951da9c04f0091645016276b047761
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
QTimeZone("UTC") should be valid, as "UTC" appears in the list of
availableTimeZoneIds(), and tst_QTimeZone::dataStreamTest() constructs
timezones like this, which are considered valid.
The internal representation of a QTimeZone("UTC") as created by
QTimeZone::QTimeZone(const QByteArray &ianaId) is a QUtcTimeZonePrivate
which isValid(), so the containing QTimeZone isValid() too.
When QTimeZone is serialized into a QDataStream, it calls
tz.d->serialize(ds) which is QUtcTimeZonePrivate::serialize. This
writes QStringLiteral("OffsetFromUtc") followed by the IANA ID and
the offset (etc.) to the datastream.
When QTimeZone is deserialized it looks for this marker string, and if
present, it passed all of the parameters to the QTimeZone constructor
(not just the name). However, that constructor does not support standard
IANA timezones (only custom ones), and when it detects that the supplied
IANA ID is actually listed in availableTimeZoneIds(), it leaves the
pointer to the QTimeZonePrivate uninitialized (NULL), which leaves
the QTimeZone invalid (isValid() returns false).
Thus, a valid timezone which was serialized and then deserialized has
become invalid. This also affects serialization of QDateTimes with
timezones.
Fixed by calling the name-only constructor first, which works (only) for
IANA standard timezones and leaves the QTimeZone invalid (isValid()
returns false) otherwise. In which case, we can call the many-argument
contructor to create a custom timezone with the same offset as the one
which was originally serialized.
[ChangeLog][QtCore][QTimeZone] Fixed sending IANA standard UTC-offset
QTimeZones through QDataStream, which previously came out invalid after
deserialization.
Task-number: QTBUG-60595
Change-Id: Id9c47e8bda701faae4d800e012afb6db545b2fe9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
It is possible that tmpdir already exists as a leftover from previous
tests. That is no reason for the test to fail.
Change-Id: I010633fb92defb064093af9872ae6fd2178f07dd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
load(resources) makes embedding the test data into the executable
fail for platforms that use builtin test data. As the load call
is only used to obtain QMAKE_RCC we can avoid that call by
assuming that rcc was not renamed and assembling the path ourself.
Change-Id: I25b982d10f5617d9a213803e7e4bcc85fc66b2e7
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
'accel' is 'str.toLower()' and as such may have a different size, so don't
use str.size() to index into 'accel'.
Change-Id: I6a140ded45ecedd811b9618e1facb63d522eb235
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>