From c1d2da5c0be7b60cf8d4b39bb615bfab7399abce Mon Sep 17 00:00:00 2001 From: Cy Schubert Date: Mon, 4 Dec 2023 15:49:53 -0800 Subject: [PATCH] x11-toolkits/open-motif*: revise AM_FUNC_VOID_SPRINTF The check for whether sprintf() returns void would fail to detect sprintf() returning int under recent Clang. Presumably the check meant to see if an error like "passing 'void' to parameter of incompatible type 'int'" is generated, but Clang would always generate other errors having to do with calling sprintf() with too few arguments and attempting to redeclare sprintf() when it is a builtin macro. And even if the test program compiles, such as with GCC, it crashes during the sprintf(".") call. Revise the test program to not redeclare sprintf(), to call sprintf() with valid arguments, and to not implicitly declare exit() due to stdlib.h not being included (which Apple Xcode Clang 12 and later consider an error rather than a warning). If sprintf() returns void, then a compiler error similar to "initializing 'int' with an expression of incompatible type 'void'" or "void value not ignored as it ought to be" should be generated. Otherwise if sprintf() returns int, then the test program should compile and exit with code 0, and the check should properly report that sprintf() does not return void. Obtained from: https://sourceforge.net/p/motif/code/merge-requests/3/ --- x11-toolkits/open-motif-devel/Makefile | 2 +- .../open-motif-devel/files/patch-acinclude.m4 | 16 ++++++++++++++++ x11-toolkits/open-motif/Makefile | 2 +- x11-toolkits/open-motif/files/patch-acinclude.m4 | 16 ++++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 x11-toolkits/open-motif-devel/files/patch-acinclude.m4 create mode 100644 x11-toolkits/open-motif/files/patch-acinclude.m4 diff --git a/x11-toolkits/open-motif-devel/Makefile b/x11-toolkits/open-motif-devel/Makefile index 298f7c6f06f12..36f53474ca9d0 100644 --- a/x11-toolkits/open-motif-devel/Makefile +++ b/x11-toolkits/open-motif-devel/Makefile @@ -1,6 +1,6 @@ PORTNAME= open-motif PORTVERSION= ${COMMIT_DATE} -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= x11-toolkits PKGNAMESUFFIX= -devel diff --git a/x11-toolkits/open-motif-devel/files/patch-acinclude.m4 b/x11-toolkits/open-motif-devel/files/patch-acinclude.m4 new file mode 100644 index 0000000000000..10b61badcffc5 --- /dev/null +++ b/x11-toolkits/open-motif-devel/files/patch-acinclude.m4 @@ -0,0 +1,16 @@ +--- acinclude.m4.orig 2023-02-15 16:42:34.000000000 -0800 ++++ acinclude.m4 2023-12-04 15:48:14.815249000 -0800 +@@ -50,7 +50,12 @@ + AC_DEFUN([AM_FUNC_VOID_SPRINTF], + [AC_CACHE_CHECK(whether sprintf returns void, ac_cv_func_void_sprintf, + [AC_TRY_RUN([#include +-int sprintf(); main() { exit(sprintf(".")); }], ++int main() { ++ char buf[1]; ++ int i = sprintf(buf, ""); ++ return 0; ++} ++], + ac_cv_func_void_sprintf=no, ac_cv_func_void_sprintf=yes, ac_cv_func_void_sprintf=yes)]) + if test $ac_cv_func_void_sprintf = no; then + AC_DEFINE(VOID_SPRINTF,1, diff --git a/x11-toolkits/open-motif/Makefile b/x11-toolkits/open-motif/Makefile index e90595a266793..99fa75185d198 100644 --- a/x11-toolkits/open-motif/Makefile +++ b/x11-toolkits/open-motif/Makefile @@ -1,6 +1,6 @@ PORTNAME= open-motif PORTVERSION= 2.3.8 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= x11-toolkits # MASTER_SITES= SF/${PORTNAME}/Motif%202.3.4%20Source%20Code/ MASTER_SITES= SF/motif/Motif%20${PORTVERSION}%20Source%20Code/ diff --git a/x11-toolkits/open-motif/files/patch-acinclude.m4 b/x11-toolkits/open-motif/files/patch-acinclude.m4 new file mode 100644 index 0000000000000..0b2e3c8d1a8fd --- /dev/null +++ b/x11-toolkits/open-motif/files/patch-acinclude.m4 @@ -0,0 +1,16 @@ +--- acinclude.m4.orig 2017-08-27 19:29:50.000000000 -0700 ++++ acinclude.m4 2023-12-04 15:48:12.951361000 -0800 +@@ -50,7 +50,12 @@ + AC_DEFUN([AM_FUNC_VOID_SPRINTF], + [AC_CACHE_CHECK(whether sprintf returns void, ac_cv_func_void_sprintf, + [AC_TRY_RUN([#include +-int sprintf(); main() { exit(sprintf(".")); }], ++int main() { ++ char buf[1]; ++ int i = sprintf(buf, ""); ++ return 0; ++} ++], + ac_cv_func_void_sprintf=no, ac_cv_func_void_sprintf=yes, ac_cv_func_void_sprintf=yes)]) + if test $ac_cv_func_void_sprintf = no; then + AC_DEFINE(VOID_SPRINTF,1,