G++ bug?
LeonPollak
leonp@plris.com
Wed Apr 11 11:03:00 GMT 2007
I can not understand this and suspect this to be a bug (after consulting with
several more programmers).
Below is the description.
I have some *.h file which contains the following:
enum PinDir {DIR0=0, DIR1=1, IN=0, OUT=1};
enum PinPar {PAR0=0, PAR1=1, GPIO=0, PERIPH=1};
enum PinODR {ODR0=0, ODR1=1};
enum PinSO {SO0 =0, SO1 =1};
enum PinINT {INT0=0, INT1=1, SET=1, CLR=0};
enum Ports {PortA, PortB, PortC, PortD};
class __PinsIO {
struct __Port{
volatile unsigned long DIR;
volatile unsigned long PAR;
volatile unsigned long SO;
volatile unsigned long ODR;
volatile unsigned long DAT;
};
__Port *pPortA __attribute__ ((packed));
__Port *pPortB __attribute__ ((packed));
__Port *pPortC __attribute__ ((packed));
__Port *pPortD __attribute__ ((packed));
public:
__PinsIO();
void Define(Ports Port, short PinNum, PinDir Dir, PinPar Par, bool
Dat); /*CALLED*/
void Define(Ports Port, short PinNum, PinDir Dir, PinPar Par);
void Define(Ports Port, short PinNum, PinDir Dir, PinPar Par, PinODR
Odr);
void Define(Ports Port, short PinNum, PinDir Dir, PinPar Par, PinODR
Odr, bool Dat);
void Define(Ports Port, short PinNum, PinDir Dir, PinPar Par, PinSO
So, PinINT Int);
void DefineInt(Ports Port, short PinNum);
} PinsIO;
In some other cpp file (which, of course, includes the file above) I have
written the following:
PinsIO.Define(PortC, 24, DIR0, PAR1, SO1);
Today, considering this, I expect gcc to issue the error message - no
corresponding prototype found. Instead, gcc silently compiles the code and
calls the first function in the list marked with /*CALLED*/.
I shall be really thankfull for any possible hints and helps.
--
View this message in context: http://www.nabble.com/G%2B%2B-bug--tf3558625.html#a9937176
Sent from the gcc - Help mailing list archive at Nabble.com.
More information about the Gcc-help
mailing list