Clang-Tidying up the house

Products, the Universe and Everything from Products, the Universe and Everything

If there is any single consolation amidst the circumstances we are all having to cope with at the moment it is that many of us have lots of time to fill - not only with unproductive things like binging Netflix (I really should get around to watching Dirk Gently's Holistic Detective Agency...) but also with tasks which might have a more lasting long-term benefit.

A Clang-Tidy analysis of a skeleton Visual Studio 2019 project within VisualLintGui

Those could be tasks like learning a language (programming or human), joining online yoga classes, writing a book, designing a website, blogging, reading (I can recommend Francis Buontempo's Genetic Algorithms and Machine Learning for Programmers if you fancy learning a little about ML) or generally just getting on with stuff with perhaps fewer distractions than usual.

On the latter note, for the past few months we've been working on the codebase of Visual Lint 7.5 (the next version) in our development branch, and it is coming along quite nicely.

One of the things we have planned to do for some time is to add direct support for the Clang-Tidy analysis tool to Visual Lint. When the UK lockdown started, focusing on this task in particular proved to be a very useful distraction from all the fear and uncertainty we found around us.

Sometimes being in the zone helps in more ways than usual.

The screenshot above should give you an idea of where we are at the moment. Whilst there is still a great deal to do before we can consider this is production-ready the foundation is in place and it is definitely usable. For example, selected issues can already be suppressed from the Analysis Results Display by inserting inline suppression directives ("// NOLINT") using the same context menu command used to suppress (for example) PC-lint, PC-lint Plus and CppCheck analysis issues.

With Microsoft Visual Studio being one of the major development environments we support one of the most important things to address is configuring Clang-Tidy to be tolerant of non-standard Visual C++ projects. The errors shown for some files in the Analysis Status Display in the screenshot above are exactly because of this - a standards compliant C++ compiler is likely to generate at least some errors while compiling most Visual C++ projects.

The only error we saw in the Visual C++ project mentioned above was: clang-diagnostic-error: -- call to non-static member function without an object argument.

The StackOverflow topic this is one of the most compelling features of Clang-Tidy). The good news is that autofixing selected issues should be fairly straightforward using the output of the Clang-Tidy ‑‑export-fixes switch.

Lockdowns or eased lockdowns, more interesting times lie ahead.

Clang-Tidying up the house

Products, the Universe and Everything from Products, the Universe and Everything

If there is any single consolation amidst the circumstances we are all having to cope with at the moment it is that many of us have lots of time to fill - not only with unproductive things like binging Netflix (I really should get around to watching Dirk Gently's Holistic Detective Agency...) but also with tasks which might have a more lasting long-term benefit.

A Clang-Tidy analysis of a Visual Studio 2019 skeleton MFC project within VisualLintGui.

Those could be tasks like learning a language (programming or human), joining online yoga classes, writing a book, designing a website, blogging, reading (I can recommend Francis Buontempo's Genetic Algorithms and Machine Learning for Programmers if you fancy learning a little about ML) or generally just getting on with stuff with perhaps fewer distractions than usual.

On the latter note, for the past few months we've been working on the codebase of the next version of Visual Lint in our development branch, and it is coming along quite nicely.

One of the things we have planned to do for some time is to add direct support for the Clang-Tidy analysis tool to Visual Lint. When the UK lockdown started, focusing on this task in particular proved to be a very useful distraction from all the fear and uncertainty we found around us.

Sometimes being in the zone helps in more ways than usual.

The screenshot above should give you an idea of where we are at the moment. Whilst there is still a great deal to do before we can consider this is production-ready the foundation is in place and it is definitely usable. For example, selected issues can already be suppressed from the Analysis Results Display by inserting inline suppression directives ("// NOLINT") using the same context menu command used to suppress (for example) PC-lint, PC-lint Plus and CppCheck analysis issues.

With Microsoft Visual Studio being one of the major development environments we support one of the most important things to address is configuring Clang-Tidy to be tolerant of non-standard Visual C++ projects. The errors shown for some files in the Analysis Status Display in the screenshot above are exactly because of this - a standards compliant C++ compiler is likely to generate at least some errors while compiling most Visual C++ projects.

The only error we saw in the Visual C++ project mentioned above was: clang-diagnostic-error: -- call to non-static member function without an object argument.

The StackOverflow topic Refactor MFC message maps to include fully qualified member function pointers discusses exactly the same issue.

This is mitigated by the fact that recent versions of Clang-Tidy do a pretty good job of handling nonstandard code, so the things that Clang-Tidy warns about seem to be exactly the sort of things you would expect it to and a fair degree of tuning is possible. For example, the clang-diagnostic-error issues in the case above could be disabled entirely if that was what you wanted (as it's a trivial fix you could alternatively choose to correct the code).

Furthermore, with the C++ Core Guidelines checks enabled (e.g. using the --checks=modernize-* switch) Clang-Tidy can tell you exactly what you could do to your C++ code to bring it up to modern standards.

We will obviously be talking more about Clang-Tidy in due course - particularly once we start looking at using it to automatically correct the issues it finds (if you are not aware, this is one of the most compelling features of Clang-Tidy. The good news is that autofixing selected issues should be fairly straightforward using the output of the Clang-Tidy --export-fixes switch.

Lockdowns or eased lockdowns, more interesting times lie ahead.

Visual Lint 7.0.7.318 has been released

Products, the Universe and Everything from Products, the Universe and Everything

This is a recommended maintenance update for Visual Lint 7.0. The following changes are included:

  • The Visual C++ built-in preprocessor symbol _MSC_VER is now defined on the generated CppCheck command line when analysing Visual Studio 2019 projects.

  • Appropriate defaults (e.g. the compiler indirect file co-rb-vs2019.lnt) are now offered when creating a PC-lint Plus analysis configuration for Visual Studio 2019.

  • Updated the values of _MSC_VER and _MSC_FULL_VER in the PC-lint Plus compiler indirect file co-rb-v2017.lnt to reflect those in the latest Visual Studio 2017 update (VS2017 v15.9.21).

  • Updated the values of _MSC_VER and _MSC_FULL_VER in the PC-lint Plus compiler indirect file co-rb-vs2019.lnt to reflect those in the latest Visual Studio 2019 update (VS2019 v16.5.1).

  • Fixed a bug in the Configuration Wizard "Select Analysis Tool Installation Folder" page.

  • Fixed a bug in the implementation of the "Active Analysis Tool" option.

  • Fixed a bug in the implementation of the .vlconfig file "Solution specific Analysis Tool" property [Visual Lint Enterprise and Build Server Editions]`.

  • Fixed a display bug in the Configuration Wizard "Information" page. Note that this page is PC-lint and PC-lint Plus specific.

  • Corrected the title of the "PC-lint" page in the Analysis Configuration Dialog to "PC-lint Plus" when the active analysis tool is PC-lint Plus.

Visual Lint 7.0.7.318 has been released

Products, the Universe and Everything from Products, the Universe and Everything

This is a recommended maintenance update for Visual Lint 7.0. The following changes are included:

  • The Visual C++ built-in preprocessor symbol _MSC_VER is now defined on the generated CppCheck command line when analysing Visual Studio 2019 projects.
  • Appropriate defaults (e.g. the compiler indirect file co-rb-vs2019.lnt) are now offered when creating a PC-lint Plus analysis configuration for Visual Studio 2019.
  • Updated the values of _MSC_VER and _MSC_FULL_VER in the PC-lint Plus compiler indirect file co-rb-v2017.lnt to reflect those in the latest Visual Studio 2017 update (VS2017 v15.9.21).
  • Updated the values of _MSC_VER and _MSC_FULL_VER in the PC-lint Plus compiler indirect file co-rb-vs2019.lnt to reflect those in the latest Visual Studio 2019 update (VS2019 v16.5.1).
  • Fixed a bug in the Configuration Wizard "Select Analysis Tool Installation Folder" page.
  • Fixed a bug in the implementation of the "Active Analysis Tool" option.
  • Fixed a bug in the implementation of the .vlconfig file "Solution specific Analysis Tool" property [Visual Lint Enterprise and Build Server Editions].
  • Fixed a display bug in the Configuration Wizard "Information" page. Note that this page is PC-lint and PC-lint Plus specific.
  • Corrected the title of the "PC-lint" page in the Analysis Configuration Dialog to "PC-lint Plus" when the active analysis tool is PC-lint Plus.

Download Visual Lint 7.0.7.318

COVID-19 Lockdown Blues

Products, the Universe and Everything from Products, the Universe and Everything

A corner of the roof of our office building. Even though the sea is just over 350m away to the left, sadly it's currently off-limits.

2020 is not turning out to be what we expect as - like much of the world - the UK is locked down right now as a result of the COVID-19 pandemic. As such we have been working from home for the past month and only going out for essentials.

That means no ACCU Conference, no free coffee in the office, no impromptu meetings on the beach or on our astroturfed office roof (yes, it does look like that!), no aerial yoga (cue sad face from Anna) but a whole lot of Zoom, configuring VPNs, being thankful for distributed version control systems, kicking off builds remotely and so on.

As far as Riverblade goes, it's rather fortunate that we have been set up for remote working from the outset, so from one point of view the lockdown hasn't come as a big change - although like everyone else we're really missing friends, family...and just simple experiences like going to a cafe at lunchtime or buying an ice cream at the seafront.

Quite frankly it sucks. But you already know all that - and if it saves lives, it is a tiny price to pay. We can only hope that politicians will take heed of the warnings from scientists, nurses, doctors and people who actually know what they are talking about, and that whatever we each endure proves to be enough to stop this virus in its tracks.

Needless to say our thoughts are with everyone touched by this pandemic - but especially with those who have lost loved ones and with anyone working in health and social care.

Be safe, people.

COVID-19 Lockdown Blues

Products, the Universe and Everything from Products, the Universe and Everything

The roof of our office buildingA corner of the roof of our office building. Even though the sea is just over 350m away to the left, sadly it's currently off-limits.

2020 is not turning out to be what we expect as - like much of the world - the UK is locked down right now as a result of the COVID-19 pandemic. As such we have been working from home for the past month and only going out for essentials.

That means no ACCU Conference, no free coffee in the office, no impromptu meetings on the beach or on our astroturfed office roof (yes, it does look like that!), no aerial yoga (cue sad face from Anna) but a whole lot of Zoom, configuring VPNs, being thankful for distributed version control systems, kicking off builds remotely and so on.

As far as Riverblade goes, it's rather fortunate that we have been set up for remote working from the outset, so from one point of view the lockdown hasn't come as a big change - although like everyone else we're really missing friends, family...and just simple experiences like going to a cafe at lunchtime or buying an ice cream at the seafront.

Quite frankly it sucks. But you already know all that - and if it saves lives, it is a tiny price to pay. We can only hope that politicians will take heed of the warnings from scientists, nurses, doctors and people who actually know what they are talking about, and that whatever we each endure proves to be enough to stop this virus in its tracks.

Needless to say our thoughts are with everyone touched by this pandemic - but especially with those who have lost loved ones and with anyone working in health and social care.

Be safe, people.

Visual Lint 7.0.6.316 has been released

Products, the Universe and Everything from Products, the Universe and Everything

This is a recommended maintenance update for Visual Lint 7.0. The following changes are included:

  • Fixed a bug in the parsing of Visual Studio MSBuild expressions using the [MSBuild]::GetDirectoryNameOfFileAbove() function which was preventing the system include folder path from being read correctly in Visual Studio 2019 v16.4.4.
  • Updated the values of _MSC_VER and _MSC_FULL_VER in the PC-lint Plus compiler indirect file co-rb-vs2019.lnt to support Visual Studio 2019 v16.4.4.
  • Modified the PC-lint Plus Visual Studio 2019 compiler indirect file co-rb-vs2019.lnt to suppress an instance of error 4392 (constexpr declaration follows non-constexpr declaration) in the header file $(VCToolsInstallDir_160)\include\intrin0.h.
  • Added help documentation for the fields (e.g $(index), $(SourceFile) and $(LineNo) ) which can be used in exported analysis results files.
  • Updated the helpfile to explicitly reference the PC-lint Plus analysis tool throughout.
  • Added a "PC-lint/PC-lint Plus multipass analysis" help topic.
  • Updated links within the online help as necessary.

Download Visual Lint 7.0.6.316

Visual Lint 7.0.6.316 has been released

Products, the Universe and Everything from Products, the Universe and Everything

This is a recommended maintenance update for Visual Lint 7.0. The following changes are included:

  • Fixed a bug in the parsing of Visual Studio MSBuild expressions using the [MSBuild]::GetDirectoryNameOfFileAbove() function which was preventing the system include folder path from being read correctly in Visual Studio 2019 v16.4.4.

  • Updated the values of _MSC_VER and _MSC_FULL_VER in the PC-lint Plus compiler indirect file co-rb-vs2019.lnt to support Visual Studio 2019 v16.4.4.

  • Modified the PC-lint Plus Visual Studio 2019 compiler indirect file co-rb-vs2019.lnt to suppress an instance of error 4392 (constexpr declaration follows non-constexpr declaration) in the header file $(VCToolsInstallDir_160)\include\intrin0.h.

  • Added help documentation for the fields (e.g $(index), $(SourceFile) and $(LineNo)) which can be used in exported analysis results files.

  • Updated the helpfile to explicitly reference the PC-lint Plus analysis tool throughout.

  • Added a "PC-lint/PC-lint Plus multipass analysis" help topic.

  • Updated links within the online help as necessary.

Visual Lint 7.0.4.313 has been released

Products, the Universe and Everything from Products, the Universe and Everything

This is a recommended maintenance update for Visual Lint 7.0. The following changes are included:

  • Added support for wildcards to the text filters in the Analysis Status, Analysis Statistics, Analysis Results and Stack Usage Displays and Display Filter Dialog.

    This allows (for example) files to be easily excluded from analysis by using a wildcard text filter in the Analysis Status Display.
  • Added a /writevlconfigfiles switch to VisualLintConsole to allow the user to use VisualLintConsole to incrementally update analysis configuration (.vlconfig) file(s) for the current solution/workspace/project.
  • Added the environment variable _RB_CONFIGURATION to the generated PC-lint/PC-lint Plus command line. This includes the name of the configuration, and like _RB_PLATFORM can be used to dynamically select options within an indirect (.lnt) file.
  • The "Delete Analysis Results" command now correctly deletes per-project analysis results and report baggage files.
  • Improved a prompt which was shown by the Configuration Wizard if it was unable to write any affected files on completion.
  • Locked out the program information (+program_info) option on the Command Line Options page if the active analysis tool is PC-lint Plus, as this directive is currently PC-lint 9.0 specific.
  • Generated PC-lint Plus command lines now escape the pathname of the stack usage report file if it contains quotes (generated PC-lint 9.0 command lines are unaffected as spaces in the pathname do not cause issues for it).
  • Fixed a bug in the parsing of ExcludedFromBuild attributes in Visual C++ 2010-2019 (.vcxproj) project files.
  • Fixed a bug which affected projects containing more than one file with the same name.
  • Fixed a bug in the parsing of cpplint analysis results of the format: "<filename>(<lineno>): error cpplint: [<ID>] <description> [<category>]".
  • Corrected a help topic.

Download Visual Lint 7.0.4.313

Visual Lint 7.0.4.313 has been released

Products, the Universe and Everything from Products, the Universe and Everything

This is a recommended maintenance update for Visual Lint 7.0. The following changes are included:

  • Added support for wildcards to the text filters in the Analysis Status, Analysis Statistics, Analysis Results and Stack Usage Displays and Display Filter Dialog.

    This allows (for example) files to be easily excluded from analysis by using a wildcard text filter in the Analysis Status Display.

  • Added a /writevlconfigfiles switch to VisualLintConsole to allow the user to use VisualLintConsole to incrementally update analysis configuration (.vlconfig) file(s) for the current solution/workspace/project.

  • Added the environment variable _RB_CONFIGURATION to the generated PC-lint/PC-lint Plus command line. This includes the name of the configuration, and like _RB_PLATFORM can be used to dynamically select options within an indirect (.lnt) file.

  • The "Delete Analysis Results" command now correctly deletes per-project analysis results and report baggage files.

  • Improved a prompt which was shown by the Configuration Wizard if it was unable to write any affected files on completion.

  • Locked out the program information (+program_info) option on the Command Line Options page if the active analysis tool is PC-lint Plus, as this directive is currently PC-lint 9.0 specific.

  • Generated PC-lint Plus command lines now escape the pathname of the stack usage report file if it contains quotes (generated PC-lint 9.0 command lines are unaffected as spaces in the pathname do not cause issues for it).

  • Fixed a bug in the parsing of ExcludedFromBuild attributes in Visual C++ 2010-2019 (.vcxproj) project files.

  • Fixed a bug which affected projects containing more than one file with the same name.

  • Fixed a bug in the parsing of cpplint analysis results of the format: "<filename>&lpar;<lineno>&rpar;: error cpplint: [<ID>] <description> [<category>]".

  • Corrected a help topic.