This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[CMSIS-Driver] Rationale of volatile in type of GetStatus

Dears,

Whould you please help me understanding why "volatile" has been introduced since CMSIS-Driver v2.2 into the "status" type?

For instance, here : https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Driver/Include/Driver_I2C.h

Basically, ARM_I2C_STATUS (or other "status" types) are returned by GetStatus(); and, the corresponding data structure does not appear to me to be accessed directly.

Unless I am mistaken, a declaration a volatile function makes no sense as the compiler never (and could not if it wanted to) optimize functions outputs.

Defining the "status" as volatile leads to GetStatus to be declared with this qualifier.

This is not a mistake; but, it leads the compiler to complain about the declaration (gcc-arm-... -Wall -Wextra)

Would you please help me to understand the rationale of such qualifier into the type definition?

Of course, the compiler does not generate an error message but I would like to clean up the output and avoid any warning.  Is there any mean to tell the compiler this construction is acceptable?

I thank you for you help,
KR,
Seb

0