Use typeof() to make ASSUME_ALIGNED() type safe

Use gcc typeof() to cast the output of ASSUME_ALIGNED() back into the
type of its argument. This lets the compiler report type mismatches.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2022-01-28 18:38:59 +00:00 committed by Liam Girdwood
parent bd54434a2f
commit 2cbca2f20e
1 changed files with 1 additions and 1 deletions

View File

@ -179,7 +179,7 @@
* alignment. This compiler builtin may not be available on all compilers so
* this macro can be defined as NULL if needed.
*/
#define ASSUME_ALIGNED(x, a) __builtin_assume_aligned(x, a)
#define ASSUME_ALIGNED(x, a) ((typeof(x))__builtin_assume_aligned((x), a))
#endif /* __XCC__ */
#endif /* __ASSEMBLER__ */