Code Analyzers

Sysprogs forums Forums VisualGDB Code Analyzers

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #23330
    Ancaritha
    Participant

    Hi there!  I’m finally getting the free time to play with the Code Analyzer that now is part of VisualGDB…. and I don’t get how to actually use it.  I went to the VisualGDB properties, turned it on, checked every single box and… now what?  I did a rebuild and everything looks the same.

    I’m using:
    VS 2012
    VisualGDB 5.3R8 Embedded Edition
    Project is an STM32L4

    Does it not work with Embedded Edition?  Am I missing a step somewhere?  I have 118 warnings for GCC so there is no change that the Code Analyzers aren’t finding something wrong.

     

    Thanks!

    #23343
    support
    Keymaster

    Hi,

    The code analyzers run together with IntelliSense error checking and display the results in the Errors pane (see this thread). If you believe it doesn’t work, please let us know more details (e.g. screenshots) and we will help you configure them.

    #23349
    Ancaritha
    Participant

    My apologies in advance for the somewhat odd post.  I am writing this as I am testing different things so it’s a bit more stream of thought as I figure things out…

    I created a new embedded project and added this to int main and it worked (i.e. I got the pretty Clang output warnings).

    int x;
    x |= 1;

    After I did that, I went and added the same lines of code to an existing project and it… kinda worked.  I got the same warnings about an uninitialized variable, and a couple others about overloaded virtual functions in another headerfile.  Those overloaded virtual function warnings did not appear last time I tried turning on the Code Analytics, so I don’t know why me creating an embedded project should have made any changes…  I also only appear to be getting 9 messages, and I’m guessing I should have way more since I have 125 GCC warnings.

    I have confirmed that the Code Analyzer settings are the same and the VisualGDB IntelliSense Settings are the same (see image below) between the new project and my existing one.  Are there any caches I should be clearing or have I sometime in the last year or two clicked some setting in VS that would have changed Clang or something to that effect?  I deleted the .sdf file for the project to force a reparsing and I still get the same warnings as before.

    Ha!  I think I figured out why it doesn’t seem like it’s working.  I added that same code to 2 other files in my project, and the Clang warnings/messages don’t show up unless that is the file I am actively viewing (and any headers it calls).  If I’m not looking at one of those files, that uninitialized variable message doesn’t show up.  As I start clicking around the solution with the Error menu active, different warnings start showing up!  So I guess the final question is, is that expected behavior?  If not, how can I make it always display the warnings for all files?  This project has 200+ files,  clicking on each one would be extremely tedious…

    Thanks!

    • This reply was modified 5 years, 11 months ago by support. Reason: formatting
    Attachments:
    You must be logged in to view attached files.
    #23372
    support
    Keymaster

    No problem, we have fixed the formatting of your post.

    The clang code analysis output is indeed only shown for the current file. The main use case for it is to detect common errors as you write new code and suggest the fixes similar to the regular IntelliSense errors/warnings.

    We do have long-term plans for scanning the entire project for warnings and showing an easy-to-use searchable report, however this won’t make it into v5.4 due to our release schedule constraints.

    #23440
    Ancaritha
    Participant

    Ok, so this is expected behavior.  That’s good at least 🙂

    Being able to scan the entire project will be super awesome, but this is at least a good for step for me to turn on and leave active.

     

    Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.