forked from qt-creator/qt-creator
		
	C++: fix handling of empty va_args macro arguments.
Preprocessor did not correctly handle when variadic macro arguments were not provided at all, if there were other arguments: macro was not expanded in case only the non variadic arguments were given. #define MACRO(...) used to work fine for 0 or more arguments. #define MACRO(ARG0, ...) used to work only for 2 or more arguments, now fixed. Change-Id: I64e9199ceccae05618a49931c2adad8e4f9471ba Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
		
				
					committed by
					
						 Nikolai Kosjar
						Nikolai Kosjar
					
				
			
			
				
	
			
			
			
						parent
						
							feeff29f22
						
					
				
				
					commit
					4d18710f46
				
			| @@ -945,6 +945,8 @@ bool Preprocessor::handleIdentifier(PPToken *tk) | ||||
|         bool hasMatchingArgs = false; | ||||
|         if (hasArgs) { | ||||
|             const int expectedArgCount = macro->formals().size(); | ||||
|             if (macro->isVariadic() && allArgTks.size() == expectedArgCount - 1) | ||||
|                 allArgTks.push_back(QVector<PPToken>()); | ||||
|             const int actualArgCount = allArgTks.size(); | ||||
|             if (expectedArgCount == actualArgCount | ||||
|                     || (macro->isVariadic() && actualArgCount > expectedArgCount - 1) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user