Bug 268204 - mail/dovecot: fix build with clang 15
Summary: mail/dovecot: fix build with clang 15
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: Larry Rosenman
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-06 19:16 UTC by Dimitry Andric
Modified: 2022-12-25 18:14 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (ler)


Attachments
mail/dovecot: fix build with clang 15 (7.09 KB, patch)
2022-12-06 19:18 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 2022-12-06 19:16:37 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that mail/dovecot failed to build with clang 15:

ioloop-notify-kqueue.c:70:2: error: call to undeclared function 'i_gettimeofday'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        i_gettimeofday(&ioloop_timeval);
        ^
ioloop-notify-kqueue.c:70:2: note: did you mean 'gettimeofday'?
/usr/include/sys/time.h:617:5: note: 'gettimeofday' declared here
int     gettimeofday(struct timeval *, struct timezone *);
        ^

...
--- test-mail-index-transaction-update.o ---
test-mail-index-transaction-update.c:633:14: warning: comparison of function 'timezone' equal to a null pointer is always false [-Wtautological-pointer-compare]
        test_assert(timezone == 0);
                    ^~~~~~~~    ~
../../src/lib-test/test-common.h:20:8: note: expanded from macro 'test_assert'
        if (!(code)) test_assert_failed(#code, __FILE__, __LINE__); \
              ^~~~
test-mail-index-transaction-update.c:633:14: note: prefix with the address-of operator to silence this warning
        test_assert(timezone == 0);
                    ^
                    &
../../src/lib-test/test-common.h:20:8: note: expanded from macro 'test_assert'
        if (!(code)) test_assert_failed(#code, __FILE__, __LINE__); \
              ^
test-mail-index-transaction-update.c:648:42: warning: arithmetic on a pointer to the function type 'char *(int, int)' is a GNU extension [-Wgnu-pointer-arith]
                hdr.day_stamp = tests[i].old_day_stamp + timezone;
                                                       ^ ~~~~~~~~
test-mail-index-transaction-update.c:648:17: error: incompatible pointer to integer conversion assigning to 'uint32_t' (aka 'unsigned int') from 'char *(*)(int, int)' [-Wint-conversion]
                hdr.day_stamp = tests[i].old_day_stamp + timezone;
                              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test-mail-index-transaction-update.c:650:49: warning: arithmetic on a pointer to the function type 'char *(int, int)' is a GNU extension [-Wgnu-pointer-arith]
                mail_index_update_day_headers(t, tests[i].now + timezone);
                                                              ^ ~~~~~~~~
test-mail-index-transaction-update.c:650:36: error: incompatible pointer to integer conversion passing 'char *(*)(int, int)' to parameter of type 'time_t' (aka 'long') [-Wint-conversion]
                mail_index_update_day_headers(t, tests[i].now + timezone);
                                                 ^~~~~~~~~~~~~~~~~~~~~~~
./mail-index-transaction-private.h:127:77: note: passing argument to parameter 'day_stamp' here
void mail_index_update_day_headers(struct mail_index_transaction *t, time_t day_stamp);
                                                                            ^
test-mail-index-transaction-update.c:654:63: warning: arithmetic on a pointer to the function type 'char *(int, int)' is a GNU extension [-Wgnu-pointer-arith]
                test_assert_idx(new_hdr.day_stamp == tests[i].new_day_stamp + timezone, i);
                                                                            ^ ~~~~~~~~
../../src/lib-test/test-common.h:26:9: note: expanded from macro 'test_assert_idx'
                if (!(code)) test_assert_failed_idx(#code, __FILE__, __LINE__, i); \
                      ^~~~
test-mail-index-transaction-update.c:654:37: warning: comparison between pointer and integer ('uint32_t' (aka 'unsigned int') and 'char *(*)(int, int)') [-Wpointer-integer-compare]
                test_assert_idx(new_hdr.day_stamp == tests[i].new_day_stamp + timezone, i);
                                ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../src/lib-test/test-common.h:26:9: note: expanded from macro 'test_assert_idx'
                if (!(code)) test_assert_failed_idx(#code, __FILE__, __LINE__, i); \
                      ^~~~

Fix these warnings and errors by importing:
https://github.com/dovecot/core/commit/e983ead775671186b3c8567d59973d2e52b678c7
https://github.com/dovecot/core/commit/1a7b1f66fe4b86cb642dbcfe5a0192c1b77d0e17
https://github.com/dovecot/core/commit/867a37fa7b74f798a931fb582214b5377f57610e
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-06 19:18:17 UTC
Created attachment 238580 [details]
mail/dovecot: fix build with clang 15
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-12-25 17:55:21 UTC
A commit in branch main references this bug:

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

commit b43593bdbcffc2cca86191c52a45aebf5ad25617
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-06 18:43:51 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-12-25 17:48:02 +0000

    mail/dovecot: fix build with clang 15

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

      ioloop-notify-kqueue.c:70:2: error: call to undeclared function 'i_gettimeofday'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
              i_gettimeofday(&ioloop_timeval);
              ^
      ioloop-notify-kqueue.c:70:2: note: did you mean 'gettimeofday'?
      /usr/include/sys/time.h:617:5: note: 'gettimeofday' declared here
      int     gettimeofday(struct timeval *, struct timezone *);
              ^
      ...
      --- test-mail-index-transaction-update.o ---
      test-mail-index-transaction-update.c:633:14: warning: comparison of function 'timezone' equal to a null pointer is always false [-Wtautological-pointer-compare]
              test_assert(timezone == 0);
                          ^~~~~~~~    ~
      ../../src/lib-test/test-common.h:20:8: note: expanded from macro 'test_assert'
              if (!(code)) test_assert_failed(#code, __FILE__, __LINE__); \
                    ^~~~
      test-mail-index-transaction-update.c:633:14: note: prefix with the address-of operator to silence this warning
              test_assert(timezone == 0);
                          ^
                          &
      ../../src/lib-test/test-common.h:20:8: note: expanded from macro 'test_assert'
              if (!(code)) test_assert_failed(#code, __FILE__, __LINE__); \
                    ^
      test-mail-index-transaction-update.c:648:42: warning: arithmetic on a pointer to the function type 'char *(int, int)' is a GNU extension [-Wgnu-pointer-arith]
                      hdr.day_stamp = tests[i].old_day_stamp + timezone;
                                                             ^ ~~~~~~~~
      test-mail-index-transaction-update.c:648:17: error: incompatible pointer to integer conversion assigning to 'uint32_t' (aka 'unsigned int') from 'char *(*)(int, int)' [-Wint-conversion]
                      hdr.day_stamp = tests[i].old_day_stamp + timezone;
                                    ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      test-mail-index-transaction-update.c:650:49: warning: arithmetic on a pointer to the function type 'char *(int, int)' is a GNU extension [-Wgnu-pointer-arith]
                      mail_index_update_day_headers(t, tests[i].now + timezone);
                                                                    ^ ~~~~~~~~
      test-mail-index-transaction-update.c:650:36: error: incompatible pointer to integer conversion passing 'char *(*)(int, int)' to parameter of type 'time_t' (aka 'long') [-Wint-conversion]
                      mail_index_update_day_headers(t, tests[i].now + timezone);
                                                       ^~~~~~~~~~~~~~~~~~~~~~~
      ./mail-index-transaction-private.h:127:77: note: passing argument to parameter 'day_stamp' here
      void mail_index_update_day_headers(struct mail_index_transaction *t, time_t day_stamp);
                                                                                  ^
      test-mail-index-transaction-update.c:654:63: warning: arithmetic on a pointer to the function type 'char *(int, int)' is a GNU extension [-Wgnu-pointer-arith]
                      test_assert_idx(new_hdr.day_stamp == tests[i].new_day_stamp + timezone, i);
                                                                                  ^ ~~~~~~~~
      ../../src/lib-test/test-common.h:26:9: note: expanded from macro 'test_assert_idx'
                      if (!(code)) test_assert_failed_idx(#code, __FILE__, __LINE__, i); \
                            ^~~~
      test-mail-index-transaction-update.c:654:37: warning: comparison between pointer and integer ('uint32_t' (aka 'unsigned int') and 'char *(*)(int, int)') [-Wpointer-integer-compare]
                      test_assert_idx(new_hdr.day_stamp == tests[i].new_day_stamp + timezone, i);
                                      ~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ../../src/lib-test/test-common.h:26:9: note: expanded from macro 'test_assert_idx'
                      if (!(code)) test_assert_failed_idx(#code, __FILE__, __LINE__, i); \
                            ^~~~

    Fix these warnings and errors by importing:
    https://github.com/dovecot/core/commit/e983ead775671186b3c8567d59973d2e52b678c7
    https://github.com/dovecot/core/commit/1a7b1f66fe4b86cb642dbcfe5a0192c1b77d0e17
    https://github.com/dovecot/core/commit/867a37fa7b74f798a931fb582214b5377f57610e

    PR:             268204
    Approved by:    maintainer timeout (2 weeks)
    MFH:            2022Q4

 ...ndex_test-mail-index-transaction-update.c (new) | 38 ++++++++++++++++++++++
 .../patch-src_lib_ioloop-notify-kqueue.c (new)     | 10 ++++++
 2 files changed, 48 insertions(+)
Comment 3 Larry Rosenman freebsd_committer freebsd_triage 2022-12-25 18:14:07 UTC
sorry for the miss.  Craziness moving. :(