Excluded files from build still included in codan [message #1754383] |
Fri, 17 February 2017 07:23 |
|
Hello,
is there a way, that files which are opend and also excluded from build also be esxcluded from error checking?
I have several configurations and there are different files excluded. If I change configuration and I have a file opened, which is not included in this configuration, I get many errors.
Is there a way, that this files get ignored?
Thx
|
|
|
|
Re: Excluded files from build still included in codan [message #1755098 is a reply to message #1754493] |
Tue, 28 February 2017 07:12 |
|
Thx for your answere.
There are no missing Includes, but there are different targets (configurations) in 1 projekt and not every target (configuration) has every c-file linked.
For me it's annoying to get every time errors if I switch between these targets and if I had a filed opened, wich is not included in both. These errors, I have to manually delete every time.
|
|
|
Re: Excluded files from build still included in codan [message #1755153 is a reply to message #1755098] |
Tue, 28 February 2017 13:58 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
Then I'm not sure I understand your problem.
Does the file contain code snippets or something that otherwise wouldn't compile?
CODAN doesn't care whether the file is linked (or not linked) to an executable.
If it has no missing includes (IOW: missing definitions) then it must be syntactically incorrect if you are getting errors.
Preprocessor conditioning on __CDT_PARSER__ to make the file compilable should circumvent CODAN problems.
[Updated on: Tue, 28 February 2017 14:50] Report message to a moderator
|
|
|
Re: Excluded files from build still included in codan [message #1756338 is a reply to message #1755153] |
Wed, 15 March 2017 14:33 |
|
Hello,
I try it with an example:
Header.h
#if defined(CONFIG1)
typedef unsigned long ulong;
#endif
File.c
#include "Header.h"
ulong test = 0;
In configuration 1 the CONFIG1ist set, in configuration 2 not, but the file is excluded from configuration 2.
If file is opened in configuration 1, there is no problem.
But if i switch to configuration 2 and this file is still opened, I get all error of that file. (Alltough it is not included in the configuration.)
In my oppinion in configuration 2 the hole lines of this file should be grayed out like no active code and no errors should be prompt.
Hope this helps to understand it.
Thx
Regards
[Updated on: Wed, 15 March 2017 14:34] Report message to a moderator
|
|
|
Re: Excluded files from build still included in codan [message #1756345 is a reply to message #1756338] |
Wed, 15 March 2017 15:57 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
You have a missing definition: CONFIG1 is undefined.
Actually, its definition status will likely be hit or miss.
I have a C file where the definition comes and goes.
The Indexer doesn't handle defines very well
Because of caching, a dependent preprocessor definition might be wrong.
If the Indexer thinks the CONFIG1 is undefined then so will CODAN.
To make this always work with CODAN, you could try
#if defined(CONFIG1) || defined(__CDT_PARSER__)
typedef unsigned long ulong;
#endif
This will force the code block to be included when the CODAN reads the file.
This could be a real nuisance if you have a lot of them.
The key though is to make the file stand alone without errors when CODAN looks at it.
|
|
|
Powered by
FUDForum. Page generated in 0.03093 seconds