From 75638e258f2ec7857fc989736f1ee9b73eeae035 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 23 Jun 2020 16:13:14 +0200 Subject: [PATCH] Don't pollute global namespace with #define P MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../corelib/text/qstringbuilder/main.cpp | 17 +++++++++++++---- 1 file 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 +// 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"