| Author |
Topic  |
|
|
azur
Ketchup Master
   
Germany
65 Posts |
Posted - Nov 12 2026 : 04:28:33 AM
|
How can I suppress a specific message? In my case: "included header stdafx.h is not used directly" I don't want to suppress the hole 'misc-include-cleaner' because it's helpful. |
|
|
feline
Whole Tomato Software
    
United Kingdom
19428 Posts |
Posted - Nov 12 2026 : 08:11:07 AM
|
Easy if you know how Consider the following two lines:
#include <set>
#include <vector> // vaCI:skip:misc-include-cleaner - skip the single check "misc-include-cleaner" for this single line
by default both are being flagged by project wide code inspection. The comment disables this single check on this single line.
This is documented here:
https://wholetomato.fogbugz.com/f/page?W760
and you can do quite a few other things, but personally I favour this approach, since it keeps the skipped checks as small and narrow as possible, to make sure you aren't accidentally turning off code inspection across entire functions or files. |
zen is the art of being at one with the two'ness |
 |
|
|
azur
Ketchup Master
   
Germany
65 Posts |
Posted - Nov 13 2026 : 03:23:58 AM
|
Thanks, that helps me in this specific case. However, I have another issue. I have an `xxx.h` file with:
namespace a::b::c {
void hallo();
}
namespace a::b {
void test();
}
In an implementation file, I have:
#include "xxx.h"
...
a::b::test();
...
In this instance, I also get the "misc-include-cleaner" warning. |
 |
|
|
feline
Whole Tomato Software
    
United Kingdom
19428 Posts |
Posted - Nov 13 2026 : 11:45:24 AM
|
I am testing with VS2022 and VA 2636 under Windows 11, in case this matters.
I don't think I have the right test for your second problem. I have started with a simple C++ 17 console solution. Compiling as C++ 17 since I don't know if you have previously defined the namespaces individually or not.
In the header file "code_inspect_namespace_test.h" I have:
namespace FELINE::BLAZE::TESTING_DEEP
{
void testFunctionThreeSpacesDeep() { }
}
namespace FELINE::BLAZE
{
void testFunctionTwoSpacesDeep() { }
} this is the first, and only place that these namespaces are declared.
In the main cpp file I have:
#include "code_inspect_namespace_test.h"
int main()
{
FELINE::BLAZE::testFunctionTwoSpacesDeep();
void *pSimplePtr = NULL;
std::cout << "Hello World!\n";
}
Code Inspection is only picking up NULL should be nullptr. Nothing for the #include statement.
If you have a small code sample you are able to send me, you can email me at [email protected], no need to post anything publicly. Any code would be treated as confidential, and only used to pin down the bug. Not sure if this helps or not, but worth saying in case it does help. |
zen is the art of being at one with the two'ness |
 |
|
|
peterchen
Tomato Guru
    
127 Posts |
Posted - Nov 23 2026 : 09:59:44 AM
|
Attaching to the original question, as I have the same problem: stdafx.h is the (old) default name for precompiled headers - i.e., it needs to be included and will likely always flag this warning. (the new name is pch.h)
Would it be possible to have an option to automatically exclude this warning if it relates to the precompiled header file configured? (or, eaiser to implement, usies one of the common names)
i.e., suppress the "not used directly" warning only for stdafx.h, but not for other headers
|
 |
|
|
feline
Whole Tomato Software
    
United Kingdom
19428 Posts |
Posted - Nov 23 2026 : 12:25:48 PM
|
Depending on your VA settings, this I can help with.
Go into VA Options dialog:
VA Options -> Code Inspection -> Checker Sets
use the filter field at the bottom of the list, and search for:
misc-include-cleaner
Now press on the gear / settings icon at the right hand side of the entry for this checker, then you can set the "Semicolon-separated list of regexes..." settings to "stdafx"
I was just double checking this here when I ran into a bug. This setting works as expected if you are using Code Inspection in single file mode. However, the setting is being ignored if you are using Code Inspection in project wide mode. Very unexpected, and rather unhelpful. |
zen is the art of being at one with the two'ness |
 |
|
| |
Topic  |
|