diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-06-23 16:13:14 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-06-25 06:19:50 +0200 |
commit | 75638e258f2ec7857fc989736f1ee9b73eeae035 (patch) | |
tree | 1af7823f9f77295083afd0fd119fe4352f26ad96 /tests/benchmarks | |
parent | 907027ab80c3caad91f935ee75606157bf938cac (diff) | |
download | qtbase-75638e258f2ec7857fc989736f1ee9b73eeae035.tar.gz |
Don't pollute global namespace with #define P
Breaks the build if any global header has
using P = SomeType;
statement, and unnecessary to do so before the headers are included.
Change-Id: I3b8cc705bf662f768b8895e4b3ec1428ab39ef27
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/corelib/text/qstringbuilder/main.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/benchmarks/corelib/text/qstringbuilder/main.cpp b/tests/benchmarks/corelib/text/qstringbuilder/main.cpp index 0de6d33846..fd1c40bfce 100644 --- a/tests/benchmarks/corelib/text/qstringbuilder/main.cpp +++ b/tests/benchmarks/corelib/text/qstringbuilder/main.cpp @@ -32,7 +32,6 @@ #if SCENARIO == 1 // this is the "no harm done" version. Only operator% is active, // with NO_CAST * defined -#define P % #undef QT_USE_FAST_OPERATOR_PLUS #undef QT_USE_FAST_CONCATENATION #define QT_NO_CAST_FROM_ASCII @@ -44,7 +43,6 @@ // this is the "full" version. Operator+ is replaced by a QStringBuilder // based version // with NO_CAST * defined -#define P + #define QT_USE_FAST_OPERATOR_PLUS #define QT_USE_FAST_CONCATENATION #define QT_NO_CAST_FROM_ASCII @@ -54,7 +52,6 @@ #if SCENARIO == 3 // this is the "no harm done" version. Only operator% is active, // with NO_CAST * _not_ defined -#define P % #undef QT_USE_FAST_OPERATOR_PLUS #undef QT_USE_FAST_CONCATENATION #undef QT_NO_CAST_FROM_ASCII @@ -65,7 +62,6 @@ // this is the "full" version. Operator+ is replaced by a QStringBuilder // based version // with NO_CAST * _not_ defined -#define P + #define QT_USE_FAST_OPERATOR_PLUS #define QT_USE_FAST_CONCATENATION #undef QT_NO_CAST_FROM_ASCII @@ -82,6 +78,17 @@ #include <string> +// Select one of the scenarios below +#if SCENARIO == 1 +#define P % +#elif SCENARIO == 2 +#define P + +#elif SCENARIO == 3 +#define P % +#elif SCENARIO == 4 +#define P + +#endif + #define COMPARE(a, b) QCOMPARE(a, b) //#define COMPARE(a, b) @@ -417,4 +424,6 @@ private: QTEST_MAIN(tst_qstringbuilder) +#undef P + #include "main.moc" |