I am working on a large and complicated project. For each platform we support, it would have a set of generated defines which are used to build the executable with.
The problem is that the number of defines is so large that it exceeds the allowable 8191 string limit that I can pass into Windows Command Prompt.
To help manage the string limit, I am doing the following
* Use a suppressions list
* Use an includes-file
Even with this, I exceed the string length limit due to how many defines are in use. Note that some of these defines are builtin compiler defines. But I am including them for now, as I have found without them, there are issues.
I thought I was being clever by creating a custom config file. For example, Android is one of the platforms we support, so in that case one would include this in the command line: "--library=android.cfg". Where the cfg is has all of the defines. For example, here is a tiny portion of the cfg
There is more, I just included it to provide better context.
So I ended up using a mixture of: defines defined in cfg and some explictly listed as command line arguments. This seemed to work just fine, so decided to collapse all the defines into the cfg. After doing this, I found that the performance of cppcheck tanked. When I had a mixture of the two, it would finish a few minutes (like 5 minutes). Now it takes 30 minutes to an hour. It appears like it is trying to go through different configurations and I'm not sure how to disable that and make it use all defines as is.
When I had some command line -D and the cfg it looked something like this (note there are more defines than this, and these are example defines as I need to redact info on the project)
I also want to note that when I run with the mixed mode (-D and cfg), then I do see the defines which were passed in with -D in the Defines list. I don't see the defines in the cfg.
Last edit: Ben 2024-10-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I reviewed the code as well as ran it through the debugger.
So behavior seems to be that if I am missing any explicit -D, then it will try and iterate through config permutations which takes up time.
It does appear createDUI will build the defines based on the combo of any userDefines and library mDefines. I guess the rule for defines is the first one found is the one used?
Anyways, I guess what I need to do is have a stub -D to make this work?
It would be nice if there was an argument such as --defines-file
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I am working on a large and complicated project. For each platform we support, it would have a set of generated defines which are used to build the executable with.
The problem is that the number of defines is so large that it exceeds the allowable 8191 string limit that I can pass into Windows Command Prompt.
To help manage the string limit, I am doing the following
* Use a suppressions list
* Use an includes-file
Even with this, I exceed the string length limit due to how many defines are in use. Note that some of these defines are builtin compiler defines. But I am including them for now, as I have found without them, there are issues.
I thought I was being clever by creating a custom config file. For example, Android is one of the platforms we support, so in that case one would include this in the command line: "--library=android.cfg". Where the cfg is has all of the defines. For example, here is a tiny portion of the cfg
<def format="2">
<define name="__llvm__" value="1">
<define name="__clang__" value="1">
</define></define></def>
There is more, I just included it to provide better context.
So I ended up using a mixture of: defines defined in cfg and some explictly listed as command line arguments. This seemed to work just fine, so decided to collapse all the defines into the cfg. After doing this, I found that the performance of cppcheck tanked. When I had a mixture of the two, it would finish a few minutes (like 5 minutes). Now it takes 30 minutes to an hour. It appears like it is trying to go through different configurations and I'm not sure how to disable that and make it use all defines as is.
When I had some command line -D and the cfg it looked something like this (note there are more defines than this, and these are example defines as I need to redact info on the project)
"c:\Program Files\Cppcheck\cppcheck.exe" -v -DDEFINE0 -DDEFINE1 -DDEFINE2 -DETC --library=android.cfg --suppress=missingIncludeSystem --enable=all --check-level=exhaustive --xml --output-file=cppcheck-report-20241028a.xml --xml --includes-file=includes.txt src\android
Then when I collapsed all defines into the cfg it looked like this
"c:\Program Files\Cppcheck\cppcheck.exe" -v --library=android.cfg --suppress=missingIncludeSystem --enable=all --check-level=exhaustive --xml --output-file=cppcheck-report-20241028b.xml --xml --includes-file=includes.txt src\android
I know the "precise" configuration of defines I need to use.
Is there a way to pass in all the defines I need through a file? Basically the equivalent of "--includes-file" but for defines?
I also want to note that when I run with the mixed mode (-D and cfg), then I do see the defines which were passed in with -D in the Defines list. I don't see the defines in the cfg.
Last edit: Ben 2024-10-28
I reviewed the code as well as ran it through the debugger.
So behavior seems to be that if I am missing any explicit -D, then it will try and iterate through config permutations which takes up time.
It does appear createDUI will build the defines based on the combo of any userDefines and library mDefines. I guess the rule for defines is the first one found is the one used?
Anyways, I guess what I need to do is have a stub -D to make this work?
It would be nice if there was an argument such as --defines-file