RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Fri Nov 25, 2016 5:52 am |
|
|
The "pointer types do not match" warnings are warnings - they do not say something is wrong with the code, just that something is a bit odd and may have a problem. In this case there is NO problem, the code will work correctly as is.
The warning appeared only with fairly recent compilers as CCS implemented stronger type checking. The warning did not appear until well into version 5. Read the other recent thread on "pointer types do not match" for more details.
The warning is there because can_set_id() is declared as:
Code: | void can_set_id(unsigned int* addr, unsigned int32 id, int1 ext) |
and the address parameter in the CCS code is from a macro definition that uses getenv. Getenv returns an address, which is what is wanted, but of an unknown type, and the evidence suggests its NOT unsigned int*. Really, what it should be is that can_set_id() was defined as:
Code: |
void can_set_id(void* addr, unsigned int32 id, int1 ext) |
but until very recently even that would have still generated the warnings! The latest compiler should not generate the warnings with void*.
You can ignore the warnings.
What I am more concerned about is the warning that interrupts are being disabled on can_set_id. That means you are calling it in both main code AND interrupt code. That is NOT a good idea. I can see little or no reason for calling it in interrupt code. The ID filters generally only need to be set once at start-up/initialisation and then left alone. |
|