From 5bb1408927b4eb5a03e8ab9f7cbc68f80d8a3962 Mon Sep 17 00:00:00 2001 From: Matthew Vogt Date: Thu, 23 Feb 2012 11:12:58 +1000 Subject: Allow moc to handle symbols that have been redefined. Allow moc to produce the desired identifiers when used with C++ symbol names that have been redefined, for example by -Dfoo=bar. Two changes are required: firstly, when encoding a type name, the components of the name must be checked for substitutions that have been defined for that token (note that this is not done here by correct pre-processing, but only by processing the resultant table of definitions). Secondly, the arguments to the SIGNAL, SLOT and METHOD macros must be allowed to be substituted during macro expansion rather than stringized directly. This is a temporary change to prevent breaking existing projects that depend on the declarative module. After clients have had an opportunity to update their code to the use the new interfaces, it can be removed. Task-number: QTBUG-23737 Change-Id: I39e6844cebf6ca7984af6028160b8a3797ac44a5 Reviewed-by: Martin Jones --- src/corelib/kernel/qobjectdefs.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/corelib/kernel/qobjectdefs.h') diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 0b1fa8839f..45ef8ab3ca 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -208,16 +208,16 @@ Q_CORE_EXPORT const char *qFlagLocation(const char *method); #ifndef QT_NO_DEBUG # define QLOCATION "\0" __FILE__ ":" QTOSTRING(__LINE__) # ifndef QT_NO_KEYWORDS -# define METHOD(a) qFlagLocation("0"#a QLOCATION) +# define METHOD(a) qFlagLocation("0" QTOSTRING(a) QLOCATION) # endif -# define SLOT(a) qFlagLocation("1"#a QLOCATION) -# define SIGNAL(a) qFlagLocation("2"#a QLOCATION) +# define SLOT(a) qFlagLocation("1" QTOSTRING(a) QLOCATION) +# define SIGNAL(a) qFlagLocation("2" QTOSTRING(a) QLOCATION) #else # ifndef QT_NO_KEYWORDS -# define METHOD(a) "0"#a +# define METHOD(a) "0" QTOSTRING(a) # endif -# define SLOT(a) "1"#a -# define SIGNAL(a) "2"#a +# define SLOT(a) "1" QTOSTRING(a) +# define SIGNAL(a) "2" QTOSTRING(a) #endif #define QMETHOD_CODE 0 // member type codes -- cgit v1.2.3