Thanks to feedback from Andrew, I have revised the patch[1] I recently
sent in that tries to fix a class of warning offered by clang,
-Wassign-enum. To make review a bit easier, I've split it into
separate patches, based on the cause of the warning in question.

Patch 1: Functions returning _alpm_errno_t return 0 when there is no
error. This patch just names that 0 ALPM_ERR_OK, making the convention
explicit.

Patch 2: This is the biggest one. Many variables are actually integer
bitfields, but are declared to be a member of the enumerated type used
to create or check the bitfield. Thanks to Andrew pointing me in the
right direction, I caught some that clang didn't (because they were
technically enums, but conceptually still being used as bitfields).
Quite a bit of git grepping and following the chain of function calls
leads me to believe that I got 'em all.

Patch 3: alpm_pkg_get_origin and alpm_pkg_get_reason are declared to
return enums, but may return -1 on error. They've been declared int,
instead.

Patch 4: After all that, this patch adds -Wassign-enum to
configure.ac, for anyone building with clang and with warnings
enabled.

As always, I welcome critiques.

Enjoy,
Ivy

[1]: https://lists.archlinux.org/pipermail/pacman-dev/2016-September/021383.html

Reply via email to