Paul Goyette wrote:
IMHO, we should actually fix the issue, rather than hide it. But my
goal here is only to get the port (and as many others as possible)
to build, so I would defer to arm users to make a decision on how to
proceed.
I don't see any issue with this. Let say you want to assign __swp return
to some variable x:
__cpu_simple_lock_t x = __swp(val, ptr);
__swp will discard volatile but the initialization of x will bring it
back.
There are no reference types in C and hence it can't be missing '&' in
the return type. If there was an explicit 'volatile' in the return type,
it'd be probably an oversight but volatile is a part of typedef.
A very similar issue has been fixed for C++ code [1]. The code below
generates only one warning at line 5:
template<class T>
const T foo() { static T t; return t; }
typedef const int T;
const T bar() { return 0; }
int main()
{
return foo<int>() + bar();
}
IMO, this warning if for information only and it doesn't mix with -Werror.