Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Excluded files from build still included in codan
icon5.gif  Excluded files from build still included in codan [message #1754383] Fri, 17 February 2017 02:23 Go to next message
Eclipse UserFriend
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 #1754493 is a reply to message #1754383] Sat, 18 February 2017 13:37 Go to previous messageGo to next message
Eclipse UserFriend
You can't AFAIK.
The file will be ignored as long as you don't open it.
You could add code at the top specifically for the parser with
#ifdef __CDT_PARSER__
:
#endif

Anything within this block will only be seen by the parser.

Generally though, assuming the errors are caused by missing includes, I've always considered a file that relies on includes but doesn't specify them to be bad practice.
Re: Excluded files from build still included in codan [message #1755098 is a reply to message #1754493] Tue, 28 February 2017 02:12 Go to previous messageGo to next message
Eclipse UserFriend
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 08:58 Go to previous messageGo to next message
Eclipse UserFriend
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 09:50] by Moderator

Re: Excluded files from build still included in codan [message #1756338 is a reply to message #1755153] Wed, 15 March 2017 10:33 Go to previous messageGo to next message
Eclipse UserFriend
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 10:34] by Moderator

Re: Excluded files from build still included in codan [message #1756345 is a reply to message #1756338] Wed, 15 March 2017 11:57 Go to previous message
Eclipse UserFriend
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.


Previous Topic:Toggle Source/Header is not working with C files
Next Topic:Compiling Boost on CDT
Goto Forum:
  


Current Time: Sat Jul 05 05:13:46 EDT 2025

Powered by FUDForum. Page generated in 0.04961 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top