8051sdcc

SDCC compile warning 88: cast of LITERAL value to 'generic' pointer


I got Warning at code "CT_PD->bank = PDbank", Warning happens as long as "CT_PD->...", I have no idea to solve it. Can anyone know what to do?

warning message:: warning 88: cast of LITERAL value to 'generic' pointer from type 'const-int literal' to type 'struct __00000000 generic* fixed'


typedef struct  {
    uint8_t bank;
    .....
    uint8_t xxx;
} CT_PD_Type;
#define PDbank  0x24
#define REGISTER_BASE     0x2000 //register address base
#define CT_PD                 ((CT_PD_Type *) REGISTER_BASE)

void blockWait(uint32_t dura_ms){
    uint32_t expire, duration;
    duration = PE_timer_freq/1000*dura_ms;
    CT_PD->bank = PDbank;
    expire = (CT_PD->timercounter) + duration;
    while(1){
        if (CT_PD->timercounter > expire)
            break;
    }
}


Solution

  • Chapter 3.3.4 of the fine manual says:

    --disable-warning <nnnn> Disable specific warning with number <nnnn>.

    So you might want to try to add --disable-warning 88 to your compiler command line.


    Chapter 3.16 of the fine manual says:

    SDCC supports the following #pragma directives:

    [...]

    disable_warning <nnnn> - the compiler will not warn you anymore about warning number <nnnn>.

    So you can add #pragma disable_warning 88 to your source, as an alternative.