Bug 272136

Summary: textproc/discount: fix build with clang 16
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: Po-Chuan Hsieh <sunpoet>
Status: Closed Overcome By Events    
Severity: Affects Some People Flags: bugzilla: maintainer-feedback? (sunpoet)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 271047    
Attachments:
Description Flags
textproc/discount: fix build with clang 16 none

Description Dimitry Andric freebsd_committer freebsd_triage 2023-06-21 19:29:03 UTC
Clang 16 has a new error about incompatible function types, which shows
up when textproc/discount:

  main.c:311:29: error: incompatible function pointer types passing 'char *(char *, int, char *)' to parameter of type 'mkd_callback_t' (aka 'char *(*)(const char *, const int, void *)') [-Wincompatible-function-pointer-types]
              mkd_e_code_format(doc, external_codefmt);
                                     ^~~~~~~~~~~~~~~~
  ./mkdio.h:71:45: note: passing argument to parameter here
  void mkd_e_code_format(void*, mkd_callback_t);
                                              ^

This is is because the callback function's prototype does not match the
mkd_callback_t type. The program is rather sloppy with how it passes
parameters around, and just before this particular callback assignment
it casts the parameter to the desired type, so also do that here.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-06-21 19:29:24 UTC
Created attachment 242930 [details]
textproc/discount: fix build with clang 16
Comment 2 Po-Chuan Hsieh freebsd_committer freebsd_triage 2023-07-01 17:56:17 UTC
I did that in ports 249dd4b7de80bddef241339dff6b4d7993414a33. Thanks.