User forums > Using Code::Blocks

Conditional defines

(1/1)

fpinkse:
Hi All,

This may well be in the wrong section, but is has to do with using Codeblocks.
It is about right mouse button menu item Find declaration of.....

I have this code

--- Code: ---#include <PIC/PIC16F874.H>
// test of #if

#define comtype 0
#if (comtype==0)
    #define ControlPort PORTA
#endif

#if (comtype==1)
    #define ControlPort PORTB
#endif

#if (comtype==2)
    #define ControlPort PORTC
#endif


// CONFIG
    static typedef unsigned int config;
    config at 0x2007 __CONFIG = _PWRTE_OFF & _BODEN_OFF & _WDT_OFF & _LVP_ON & _CPD_OFF & _DEBUG_OFF & _HS_OSC & _CP_OFF;

// main body
void main(){
    ControlPort = 0;
}
--- End code ---

When you use the right mouse button menu Find the declaration of ...on ControlPort in the main function you are directed to the very last#define of ControlPort.
I conclude the find does not obey the #if-#endif.

Is this fixable?

Note: the PORTA etc is used here as I wanted the example as small as possible without SDCC optimizing out code.

Thanks.

Frans.

stahta01:
Ask this question on a site supporting the Compiler.
I am not a user of Code Completion; but it has bugs. Need a version number of Code::Blocks for someone else to help you.

Sorry, I did not realize at first it was a Code Completion question.

Tim S.

fpinkse:
Hello Tim,

I use Code::Blocks version 8.02
My apologies for the omission.

Since the version of SDCC I use is command line driven I concluded that the right mouse menu had to come from Code::Blocks

I just wanted to report something I thought to be not logical.

Frans.

stahta01:
The Code Completion section has changed a lot. You might try the recent nightly to see if the is fixed.

I do not think it is; but, I do not use Code Completion. Note, it is possible the symbols plugin does this instead of Code Completion plugin.

Tim S.

Navigation

[0] Message Index

Go to full version