cpointerswarningsstm32signedness

warning: pointer targets in passing argument 3 of 'Proc_Start' differ in signedness


I have a problem with my C code for a stm32 target.

I get this error :

warning: pointer targets in passing argument 3 of 'Proc_Start' differ in signedness

I can't really figure out why, I searched the web for similar topics but none of the solutions proposed in the topics helped me.

I give you the code of where it breaks problem and the definition of the macro that registers the error

where the compilation generates the error

void AppGestRelay_Init(u8 u8lvoie)
{

//Init Dac value for alim
u16 u16lDacValue = (((41435.4-Param.vcoil[u8lvoie])/16376.2)/2.48)*1024;
DrDac_SetValueChip(u8lvoie+1, u16lDacValue);

//Init discharge mode
mProcStartParam(AppGestRelay_DischargeMode, &u8lvoie);

//test
TrackAlt[TRACK1] = ALTER_POS;

TrackRunning[u8lvoie] = TRACK_NOT;
}

definition of the macro

#define     mProcStart(fonct)               Proc_Start(fonct, NULL, (const s8*)#fonct)
#define     mProcStartParam(fonct,param)    Proc_Start(fonct, (TProcParam)(param), #fonct)

the function called with the macro

P_PROC(AppGestRelay_DischargeMode)
{

static u8 u8lvoie;

P_BEGIN;

u8lvoie = *(u8*)P_PARAM;

if(TRUE == Param.zener[u8lvoie])
{
    PcfDataW.pin7[u8lvoie] = PIN_OFF;
    printf("on\r");
    P_DELAY(mTICK_MS(10));
    PcfDataW.pin7[u8lvoie] = PIN_ON;
    printf("off\r");
}
else
{
    PcfDataW.pin6[u8lvoie] = PIN_OFF;
    printf("on\r");
    P_DELAY(mTICK_MS(10));
    PcfDataW.pin6[u8lvoie] = PIN_ON;
    printf("off\r");
}

P_EXIT();

P_CLEANUP;

P_END;
}

Thank you very much for your future help

EDIT :

I already tried but adding a 3rd argument doesn't give a warning but an error saying that the macro only takes 2 parameters

macro "mProcStartParam" passed 3 arguments, but takes just 2

The code works by slightly modifying the AppGestRelay_Init() function but there is still the warning, I would like to know where it comes from

Thanks :)

void AppGestRelay_Init(u8 u8lvoie)
{
static u8 u8lTrack;

//Init Dac value for alim
u16 u16lDacValue = (((41435.4-Param.vcoil[u8lvoie])/16376.2)/2.48)*1024;
DrDac_SetValueChip(u8lvoie+1, u16lDacValue);

//Init discharge mode
u8lTrack = u8lvoie;
mProcStartParam(AppGestRelay_DischargeMode, &u8lTrack);

//wait discharge mode is set
while(Proc_IsActif(AppGestRelay_DischargeMode))
{
P_SCHEDULE();
}

TrackRunning[u8lvoie] = TRACK_NOT;
}

SOLVE :

the warning disappears by adding the (const s8*) in front of #fonct in the definition of mProcStartParam as it is the case in the definition of mProcStart

#define     mProcStartParam(fonct,param)    Proc_Start(fonct, (TProcParam)(param), (const s8*) #fonct)

Thanks


Solution

  • Presumably the function Proc_Start requires a (signed char*) for its third argument.

    #fonct evaluates to a string, which has type (char*).

    You have already written (const s8*)#fonct in one macro, why not try that in the other?