Skip to content
This repository has been archived by the owner on Jan 2, 2020. It is now read-only.

qtc-cppcheck doesn't build against QtCreator 3.4.0RC1 (partial patch included) #11

Closed
ghost opened this issue Apr 20, 2015 · 4 comments
Closed

Comments

@ghost
Copy link

ghost commented Apr 20, 2015

Several compile errors when building qtc-cppcheck against the source of QtCreator 3.4.0RC1.

I fixed the compile errors with the attached patch, but when running the plugin the following assert in function void CppcheckRunner::checkQueuedFiles() fails:

QString binary = settings_->binaryFile ();
Q_ASSERT (!binary.isEmpty ());

@ghost
Copy link
Author

ghost commented Apr 20, 2015

diff --git a/src/QtcCppcheckPlugin.cpp b/src/QtcCppcheckPlugin.cpp
index 77b7b87..5d597a6 100644
--- a/src/QtcCppcheckPlugin.cpp
+++ b/src/QtcCppcheckPlugin.cpp
@@ -7,6 +7,7 @@
 #include <coreplugin/actionmanager/actioncontainer.h>
 #include <coreplugin/coreconstants.h>
 #include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/idocument.h>

 #include <projectexplorer/projectexplorer.h>
 #include <projectexplorer/projectnodes.h>
@@ -14,6 +15,7 @@
 #include <projectexplorer/taskhub.h>
 #include <projectexplorer/buildmanager.h>
 #include <projectexplorer/session.h>
+#include <projectexplorer/projecttree.h>

 #include <QtPlugin>

@@ -23,6 +25,7 @@
 #include "OptionsPage.h"
 #include "TaskInfo.h"
 #include "CppcheckRunner.h"
+#include <QMenu>

 using namespace QtcCppcheck::Internal;

@@ -45,7 +48,7 @@ namespace
   bool isFileNodeCheckable (const FileNode* node)
   {
     static QStringList extensions = supportedExtensions ();
-    QFileInfo info (node->path());
+    QFileInfo info (node->path().toString());
     QString extension = info.completeSuffix ();
     return (extensions.contains (extension));
   }
@@ -212,7 +215,7 @@ void QtcCppcheckPlugin::checkCurrentDocument()
     return;
   }
   // Check event if it not belongs to active project.
-  checkFiles (QStringList () << document->filePath ());
+  checkFiles (QStringList () << document->filePath().toString());
 }

 void QtcCppcheckPlugin::checkActiveProject()
@@ -225,7 +228,8 @@ void QtcCppcheckPlugin::checkActiveProject()

 void QtcCppcheckPlugin::checkCurrentNode()
 {
-  Node* node = ProjectExplorerPlugin::instance ()->currentNode ();
+  //Node* node = ProjectExplorerPlugin::instance ()->currentNode ();
+  Node* node = ProjectTree::currentNode();
   if (node == NULL)
   {
     return;
@@ -248,7 +252,7 @@ QStringList QtcCppcheckPlugin::checkableFiles(const Node *node, bool forceSelect
       const FileNode* file = (const FileNode*) node;
       if (forceSelected || isFileNodeCheckable (file))
       {
-        files << file->path ();
+        files << file->path().toString();
       }
     }
       break;
@@ -390,10 +394,10 @@ void QtcCppcheckPlugin::checkActiveProjectDocuments(int beginRow, int endRow,
     {
       continue;
     }
-    if (projectFileList_.contains (document->filePath ()) &&
+    if (projectFileList_.contains (document->filePath().toString()) &&
         document->isModified () == modifiedFlag)
     {
-      filesToCheck << document->filePath ();
+      filesToCheck << document->filePath().toString();
     }
   }

@OneMoreGres
Copy link
Owner

I'll watch for it when QTC 3.4 will be officially released.
Looks like assert triggers because binary file has not been set in plugin's options. It should be just a check, not an assertion. So you can safely replace it with if/return.

@ghost
Copy link
Author

ghost commented Apr 20, 2015

Ah, yes, you are right. When I fill in the path of cppcheck in the options dialog, the assert does not occur.

So looks like the attached patch is all that is needed for QtCreator 3.4.0RC1 .

@OneMoreGres
Copy link
Owner

Source updated. Thanks for patch.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant