Bug 268417 - devel/libcbor: fix strict prototype warnings with clang 15
Summary: devel/libcbor: fix strict prototype warnings 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 Only Me
Assignee: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-16 18:38 UTC by Dimitry Andric
Modified: 2022-12-25 18:46 UTC (History)
1 user (show)

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


Attachments
devel/libcbor: fix strict prototype warnings with clang 15 (2.47 KB, patch)
2022-12-16 18:39 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-16 18:38:46 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that security/libfido2 failed to build with clang 15:

  In file included from /wrkdirs/usr/ports/security/libfido2/work/libfido2-1.12.0/src/aes256.c:8:
  In file included from /wrkdirs/usr/ports/security/libfido2/work/libfido2-1.12.0/src/fido.h:42:
  In file included from /usr/local/include/cbor.h:14:
  /usr/local/include/cbor/arrays.h:100:51: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  CBOR_EXPORT cbor_item_t* cbor_new_indefinite_array();
                                                    ^
                                                     void
  In file included from /wrkdirs/usr/ports/security/libfido2/work/libfido2-1.12.0/src/aes256.c:8:
  In file included from /wrkdirs/usr/ports/security/libfido2/work/libfido2-1.12.0/src/fido.h:42:
  In file included from /usr/local/include/cbor.h:15:
  /usr/local/include/cbor/bytestrings.h:107:54: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
  CBOR_EXPORT cbor_item_t *cbor_new_definite_bytestring();
                                                       ^
                                                        void

And many more of these -Werror warnings, all due to declarations in libcbor's headers. These are triggered because functions taking no parameters should be declared with "(void)", not "()".

I would like to propose to fix the problem on the libcbor side, by editing the declarations and definitions of such functions in the port Makefile. This cleans up all warnings in devel/libcbor, and also fixes security/libfido2 as a consequence.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-16 18:39:11 UTC
Created attachment 238847 [details]
devel/libcbor: fix strict prototype warnings with clang 15
Comment 2 Ed Maste freebsd_committer freebsd_triage 2022-12-19 15:14:16 UTC
Can we send this to https://github.com/PJK/libcbor too?

Same fixes for the libcbor copy in the base system?
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2022-12-19 15:50:37 UTC
(In reply to Ed Maste from comment #2)
Ah I wasn't aware that we had it! Probably for the fido stuff? :)

But sure, this should be sent upstream, like the augeas fix.
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-12-25 17:55:19 UTC
A commit in branch main references this bug:

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

commit ee691f844e79c2092f5f9c06094c3a8bdab88c98
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-16 18:26:47 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-12-25 17:51:35 +0000

    devel/libcbor: fix strict prototype warnings with clang 15

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

      In file included from /wrkdirs/usr/ports/security/libfido2/work/libfido2-1.12.0/src/aes256.c:8:
      In file included from /wrkdirs/usr/ports/security/libfido2/work/libfido2-1.12.0/src/fido.h:42:
      In file included from /usr/local/include/cbor.h:14:
      /usr/local/include/cbor/arrays.h:100:51: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
      CBOR_EXPORT cbor_item_t* cbor_new_indefinite_array();
                                                        ^
                                                         void
      In file included from /wrkdirs/usr/ports/security/libfido2/work/libfido2-1.12.0/src/aes256.c:8:
      In file included from /wrkdirs/usr/ports/security/libfido2/work/libfido2-1.12.0/src/fido.h:42:
      In file included from /usr/local/include/cbor.h:15:
      /usr/local/include/cbor/bytestrings.h:107:54: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
      CBOR_EXPORT cbor_item_t *cbor_new_definite_bytestring();
                                                           ^
                                                            void

    And many more of these -Werror warnings, all due to declarations in
    libcbor's headers. These are triggered because functions taking no
    parameters should be declared with "(void)", not "()".

    I would like to propose to fix the problem on the libcbor side, by
    editing the declarations and definitions of such functions in the port
    Makefile. This cleans up all warnings in devel/libcbor, and also fixes
    security/libfido2 as a consequence.

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

 devel/libcbor/Makefile | 2 ++
 1 file changed, 2 insertions(+)
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2022-12-25 18:46:13 UTC
(In reply to Ed Maste from comment #2)
https://github.com/PJK/libcbor/pull/232