News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Conditional defines

Started by fpinkse, March 13, 2010, 01:06:41 PM

Previous topic - Next topic

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
#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;
}


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

#1
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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]