Author Topic: CPPCheck bug fix  (Read 6436 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
CPPCheck bug fix
« on: May 12, 2012, 03:35:10 pm »
I am not trying to seem pushy, but could a developer be convinced to look at Patch #3285?  It is rather embarrassing that I submitted the code with the bug in it :-[, and that it somehow passed all my testcases ???.  (The fix is rather simple, as the problem was a switched call to a string function, so it should not take much time to go through.)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: CPPCheck bug fix
« Reply #1 on: May 12, 2012, 05:32:16 pm »
Provide a patch with wxString::Endswith in it and I'll commit it.

http://docs.wxwidgets.org/stable/wx_wxstring.html#wxstringendswith
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: CPPCheck bug fix
« Reply #2 on: May 12, 2012, 07:27:43 pm »
Provide a patch with wxString::Endswith in it and I'll commit it.
New patch uploaded (and tested much more thoroughly).

In testing, I noticed that if the active build target is virtual, it may add include directories without replacing macros; this can fix it:
Code
Index: src/plugins/contrib/CppCheck/CppCheck.cpp
===================================================================
--- src/plugins/contrib/CppCheck/CppCheck.cpp   (revision 7965)
+++ src/plugins/contrib/CppCheck/CppCheck.cpp   (working copy)
@@ -236,6 +236,8 @@
         wxString IncludeDir(IncludeDirs[Dir]);
         if (target)
             MacrosMgr->ReplaceMacros(IncludeDir, target);
+        else
+            MacrosMgr->ReplaceMacros(IncludeDir);
         IncludeList += _T("-I\"") + IncludeDir + _T("\" ");
     }
     if (target)


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: CPPCheck bug fix
« Reply #3 on: May 14, 2012, 09:04:16 am »
In testing, I noticed that if the active build target is virtual, it may add include directories without replacing macros; this can fix it:
Applied in SVN. Thanks.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ