aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-06-09 15:15:46 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-09 19:10:05 -0300
commit3e2500cab4c5a8b0bd0fb532ca6ed155c36c6dd5 (patch)
treee4276d953dac106b9debd43608925cb2669fd283
parent3649c91f1bdad3ce7db3ff895ae40edf06fc232e (diff)
Fixed warning message output.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>, Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--abstractmetabuilder.cpp19
-rw-r--r--reporthandler.cpp27
-rw-r--r--reporthandler.h1
3 files changed, 37 insertions, 10 deletions
diff --git a/abstractmetabuilder.cpp b/abstractmetabuilder.cpp
index 5c326abb..2fb50632 100644
--- a/abstractmetabuilder.cpp
+++ b/abstractmetabuilder.cpp
@@ -349,6 +349,7 @@ bool AbstractMetaBuilder::build(QIODevice* input)
addAbstractMetaClass(cls);
}
+ ReportHandler::flush();
// We need to know all global enums
QHash<QString, EnumModelItem> enumMap = m_dom->enumMap();
@@ -361,6 +362,7 @@ bool AbstractMetaBuilder::build(QIODevice* input)
m_globalEnums << metaEnum;
}
}
+ ReportHandler::flush();
QHash<QString, NamespaceModelItem> namespaceMap = m_dom->namespaceMap();
ReportHandler::setProgressReference(namespaceMap);
@@ -370,6 +372,7 @@ bool AbstractMetaBuilder::build(QIODevice* input)
if (metaClass)
m_metaClasses << metaClass;
}
+ ReportHandler::flush();
// Go through all typedefs to see if we have defined any
// specific typedefs to be used as classes.
@@ -380,6 +383,7 @@ bool AbstractMetaBuilder::build(QIODevice* input)
AbstractMetaClass* cls = traverseTypeAlias(typeAlias);
addAbstractMetaClass(cls);
}
+ ReportHandler::flush();
// Global functions
foreach (FunctionModelItem func, m_dom->functions()) {
@@ -415,6 +419,7 @@ bool AbstractMetaBuilder::build(QIODevice* input)
if (!cls->isInterface() && !cls->isNamespace())
setupInheritance(cls);
}
+ ReportHandler::flush();
ReportHandler::setProgressReference(m_metaClasses);
foreach (AbstractMetaClass* cls, m_metaClasses) {
@@ -437,6 +442,7 @@ bool AbstractMetaBuilder::build(QIODevice* input)
if (cls->isAbstract() && !cls->isInterface())
cls->typeEntry()->setLookupName(cls->typeEntry()->targetLangName() + "$ConcreteWrapper");
}
+ ReportHandler::flush();
QList<TypeEntry*> entries = types->entries().values();
ReportHandler::setProgressReference(entries);
@@ -490,6 +496,7 @@ bool AbstractMetaBuilder::build(QIODevice* input)
}
}
}
+ ReportHandler::flush();
{
FunctionList hashFunctions = m_dom->findFunctions("qHash");
@@ -1613,8 +1620,8 @@ AbstractMetaFunction* AbstractMetaBuilder::traverseFunction(FunctionModelItem fu
}
AbstractMetaArgumentList metaArguments;
-
int firstDefaultArgument = 0;
+
for (int i = 0; i < arguments.size(); ++i) {
ArgumentModelItem arg = arguments.at(i);
@@ -1632,11 +1639,8 @@ AbstractMetaFunction* AbstractMetaBuilder::traverseFunction(FunctionModelItem fu
return metaFunction;
}
AbstractMetaArgument* metaArgument = createMetaArgument();
- metaArgument->setType(metaType);
-
- if (arg->name().isEmpty() && metaFunction->argumentName(i).isEmpty())
- ReportHandler::warning(QString("Argument %1 on function '%2::%3' declared without name.").arg(i).arg(className).arg(functionItem->name()));
+ metaArgument->setType(metaType);
metaArgument->setName(arg->name());
metaArgument->setArgumentIndex(i);
metaArguments << metaArgument;
@@ -1672,6 +1676,11 @@ AbstractMetaFunction* AbstractMetaBuilder::traverseFunction(FunctionModelItem fu
if (metaArg->type()->isEnum() || metaArg->type()->isFlags())
m_enumDefaultArguments << QPair<AbstractMetaArgument *, AbstractMetaFunction *>(metaArg, metaFunction);
}
+
+ //Check for missing argument name
+ if (!metaArg->hasName() && !metaFunction->isOperatorOverload() && metaFunction->argumentName(i, false, m_currentClass).isEmpty())
+ ReportHandler::warning(QString("Argument %1 on function '%2::%3' declared without name.").arg(i).arg(className).arg(functionItem->name()));
+
}
#if 0
diff --git a/reporthandler.cpp b/reporthandler.cpp
index bc8729dc..22f7da6b 100644
--- a/reporthandler.cpp
+++ b/reporthandler.cpp
@@ -59,6 +59,18 @@ static void printProgress()
m_progressBuffer.clear();
}
+static void printWarnings()
+{
+ if (m_reportedWarnings.size() > 0) {
+ m_progressBuffer += "\t";
+ foreach(QString msg, m_reportedWarnings)
+ m_progressBuffer += msg + "\n\t";
+ m_progressBuffer += "\n\n";
+ m_reportedWarnings.clear();
+ printProgress();
+ }
+}
+
ReportHandler::DebugLevel ReportHandler::debugLevel()
{
return m_debugLevel;
@@ -111,12 +123,9 @@ void ReportHandler::warning(const QString &text)
if (db && db->isSuppressedWarning(text)) {
++m_suppressedCount;
} else if (!m_reportedWarnings.contains(text)) {
- m_progressBuffer = (m_step_warning == 0 ? "[" COLOR_YELLOW "WARNING" COLOR_END "]\n" : "") + text + "\n";
- printProgress();
++m_warningCount;
++m_step_warning;
-
- m_reportedWarnings.insert(text);
+ m_reportedWarnings << text;
}
}
@@ -137,12 +146,20 @@ void ReportHandler::progress(const QString& str, ...)
if (m_step >= m_step_size) {
if (m_step_warning == 0) {
m_progressBuffer = "[" COLOR_GREEN "OK" COLOR_END "]\n";
- printProgress();
+ } else {
+ m_progressBuffer = "[" COLOR_YELLOW "WARNING" COLOR_END "]\n";
}
+ printProgress();
m_step_warning = 0;
}
}
+void ReportHandler::flush()
+{
+ if (!m_silent)
+ printWarnings();
+}
+
void ReportHandler::debug(DebugLevel level, const QString &text)
{
if (m_debugLevel == NoDebug)
diff --git a/reporthandler.h b/reporthandler.h
index 7c8b1c57..f1fae50e 100644
--- a/reporthandler.h
+++ b/reporthandler.h
@@ -69,6 +69,7 @@ public:
static bool isSilent();
static void setSilent(bool silent);
+ static void flush();
};
#endif // REPORTHANDLER_H