diff options
author | Cy Schubert <cy@FreeBSD.org> | 2023-12-04 23:49:53 +0000 |
---|---|---|
committer | Cy Schubert <cy@FreeBSD.org> | 2023-12-05 00:02:05 +0000 |
commit | c1d2da5c0be7b60cf8d4b39bb615bfab7399abce (patch) | |
tree | 8713e32d8c1b0f6270c75bb1c5bc78d8d0a9b310 | |
parent | ebd43103a86630e2f6a55b73b538e039aa066dbf (diff) |
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/
-rw-r--r-- | x11-toolkits/open-motif-devel/Makefile | 2 | ||||
-rw-r--r-- | x11-toolkits/open-motif-devel/files/patch-acinclude.m4 | 16 | ||||
-rw-r--r-- | x11-toolkits/open-motif/Makefile | 2 | ||||
-rw-r--r-- | x11-toolkits/open-motif/files/patch-acinclude.m4 | 16 |
4 files changed, 34 insertions, 2 deletions
diff --git a/x11-toolkits/open-motif-devel/Makefile b/x11-toolkits/open-motif-devel/Makefile index 298f7c6f06f1..36f53474ca9d 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 000000000000..10b61badcffc --- /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 <stdio.h> +-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 e90595a26679..99fa75185d19 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 000000000000..0b2e3c8d1a8f --- /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 <stdio.h> +-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, |