[pacman-dev] [PATCH v3 3/4] Declare alpm_pkg_get_(origin|reason) to return int

Allan McRae allan at archlinux.org
Mon Oct 17 12:17:00 UTC 2016


On 13/10/16 06:13, ivy.foster at gmail.com wrote:
> From: Ivy Foster <ivy.foster at gmail.com>
> 
> These functions can return -1 on error, which is not included in the
> enumerated types they were declared to return.
> 
> Signed-off-by: Ivy Foster <ivy.foster at gmail.com>
> ---


be_local.c: In function ‘alpm_pkg_set_reason’:
be_local.c:1124:30: error: comparison between signed and unsigned
integer expressions [-Werror=sign-compare]
  if(alpm_pkg_get_reason(pkg) == reason) {
                              ^~

You can use --enable-warningflags to build with many of our current
warning flags enabled.

Why change the return to an int and not add an UNKNOWN value to the enum
(with value 0 or 1 << 30)?

Allan


More information about the pacman-dev mailing list