diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 786f07a79bf665638cf74e8e16a8f1cfa91355f6..b181b01f74b92032d9353a5d3fbb3efde6986494 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -55,7 +55,8 @@ class DocumentDiagnosticClient : public DiagnosticClient public: DocumentDiagnosticClient(Document *doc, QList<Document::DiagnosticMessage> *messages) : doc(doc), - messages(messages) + messages(messages), + errorCount(0) { } virtual void report(int level, @@ -63,8 +64,12 @@ public: unsigned line, unsigned column, const char *format, va_list ap) { - if (messages->count() == MAX_MESSAGE_COUNT) - return; + if (level == Error) { + ++errorCount; + + if (errorCount >= MAX_MESSAGE_COUNT) + return; // ignore the error + } const QString fileName = QString::fromUtf8(fileId->chars(), fileId->size()); @@ -88,8 +93,10 @@ public: } } +private: Document *doc; QList<Document::DiagnosticMessage> *messages; + int errorCount; }; } // anonymous namespace diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index ee3b3680823e0efc5457f72c6857199b14cac898..8cb06934474bc134525fd3034384200603772bf0 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -379,7 +379,7 @@ protected: } Overview oo; - translationUnit()->warning(ast->firstToken(), "`%s' is not a type-name", + translationUnit()->warning(ast->firstToken(), "`%s' is not a type name", qPrintable(oo(ast->name->name))); } }