Bug 271539 - mail/panda-cclient: fix build with clang 16
Summary: mail/panda-cclient: fix build with clang 16
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Thierry Thomas
URL:
Keywords:
Depends on:
Blocks: 271047
  Show dependency treegraph
 
Reported: 2023-05-20 19:30 UTC by Dimitry Andric
Modified: 2023-06-04 16:24 UTC (History)
0 users

See Also:
thierry: maintainer-feedback+


Attachments
mail/panda-cclient: fix build with clang 16 (8.86 KB, patch)
2023-05-20 19:30 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-05-20 19:30:12 UTC
Clang 16 has a new error about incompatible function types, which shows
up when building mail/panda-cclient:

  news.c:370:36: error: incompatible function pointer types passing 'int (struct dirent *)' to parameter of type 'int (*)(const struct dirent *)' [-Wincompatible-function-pointer-types]
    if ((nmsgs = scandir (tmp,&names,news_select,news_numsort)) >= 0) {
                                     ^~~~~~~~~~~
  /usr/include/dirent.h:127:12: note: passing argument to parameter here
              int (*)(const struct dirent *), int (*)(const struct dirent **,
                    ^
  news.c:370:48: error: incompatible function pointer types passing 'int (const void *, const void *)' to parameter of type 'int (*)(const struct dirent **, const struct dirent **)' [-Wincompatible-function-pointer-types]
    if ((nmsgs = scandir (tmp,&names,news_select,news_numsort)) >= 0) {
                                                 ^~~~~~~~~~~~
  /usr/include/dirent.h:127:44: note: passing argument to parameter here
              int (*)(const struct dirent *), int (*)(const struct dirent **,
                                                    ^

This is because the prototypes for the scandir(3) 'select' and 'compar'
callback function parameters do not match the declarations in
<dirent.h>. The same occurs in a few other files under src/osdep/unix.

Fix these by using the correct parameter types for the callback functions.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-05-20 19:30:37 UTC
Created attachment 242299 [details]
mail/panda-cclient: fix build with clang 16
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2023-05-21 09:57:16 UTC
Approved, thanks!

Do you intend to submit this patch upstream?

https://github.com/nkhorman/panda-imap
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2023-05-21 14:47:08 UTC
(In reply to Thierry Thomas from comment #2)
I can try, but it looks a bit like the program hasn't been maintained for years? Then again the GitHub repository appears to be a fork by somebody else than the original author, so maybe they have volunteered. :)
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-05-21 14:49:02 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7c711691b378bee218c41da6b803b655f2039d2d

commit 7c711691b378bee218c41da6b803b655f2039d2d
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-05-20 19:25:40 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-05-21 14:47:58 +0000

    mail/panda-cclient: fix build with clang 16

    Clang 16 has a new error about incompatible function types, which shows
    up when building mail/panda-cclient:

      news.c:370:36: error: incompatible function pointer types passing 'int (struct dirent *)' to parameter of type 'int (*)(const struct dirent *)' [-Wincompatible-function-pointer-types]
        if ((nmsgs = scandir (tmp,&names,news_select,news_numsort)) >= 0) {
                                         ^~~~~~~~~~~
      /usr/include/dirent.h:127:12: note: passing argument to parameter here
                  int (*)(const struct dirent *), int (*)(const struct dirent **,
                        ^
      news.c:370:48: error: incompatible function pointer types passing 'int (const void *, const void *)' to parameter of type 'int (*)(const struct dirent **, const struct dirent **)' [-Wincompatible-function-pointer-types]
        if ((nmsgs = scandir (tmp,&names,news_select,news_numsort)) >= 0) {
                                                     ^~~~~~~~~~~~
      /usr/include/dirent.h:127:44: note: passing argument to parameter here
                  int (*)(const struct dirent *), int (*)(const struct dirent **,
                                                        ^

    This is because the prototypes for the scandir(3) 'select' and 'compar'
    callback function parameters do not match the declarations in
    <dirent.h>. The same occurs in a few other files under src/osdep/unix.

    Fix these by using the correct parameter types for the callback functions.

    PR:             271539
    Approved by:    thierry (maintainer)
    MFH:            2023Q2

 mail/panda-cclient/Makefile                        |  2 +-
 .../files/patch-src_osdep_unix_mh.c (new)          | 35 ++++++++++++++
 .../files/patch-src_osdep_unix_mix.c (new)         | 54 ++++++++++++++++++++++
 .../files/patch-src_osdep_unix_mx.c (new)          | 35 ++++++++++++++
 .../files/patch-src_osdep_unix_news.c (new)        | 35 ++++++++++++++
 5 files changed, 160 insertions(+), 1 deletion(-)
Comment 5 Thierry Thomas freebsd_committer freebsd_triage 2023-05-21 15:03:45 UTC
(In reply to Dimitry Andric from comment #3)

Yes, the original author (Mark Crispin) died several years ago, and Neal Horman forked his repository; he accepts pull requests.