Hi

I have been trying to eliminate all warnings at -Wextra for RTEMS before we
make our next major release. There were a handful of cases where
-Wignored-qualifiers. I understand it is meaningless to have qualifiers on
scalar return values, but I was hoping someone here might have more to add
for rationale than "has no effect".

Is there any coding standard (MISRA, JPL, etc.) where this is explicitly
forbidden? Or mentioned?

-Wignored-qualifiers (C and C++ only)
Warn if the return type of a function has a type qualifier such as const.
For ISO C such a type qualifier has no effect, since the value returned by
a function is not an lvalue. For C++, the warning is only emitted for
scalar types or void. ISO C prohibits qualified void return types on
function definitions, so such return types always receive a warning even
without this option.

I have attached a simple C function which generates the warning if that
helps anyone.

Thanks.

--Joel Sherrill
RTEMS

Attachment: ignored-qualifier.c
Description: Binary data

Reply via email to