summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsharedpointer/externaltests.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-06-25 19:01:24 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-07-02 11:48:20 (GMT)
commit6f673e2cf55755a97aeb8971994ab9fc62fb794e (patch)
treef075a45e9fd6a18cfde96fd28069b719be743532 /tests/auto/qsharedpointer/externaltests.cpp
parentfb51a10ee0451274a430227566ae26efb2ac4474 (diff)
downloadQt-6f673e2cf55755a97aeb8971994ab9fc62fb794e.zip
Qt-6f673e2cf55755a97aeb8971994ab9fc62fb794e.tar.gz
Qt-6f673e2cf55755a97aeb8971994ab9fc62fb794e.tar.bz2
Experimental: allow QSharedPointer to be used with forward declarations that are declared in this file.
The one-definition rule allows the forward declaration appearing below to apply to code that was earlier. Therefore, if the compiler finds out how to delete the object, we can allow a QSharedPointer of a forward- declared-type. This means the actual problem is just a warning with g++. To catch the error, we need a separate .cpp file and I'd rather run this as an external test.
Diffstat (limited to 'tests/auto/qsharedpointer/externaltests.cpp')
-rw-r--r--tests/auto/qsharedpointer/externaltests.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/qsharedpointer/externaltests.cpp
index 75ac5f1..8077b84 100644
--- a/tests/auto/qsharedpointer/externaltests.cpp
+++ b/tests/auto/qsharedpointer/externaltests.cpp
@@ -59,7 +59,7 @@ static QString makespec()
{
static const char default_makespec[] = DEFAULT_MAKESPEC;
const char *p;
- for (p = default_makespec + sizeof(default_makespec); p >= default_makespec; --p)
+ for (p = default_makespec + sizeof(default_makespec) - 1; p >= default_makespec; --p)
if (*p == '/' || *p == '\\')
break;
@@ -122,6 +122,7 @@ namespace QTest {
enum Target { Compile, Link, Run };
QList<QByteArray> qmakeLines;
+ QStringList extraProgramSources;
QByteArray programHeader;
QExternalTest::QtModules qtModules;
QExternalTest::ApplicationType appType;
@@ -199,6 +200,16 @@ namespace QTest {
d->appType = type;
}
+ QStringList QExternalTest::extraProgramSources() const
+ {
+ return d->extraProgramSources;
+ }
+
+ void QExternalTest::setExtraProgramSources(const QStringList &extra)
+ {
+ d->extraProgramSources = extra;
+ }
+
QByteArray QExternalTest::programHeader() const
{
return d->programHeader;
@@ -483,6 +494,13 @@ namespace QTest {
else
projectFile.write("\nCONFIG += release\n");
+ QByteArray extraSources = QFile::encodeName(extraProgramSources.join(" "));
+ if (!extraSources.isEmpty()) {
+ projectFile.write("SOURCES += ");
+ projectFile.write(extraSources);
+ projectFile.putChar('\n');
+ }
+
// Add Qt modules
if (qtModules & QExternalTest::QtCore)
projectFile.write("QT += core\n");