From 00237744117bd9ca5ce13cafa21203fe4decd8d9 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Thu, 29 Aug 2013 09:10:52 +0200 Subject: [PATCH] qdoc: Enable support for rvalue references in function signatures qdoc interprets the double-ampersand in function parameters using rvalue references (e.g. 'Type &&other') incorrectly as a logical AND operator, resulting in a syntax error. This change works around the issue by treating '&' the same as '*', and defining Q_COMPILER_RVALUE_REFS for qdoc. Task-number: QTBUG-32675 Change-Id: I499611f16f22c33ff5b878da0cd59d67ddf53d72 Reviewed-by: Giuseppe D'Angelo Reviewed-by: Jerome Pasion Reviewed-by: Martin Smith --- doc/global/qt-cpp-defines.qdocconf | 3 ++- src/tools/qdoc/tokenizer.cpp | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/global/qt-cpp-defines.qdocconf b/doc/global/qt-cpp-defines.qdocconf index 2e795e1439a..06a6780a3dc 100644 --- a/doc/global/qt-cpp-defines.qdocconf +++ b/doc/global/qt-cpp-defines.qdocconf @@ -14,7 +14,8 @@ defines += Q_QDOC \ QT_DEPRECATED_* \ Q_NO_USING_KEYWORD \ __cplusplus \ - Q_COMPILER_INITIALIZER_LISTS + Q_COMPILER_INITIALIZER_LISTS \ + Q_COMPILER_RVALUE_REFS Cpp.ignoretokens += \ PHONON_EXPORT \ diff --git a/src/tools/qdoc/tokenizer.cpp b/src/tools/qdoc/tokenizer.cpp index 224d451f4cb..e1ca28eef8d 100644 --- a/src/tools/qdoc/tokenizer.cpp +++ b/src/tools/qdoc/tokenizer.cpp @@ -237,7 +237,11 @@ int Tokenizer::getToken() return getTokenAfterPreprocessor(); case '&': yyCh = getChar(); - if (yyCh == '&' || yyCh == '=') { + /* + Removed check for '&&', only interpret '&=' as an operator. + '&&' is also used for an rvalue reference. QTBUG-32675 + */ + if (yyCh == '=') { yyCh = getChar(); return Tok_SomeOperator; }