This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI C/C++ Compiler
Given the source file main.c
#define FOO 1 #define FOO 4 int main(void) { return 0; }
If we compile with MISRA rule 20.1 enabled, or any combination of rules including 20.1:
Building file: "../main.c"
Invoking: ARM Compiler
"/home/user/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/bin/armcl" -mv4 --code_state=32 --include_path="/home/user/ccs_workspace_v8/asdasd" --include_path="/home/user/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --check_misra="20.1" --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
Finished building: "../main.c"
Withouth this check, we can see that we get warning #48-D, as we should.
Building file: "../main.c"
Invoking: ARM Compiler
"/home/user/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/bin/armcl" -mv4 --code_state=32 --include_path="/home/user/ccs_workspace_v8/asdasd" --include_path="/home/user/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.2.LTS/include" -g --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="main.d_raw" "../main.c"
"../main.c", line 7: warning #48-D: incompatible redefinition of macro "FOO" (declared at line 6)
Finished building: "../main.c"
Is this a bug?
Thank you for reporting this problem, and for providing a concise test case. I can reproduce the same result. I filed CODEGEN-5563 in the SDOWP system to have this investigated. You are welcome to follow it with the SDOWP link below in my signature.
Thanks and regards,
-George