Krzysztof Kozlowski
|
a785bd1ab1
|
list: fix clang -Wcast-align on container_of
Cast via (void *) to fix -Wcast-align clang and GCC on armv7
(arm-linux-gnueabi-gcc) warning for container_of:
device.c:91:2: warning: cast from 'char *' to 'typeof (*(device)) *' (aka 'struct device *') increases required alignment from 1 to 8 [-Wcast-align]
list_for_each_entry(device, &devices, node) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./list.h:91:14: note: expanded from macro 'list_for_each_entry'
for (item = list_entry_first(list, typeof(*(item)), member); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./list.h:85:2: note: expanded from macro 'list_entry_first'
container_of((list)->next, type, member)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./list.h:39:3: note: expanded from macro 'container_of'
(type *)((char *)__mptr - offsetof(type, member)); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
|
2023-05-08 15:02:37 -05:00 |
|
Krzysztof Kozlowski
|
2af3911be5
|
list: drop unneeded const to fix -Wcast-qual
Fixes:
device.c: In function ‘device_info’:
list.h:39:26: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
39 | (type *)((char *)__mptr - offsetof(type, member)); \
| ^
list.h:85:9: note: in expansion of macro ‘container_of’
85 | container_of((list)->next, type, member)
| ^~~~~~~~~~~~
list.h:91:21: note: in expansion of macro ‘list_entry_first’
91 | for (item = list_entry_first(list, typeof(*(item)), member); \
| ^~~~~~~~~~~~~~~~
device.c:303:9: note: in expansion of macro ‘list_for_each_entry’
303 | list_for_each_entry(device, &devices, node) {
| ^~~~~~~~~~~~~~~~~~~
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
|
2023-05-08 15:02:37 -05:00 |
|