[pacman-dev] Clang warnings

Allan McRae allan at archlinux.org
Fri Jan 1 13:03:22 UTC 2016


On 01/01/16 22:01, Olivier Brunel wrote:
> On Thu, 31 Dec 2015 14:32:45 +0100
> Rikard Falkeborn <rikard.falkeborn at gmail.com> wrote:
> 
>> 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?
> 
> I think the only way is not to use a specific event type but the
> generic one, to ensure the size is correct. I don't have clang so I
> didn't test this, but I think there are two ways to solve this.
> 
> Basically the issue is when using code such as:
> 
> alpm_event_hook_run_t event;
> event.type = ALPM_EVENT_HOOK_RUN_START;
> event.name = name;
> event.desc = desc;
> EVENT(handle, &event);
> 
> So we could either use the alpm_event_t and always go into the right
> union member, e.g:
> 
> alpm_event_t event;
> event.hook_run.type = ALPM_EVENT_HOOK_RUN_START;
> event.hook_run.name = name;
> event.hook_run.desc = desc;
> EVENT(handle, &event);
> 

I'd prefer this way but...

What is different with these events than all the others? Why do the old
ones not give warnings? We should be consistent here. I have a feeling
we have had this conversation before...

Allan


More information about the pacman-dev mailing list