[Bug 268341] archivers/rpm4: fix build with clang 15

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 12 Dec 2022 20:35:04 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268341

            Bug ID: 268341
           Summary: archivers/rpm4: fix build with clang 15
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: rodrigo@FreeBSD.org
          Reporter: dim@FreeBSD.org
             Flags: maintainer-feedback?(rodrigo@FreeBSD.org)
          Assignee: rodrigo@FreeBSD.org

During an exp-run for llvm 15 (see bug 265425), it turned out that
archivers/rpm4 failed to build with clang 15:

  tools/rpmuncompress.c:101:23: warning: call to undeclared function
'basename'; ISO C99 and later do not support implicit function declarations
[-Wimplicit-function-declaration]
              const char *bn = basename(fn);
                               ^
  tools/rpmuncompress.c:101:18: error: incompatible integer to pointer
conversion initializing 'const char *' with an expression of type 'int'
[-Wint-conversion]
              const char *bn = basename(fn);
                          ^    ~~~~~~~~~~~~

This is because basename(3) is defined in <libgen.h>. After this include is
added to rpmuncompress.c, link errors still occur:

  ld: error: undefined symbol: WIFEXITED
  >>> referenced by rpmuncompress.c
  >>>               tools/rpmuncompress.o:(main)

  ld: error: undefined symbol: WEXITSTATUS
  >>> referenced by rpmuncompress.c
  >>>               tools/rpmuncompress.o:(main)

This is because WIFEXITED() and WEXITSTATUS() are macros defined in
<sys/wait.h>.

-- 
You are receiving this mail because:
You are the assignee for the bug.