Part Number: CCSTUDIO
Other Parts Discussed in Thread: HALCOGEN, TMS570LS1227
code:
typedef int sint32;
typedef unsigned char uint8;
typedef unsigned int uint32;
typedef enum{
JOB_OK,
JOB_FAILED,
JOB_PENDING,
JOB_CANCELLED,
BLOCK_INCONSISTENT,
BLOCK_INVALID
}TI_FeeJobResultType;
typedef enum{
FEE_JobDone,
FEE_JobBusy,
FEE_JobFail
}FEE_JobStatus;
TI_FeeJobResultType TI_Fee_GetJobResult(uint8 u8EEPIndex);
TI_FeeJobResultType TI_Fee_GetJobResult(uint8 u8EEPIndex){
return JOB_OK;
}
FEE_JobStatus FEE_GetJobStatus(void);
FEE_JobStatus FEE_GetJobStatus(void){
FEE_JobStatus jobStatus;
TI_FeeJobResultType jobResult=TI_Fee_GetJobResult(0U);
sint32 j=(jobResult==JOB_OK);
jobStatus= (j ? FEE_JobDone : FEE_JobFail);//line 29
return jobStatus;
}
Compile command:
armcl --misra_required=warning --misra_advisory=warning --check_misra="advisory,required" --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.7.LTS/include" -ps a.c
Compiler message:
"a.c", line 29: warning: (MISRA-C:2004 10.1/R) The value of an expression of integer type shall not be implicitly converted to a different underlying type if the expression is complex
The Misra C 2004 rule 10.1 is concerned with implicit integer type promotion.
10.1: The value of an expression of integer type shall not be implicitly converted to a different underlying type if
A) it is not a conversion to a wider integer type of the same signedness, or
B) the expression is complex, or
C) the expression is not constant and is a function argument, or
D) the expression is not constant and is a return expression.
If you change line 29 to the following simple statements, the warning will be gone:
if (j){
jobStatus = FEE_JobDone;
}else{
jobStatus = FEE_JobFail;
}