Commit Graph

107 Commits

Author SHA1 Message Date
Olivier Goffart
21426f281e moc: parse properly the gcc extension for variadic macro
Task-number: QTBUG-27547

Change-Id: I983b96b09c405e5330327092e56164b9921a2d0f
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-10-14 20:53:42 +02:00
Simon Hausmann
9ab8c0ae98 Fix moc preprocessor-only mode with input that contains seemingly invalid identifiers
In WebKit we use moc -E to pre-process various files before throwing at
further build creation tools. The pre-processing is used to filter out
code depending in #ifdef'fed features.

The latest addition to the family of pre-processed files is the CSS grammar,
which is written in Bison. It contains rule lines like

   $$ = parser->createFoo()

and when pre-processing this moc stumbles over the dollar sign. Instead
of ignoring un-tokenizable input we should add it to the current token
if we're in preprocessor-only mode, otherwise the $$ gets eaten and we
produce data-loss by printing out less characters than.

Change-Id: Ib32e7c04b38dd2ba3726201e76f27405f7ea6c0d
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-10-13 05:51:19 +02:00
Friedemann Kleint
274c258521 Use jom in tst_qmake.
Speed up compiling the tests.

Task-number: 26023

Change-Id: Ib5e872cc6cde09ac90f426a8f6e7cfea509d02e2
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-10-08 08:46:21 +02:00
Friedemann Kleint
8924506992 Increase tst_qmake more time on Windows.
The test compiles examples, which takes a long time.

Task-number: 26023
Change-Id: If794b046aa07737f3076aace8d585dc44027cc6b
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-10-08 08:46:07 +02:00
Simon Hausmann
310031188c Fix moc stumbling over gcc __attribute__ extensions
Reported by David Faure.

In KDE a DEPRECATED macro gets defined in a header file created by cmake.
The define is not guarded with #if Q_CC_GNU or similar because at cmake
time the compiler is determined. Therefore moc suddenly sees this gcc
specific token and stumbles over it.

This patch simply defines an empty __attribute__ macro that will expand
to nothing and thus become invisible to moc's "C++ parser" after the
pre-processing.

Change-Id: I4448b9ac3f72b6334e32b27484401fb0fca23a0c
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-10-01 14:27:14 +02:00
Lars Knoll
6ddef0007a Test case for moc handling defines
Added some test cases that check that moc
correctly expands #defines

Change-Id: I7fe6eed129d46ca9281d73064571cae43b32410d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-09-25 00:08:16 +02:00
Iikka Eklund
be15856f61 Change copyrights from Nokia to Digia
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>
2012-09-22 19:20:11 +02:00
Oswald Buddenhagen
0e78e50802 port qmake to qt creator's qmake language evaluator
this is a monster commit which does the following things:
- import the evaluator as-is from qt creator into qmake/library/
  - integrate it into qmake's makefiles
  - overwrite proitems.h with actual special types
- remove the parts of Option which are redundant with QMakeGlobals
- make QMakeProperty a singleton owned by Option::globals. the dynamic
  handling so far made no sense.
- make QMakeProject a subclass of QMakeEvaluator, with relatively few
  extensions

the changes to existing qmake code outside project.* and option.* are
minor. implementing the changes gradually would mean changing a lot of
code which will be just replaced in the next commit, so i'm not wasting
my time on it.

Change-Id: I9746650423b8c5b3fbd8c3979a73228982a46195
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-09-11 00:13:01 +02:00
Sergio Ahumada
faaa866961 test: Remove QSKIP from tst_uic::stdOut()
This test actually passes on Windows, so removing the QSKIP

Task-number: QTBUG-26730
Change-Id: Ife1b5bd0ffa20c433070a1875dde8b6a226c331a
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>
2012-09-10 23:58:46 +02:00
Simon Hausmann
0c0c04b405 Fix semantics of the src dir in the include search paths with MinGW
This issue originates from https://bugs.webkit.org/show_bug.cgi?id=95736

Suppose we have
    main.cpp
    somedirectory/someheader.h -- which has #include "anotherheader.h"
    anotherheader.h

With unix generator, the directory where main.cpp is located is included,
unless no_include_pwd is set. Hence the look-up of anotherheader.h from
within someheader.h will work.

With MSVC this works because MSVC looks "in the directories of any
previously opened include files in the reverse order in which they were
opened." (from http://msdn.microsoft.com/en-us/library/36k2cdd4.aspx)

Unfortunately the build breaks with MinGW, because it lacks support for
including the source directory in the include search path just like the
unix generator does.

This patch adds the same functionality to the MinGW generator as well as
an auto-test.

Change-Id: Iea8bb06e34862c51b8fd4eca2ee26668e24a319a
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
Reviewed-by: Jonathan Liu <net147@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-09-10 14:09:45 +02:00
Rafael Roquetto
3d4fc578bd Auto test for 'qmake -project' use case.
Change-Id: Ifb6d64828ba1cb42fd64299438b7eec302112edf
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-09-04 10:30:33 +02:00
Stephen Kelly
5a1fa8860c Generate includes for Qt containers used as auto-metatypes.
Otherwise the containers might be forward declared in the moc file,
and when the moc file is compiled in a standalone translation unit,
the full definition of it would not be available. This results in
odd compile errors, so instead generate the includes if required.

Change-Id: Ie01c5a5d45314daad0b00dec03b3e1e18cdbae64
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Volker Krause <volker.krause@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-09-03 20:05:04 +02:00
Volker Krause
8c1cb66712 Fix moc generating invalid code for slots with reference types as argument.
We can't have T& declared/registered as a metatype (wont compile), but
using it as type for a slot argument is possible. With the recent
introduction of metatype auto-registration we have to make sure that moc
doesn't attempt to auto-register those. Simple types are handled correctly
already, this fixes containers and smart pointers.

Change-Id: Id96857c57d6ebf158a67e9d527c89dc195473b1b
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-09-02 23:41:42 +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
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
Rafael Roquetto
0fa52909fd Remove relic QT_VERSION from qmake test
Change-Id: Ic9095e3e924543d4f3e6d0f7c3a7b27f842cd300
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-08-14 03:56:55 +02:00
Friedemann Kleint
95bba3802b uic-Autotest: Remove SRCDIR-define, add stdout-test.
- Replace SRCDIR define by QFINDTESTDATA, simplify code.
- Introduce a test for stdout mode that verifies the newline
  convention.
- Use a temporary directory as not to clobber the
  test directory and introduce an environment variable
  UIC_KEEP_GENERATED_FILES to keep them for error
  analysis.

Task-number: QTBUG-26730
Change-Id: I22e3bb5a9ca92a1977c29b165ea605f1017baa02
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-08-02 20:38:54 +02:00
Thiago Macieira
672b5b7ab6 Set the Qt API level to compatibility mode in all tests.
Qt 5.0 beta requires changing the default to the 5.0 API, disabling
the deprecated code. However, tests should test (and often do) the
compatibility API too, so turn it back on.

Task-number: QTBUG-25053
Change-Id: I8129c3ef3cb58541c95a32d083850d9e7f768927
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-08-01 15:37:46 +02:00
Oswald Buddenhagen
e07372ff50 fix host vs. makefile directory separator mess
the system path separator and shell are bound to the host system
(system() will use cmd even on mingw with sh.exe in path).
the makefiles otoh may depend on what the qmakespec defines.

consequently, add $$system_path() and $$system_quote() (for use with
system() & $$system()). $$native_path() is renamed to $$shell_path() and
should be used with $$shell_quote() to produce command lines in
makefiles.
$$QMAKE_DIR_SEP needs to be applied to Option::dir_sep right after
parsing the spec, so it is available to $$shell_{path,quote}().

Change-Id: If3db4849e7f96068cf03a32348a24f3a72d6292c
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2012-07-28 00:09:45 +02:00
Stephen Kelly
6f540691c4 Add some tests to note that private signals can't be overloads.
This is just for completeness of the understanding of the limitations
of private signals. There are no private signals in Qt which have
overloads.

Change-Id: Ic34c555aea360ee34beec796e597657888573da9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-13 19:21:55 +02:00
Stephen Kelly
0efa445141 Create a way to inform moc about private signals.
Moc checks for the use of the QPrivateSignal struct, which is part of
the Q_OBJECT macro and is private to each class that uses it. Moc then
generates a name of the signal which does not include the private
struct, and generates code to invoke such signals with an instance of
the private struct.

This way we can mark private signals as such and prevent them from
being emitted from subclasses or from outside of the class entirely.

The drawback to this is that it only works if the private
signal has no default arguments. However, at least in Qt, there are
no such signals.

Change-Id: Id16eadaa8d3c36a2c3b265077877f3e1d8304c84
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-13 01:51:42 +02:00
Oswald Buddenhagen
2a973c031a test behavior of $${absolute,relative}_path() with empty 1st argument
Change-Id: I76c0853a9d397979f2ae5eb780374d2380c989f1
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-07-12 17:19:09 +02:00
Stephen Kelly
bcf6333c6f Update the moc no-keywords test for the signals replacement.
Change-Id: I5c544e71615b00ff8fd337579fcd185e4b8e24af
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-09 15:55:15 +02:00
Stephen Kelly
6bd4be9436 Uppercase the CONFIG for verbatim mode.
Change-Id: Iec883e0218af80fc329d866affb2b95db72c54d3
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-07-04 15:52:00 +02:00
Matthew Vogt
10edf63174 Revert "Allow moc to handle symbols that have been redefined."
This reverts commit 5bb1408927.

The temporary measure used to support redefinition of QtDeclarative
class names during the transition period is no longer required.

Task-number: QTBUG-24517
Change-Id: Ib90f08fcdfb02e004e594ac72b698eaa0325d98d
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-07-04 00:48:44 +02:00
Oswald Buddenhagen
16785c4c14 do not unnecessarily mess with CONFIG
it could/would bite us later

Change-Id: I73f989e7603c6e5b7b85fc4ee4ad2557c1b02d80
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2012-06-27 09:39:01 +02:00
Oswald Buddenhagen
ed96d199f1 fix somewhat common edge case in $$shadowed()
if source and build dir are direct children of the common root and we
are shadowing the top-level source dir, there is of course no trailing
slash to match.

Change-Id: I8a34a6a72d16cb21d77d056e037235af9b32a008
Reviewed-by: Davide Pesavento <davidepesa@gmail.com>
Reviewed-by: Andreas Hartmetz <ahartmetz@gmail.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-06-26 08:14:17 +02:00
Bradley T. Hughes
cf7c93b928 Change *-clang mkspec globs to *-clang*
Like with the numerous g++ mkspecs, we have mkspecs with suffixes, and
these mkspecs should still match the clang globs.

Change-Id: I9296408b5192bc72cc468d229a57923e3f5ab6f0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-06-20 15:45:07 +02:00
Mitch Curtis
f74b26b6aa Fix unused parameter warnings in moc test.
Change-Id: I3467a8bf99464c2d3762a171b20508bb4b29ddb4
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-06-20 15:45:07 +02:00
Oswald Buddenhagen
c85dc033dc add $$reverse() function
returns the list with the order of the elements reversed.
one can easily implement this with existing functions, but this is way
faster and more readable.

Change-Id: I12d306eb9fe58fc332622274ea6b658192529491
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-06-19 16:39:57 +02:00
Oswald Buddenhagen
083f7c501f add $$shell_quote() function
to be used in system() calls and when assembling EXTRA_COMPILER and
INSTALLS .commands by hand.

Change-Id: Id706cd56aa267a9fb4b14e3416692b4716fafa5b
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-06-19 16:39:57 +02:00
Oswald Buddenhagen
09e01856b0 add $$absolute_path() and $$relative_path()
just exposes QDir::fooFilePath() wrapped into QDir::cleanPath()

Change-Id: I7a7644084825fd8092a9910ac20f695c4d9351f6
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-06-19 16:39:57 +02:00
Oswald Buddenhagen
d8e6c49bfa add $$native_path() function
more or less QDir::toNativeSeparators(QDir::cleanPath())

Change-Id: I52deee1e8086559eda5833b387a0cf64d21cbcd9
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-06-19 16:39:57 +02:00
Oswald Buddenhagen
f97913f2da add $$clean_path() function
just QDir::cleanPath()

Change-Id: I2d51e2385939d8926c00f296537ab7f6757d9a79
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-06-19 16:39:56 +02:00
Oswald Buddenhagen
1261c9b2f4 add $$format_number() function
Change-Id: I04266c1f5fb72af94073f3f508cee59085e365b6
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-06-19 16:39:56 +02:00
Oswald Buddenhagen
bf984d5f24 add $$shadowed() function
return the build directory corresponding to a given source directory.
this is the identity function if not shadow-building. if input lies
outside the source directory, return empty value.

Change-Id: I2d2a6b1112bd19989fe29cfe19a12d39a0d208c1
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-06-19 16:39:56 +02:00
Oswald Buddenhagen
6a66fef520 add $$val_escape() function
this quotes the elements of a variable in a way suitable for re-parsing
as qmake code.

Change-Id: I0e6ea2478c43b5aeff45f485a48ac8c86705dd4a
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-06-19 16:39:56 +02:00
Oswald Buddenhagen
7da934d776 add mkpath() function
Change-Id: I8809b9ee4e85fbe8cec95641d659f237c5f51a26
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-06-19 16:39:55 +02:00
Oswald Buddenhagen
84614cabfa add write_file() function
this dumps the contents of a variable into a file. each element of the
variable is considered a line; line terminators are added. all missing
directories are automatically created.

Change-Id: Idafeb873cea64e6705c894b3ab0ef21df69e7170
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-06-19 16:39:54 +02:00
Rohan McGovern
1668c47608 Replace QTEST_APPLESS_MAIN with QTEST_MAIN in tests using QProcess
QProcess requires an application object to be created in order to work
correctly on Windows.

Task-number: QTBUG-26023
Task-number: QTBUG-26024
Change-Id: Ifa90946262bc7e2a7df6b6aad54e10b54473fc97
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-06-05 06:12:20 +02:00
Rohan McGovern
f21832a465 Marked tst_qmake as parallel-safe
This autotest fails a parallel-stress test because it writes into its
own source/build directory.  However, by inspection, it appears not
likely to cause issues with any tests other than itself.

Change-Id: I13789ba14bab240d34c22c5b77d6407995423afc
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-05-29 09:39:18 +02:00
Rohan McGovern
177070cb7b Add CONFIG+=parallel_test to suspected parallel-safe tests.
These tests have passed a parallel stress test on all three of Linux,
Mac, Windows.  Mark them with CONFIG+=parallel_test to allow CI to run
them in parallel, saving time.

Change-Id: I19fd333c3c645a67374ca998f6c8530dd236b0f8
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-05-28 07:33:01 +02:00
Lars Knoll
7968543bb0 Don't use the deprecated translate() method anymore
The Encoding argument of QCoreApplication::translate()
is deprecated and source code is always assumed to be
encoded in Utf8. Simply remove the encoding argument
from the generated .ui.h files.

Change-Id: If6c40f6df13abd45a0303c863077972c3d1fb685
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-05-18 22:38:55 +02:00
Thiago Macieira
a637a5ae29 Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtDBus]
This operation should be a no-op anyway, since at this point in time,
the fromAscii and toAscii functions simply call their fromLatin1 and
toLatin1 counterparts.

Task-number: QTBUG-21872
Change-Id: I052a3412a568ad639f2bf169b4491b56dddff1c7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-05-07 05:05:30 +02:00
Thiago Macieira
fba4d96750 Change remaining uses of {to,from}Ascii to {to,from}Latin1 [other]
This operation should be a no-op anyway, since at this point in time,
the fromAscii and toAscii functions simply call their fromLatin1 and
toLatin1 counterparts.

Task-number: QTBUG-21872
Change-Id: Ib1eaf42679ab5db4005192c3d00ba79e43edfcca
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-05-04 12:48:06 +02:00
Lars Knoll
1e49914fee Merge remote-tracking branch 'origin/api_changes'
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
2012-05-03 12:26:09 +02:00
Debao Zhang
ade8888603 Don't use obsolete qVariantValue, qVariantCanConvert, etc.
qVariantValue and qVariantCanConvert are Compatibility members, while in
Qt4.8 they are marked as Qt 3 Support Members.

qVariantFromValue and qVariantSetValue are Obsolete members.

Change-Id: Ie8505cad1e0950e40c6f6710fde9f6fb2ac670fd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-05-02 08:30:59 +02:00
Olivier Goffart
67f58040ea Remove QMetaObjectExtraData and put everything into QMetaObject
QMetaObjectExtraData was added when support for QMetaObject::newInstance
was added. One needed a place to put the pointer to static_metacall in
the QMetaObject.

But as we break binary compatibility, one can change the size of
QMetaObject, and put everything back inside QMetaObject's own structure.
Meaning it is not required anymore to have one QMetaObjectExtraData
instance per QMetaObject anymore.

Change-Id: If0b8f586cbaf633eed10045adee3ba3366826c86
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-04-25 20:19:29 +02:00