[pacman-dev] Clang warnings
Rikard Falkeborn
rikard.falkeborn at gmail.com
Thu Dec 31 13:32:45 UTC 2015
There are some warnings recently introduced when compiling with Clang (with
--enable-warningflags) for x86_64. The warnings are related to casting of
specific alpm_event-types to alpm_event_t where the required alignment
differs between the types. On x86, it shouldn't be a problem, but maybe
there are other architectures pacman should work on where this is a real
issue?
Either way, I think it would be good if pacman built cleanly with Clang. Any
suggestions on how to fix this?
For reference, the warnings are:
hook.c:732:3: warning: cast from 'alpm_event_hook_t *' (aka 'struct
_alpm_event_hook_t *') to 'alpm_event_t *' (aka 'union _alpm_event_t *')
increases required alignment from 4 to 8 [-Wcast-align]
EVENT(handle, &event);
^~~~~~~~~~~~~~~~~~~~~
./handle.h:37:16: note: expanded from macro 'EVENT'
(h)->eventcb((alpm_event_t *) (e)); \
^~~~~~~~~~~~~~~~~~~~
hook.c:761:3: warning: cast from 'alpm_event_hook_t *' (aka 'struct
_alpm_event_hook_t *') to 'alpm_event_t *' (aka 'union _alpm_event_t *')
increases required alignment from 4 to 8 [-Wcast-align]
EVENT(handle, &event);
^~~~~~~~~~~~~~~~~~~~~
./handle.h:37:16: note: expanded from macro 'EVENT'
(h)->eventcb((alpm_event_t *) (e)); \
^~~~~~~~~~~~~~~~~~~~
2 warnings generated.
trans.c:202:2: warning: cast from 'alpm_event_any_t *' (aka 'struct
_alpm_event_any_t *') to 'alpm_event_t *' (aka 'union _alpm_event_t *')
increases required alignment from 4 to 8 [-Wcast-align]
EVENT(handle, &event);
^~~~~~~~~~~~~~~~~~~~~
./handle.h:37:16: note: expanded from macro 'EVENT'
(h)->eventcb((alpm_event_t *) (e)); \
^~~~~~~~~~~~~~~~~~~~
trans.c:226:3: warning: cast from 'alpm_event_any_t *' (aka 'struct
_alpm_event_any_t *') to 'alpm_event_t *' (aka 'union _alpm_event_t *')
increases required alignment from 4 to 8 [-Wcast-align]
EVENT(handle, &event);
^~~~~~~~~~~~~~~~~~~~~
./handle.h:37:16: note: expanded from macro 'EVENT'
(h)->eventcb((alpm_event_t *) (e)); \
^~~~~~~~~~~~~~~~~~~~
More information about the pacman-dev
mailing list