From 6522b4b5a25c9ed9fd7a03a1e75e91adf51cc317 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Wed, 17 Dec 2008 18:52:14 +0100
Subject: [PATCH] handle skipping of test functions on a per-function basis

now we process all includes and loads in cumulative mode again.
functions without side effects don't need special attention in the first
place, obviously. and the printing functions already have their own
handling.
---
 shared/proparser/profileevaluator.cpp | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/shared/proparser/profileevaluator.cpp b/shared/proparser/profileevaluator.cpp
index 433076a88dc..ea280b45b4d 100644
--- a/shared/proparser/profileevaluator.cpp
+++ b/shared/proparser/profileevaluator.cpp
@@ -821,7 +821,7 @@ bool ProFileEvaluator::Private::visitProValue(ProValue *value)
 
 bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
 {
-    if (!m_skipLevel && (!m_updateCondition || m_condition == ConditionFalse)) {
+    if (!m_updateCondition || m_condition == ConditionFalse) {
         QString text = func->text();
         int lparen = text.indexOf(QLatin1Char('('));
         int rparen = text.lastIndexOf(QLatin1Char(')'));
@@ -829,10 +829,12 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
         QString arguments = text.mid(lparen + 1, rparen - lparen - 1);
         QString funcName = text.left(lparen);
         m_lineNo = func->lineNumber();
-        bool result = false;
-        if (!evaluateConditionalFunction(funcName.trimmed(), arguments, &result))
+        bool result;
+        if (!evaluateConditionalFunction(funcName.trimmed(), arguments, &result)) {
+            m_invertNext = false;
             return false;
-        if (result ^ m_invertNext)
+        }
+        if (!m_skipLevel && (result ^ m_invertNext))
             m_condition = ConditionTrue;
     }
     m_invertNext = false;
@@ -1733,6 +1735,8 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
             break;
         }
         case T_INCLUDE: {
+            if (m_skipLevel && !m_cumulative)
+                break;
             QString parseInto;
             if (args.count() == 2) {
                 parseInto = args[1];
@@ -1749,6 +1753,8 @@ bool ProFileEvaluator::Private::evaluateConditionalFunction(const QString &funct
             break;
         }
         case T_LOAD: {
+            if (m_skipLevel && !m_cumulative)
+                break;
             QString parseInto;
             bool ignore_error = false;
             if (args.count() == 2) {
-- 
GitLab