Bug 271425

Summary: x11-toolkits/open-motif: fix build with clang 16
Product: Ports & Packages Reporter: Dimitry Andric <dim>
Component: Individual Port(s)Assignee: Cy Schubert <cy>
Status: Closed FIXED    
Severity: Affects Some People Flags: bugzilla: maintainer-feedback? (cy)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 271047    
Attachments:
Description Flags
x11-toolkits/open-motif: fix build with clang 16 none

Description Dimitry Andric freebsd_committer freebsd_triage 2023-05-14 19:36:15 UTC
Clang 16 has a new error about incompatible function types, which shows
up when building x11-toolkits/open-motif:

  WmError.c:134:24: error: incompatible function pointer types passing 'void (char *)' to parameter of type 'void (*)(String) __attribute__((noreturn))' (aka 'void (*)(char *) __attribute__((noreturn))') [-Wincompatible-function-pointer-types]
      XtSetErrorHandler (WmXtErrorHandler);
                         ^~~~~~~~~~~~~~~~
  /usr/local/include/X11/Intrinsic.h:1776:1: note: passing argument to parameter here
  );
  ^

In this case the declaration of the callback function for
XtSetErrorHandler() shoud have a noreturn attribute, specifically using
the _X_NORETURN macro.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-05-14 19:36:35 UTC
Created attachment 242176 [details]
x11-toolkits/open-motif: fix build with clang 16
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-05-15 14:37:34 UTC
A commit in branch main references this bug:

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

commit 72d0d9b5dad67545e571057abd8d59166ce247b2
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-05-15 14:17:12 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-05-15 14:36:17 +0000

    x11-toolkits/open-motif*: fix build with clang 16

    Clang 16 has a new error about incompatible function types, which shows
    up when building x11-toolkits/open-motif:

      WmError.c:134:24: error: incompatible function pointer types passing 'void (char *)' to parameter of type 'void (*)(String) __attribute__((noreturn))' (aka 'void (*)(char *) __attribute__((noreturn))') [-Wincompatible-function-pointer-types]
          XtSetErrorHandler (WmXtErrorHandler);
                             ^~~~~~~~~~~~~~~~
      /usr/local/include/X11/Intrinsic.h:1776:1: note: passing argument to parameter here
      );
      ^

    In this case the declaration of the callback function for
    XtSetErrorHandler() shoud have a noreturn attribute, specifically using
    the _X_NORETURN macro.

    PR:             271425

 .../open-motif-devel/files/patch-clients_mwm_WmError.h (new)  | 11 +++++++++++
 .../open-motif/files/patch-clients_mwm_WmError.h (new)        | 11 +++++++++++
 2 files changed, 22 insertions(+)
Comment 3 Cy Schubert freebsd_committer freebsd_triage 2023-05-15 14:38:23 UTC
Fixed. Thanks for the patch.