zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] C compatiblity fixes for the configure script (incompatible-pointer-types)
@ 2023-12-08 20:58 Florian Weimer
  2023-12-09 17:12 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Florian Weimer @ 2023-12-08 20:58 UTC (permalink / raw)
  To: zsh-workers

Avoid incompatible pointer types in terminfo global variable checks.
Some compilers reject these incompatible pointer types, causing the
checks to always fail, when these variables are in fact available.

Related to:

  <https://fedoraproject.org/wiki/Changes/PortingToModernC>
  <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>

diff --git a/configure.ac b/configure.ac
index a58242f453b4a8f3..5534f42df14eb28c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1769,27 +1769,27 @@ if test x$zsh_cv_path_term_header != xnone; then
   fi
 
   AC_MSG_CHECKING(if boolcodes is available)
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = boolcodes; puts(*test);]])],[AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes],[boolcodes=no])
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)boolcodes; puts(*test);]])],[AC_DEFINE(HAVE_BOOLCODES) boolcodes=yes],[boolcodes=no])
   AC_MSG_RESULT($boolcodes)
 
   AC_MSG_CHECKING(if numcodes is available)
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = numcodes; puts(*test);]])],[AC_DEFINE(HAVE_NUMCODES) numcodes=yes],[numcodes=no])
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)numcodes; puts(*test);]])],[AC_DEFINE(HAVE_NUMCODES) numcodes=yes],[numcodes=no])
   AC_MSG_RESULT($numcodes)
 
   AC_MSG_CHECKING(if strcodes is available)
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = strcodes; puts(*test);]])],[AC_DEFINE(HAVE_STRCODES) strcodes=yes],[strcodes=no])
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)strcodes; puts(*test);]])],[AC_DEFINE(HAVE_STRCODES) strcodes=yes],[strcodes=no])
   AC_MSG_RESULT($strcodes)
 
   AC_MSG_CHECKING(if boolnames is available)
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = boolnames; puts(*test);]])],[AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes],[boolnames=no])
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)boolnames; puts(*test);]])],[AC_DEFINE(HAVE_BOOLNAMES) boolnames=yes],[boolnames=no])
   AC_MSG_RESULT($boolnames)
 
   AC_MSG_CHECKING(if numnames is available)
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = numnames; puts(*test);]])],[AC_DEFINE(HAVE_NUMNAMES) numnames=yes],[numnames=no])
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)numnames; puts(*test);]])],[AC_DEFINE(HAVE_NUMNAMES) numnames=yes],[numnames=no])
   AC_MSG_RESULT($numnames)
 
   AC_MSG_CHECKING(if strnames is available)
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = strnames; puts(*test);]])],[AC_DEFINE(HAVE_STRNAMES) strnames=yes],[strnames=no])
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[$term_includes]], [[char **test = (char **)strnames; puts(*test);]])],[AC_DEFINE(HAVE_STRNAMES) strnames=yes],[strnames=no])
   AC_MSG_RESULT($strnames)
 
   dnl There are apparently defective terminal library headers on some



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] C compatiblity fixes for the configure script (incompatible-pointer-types)
  2023-12-08 20:58 [PATCH] C compatiblity fixes for the configure script (incompatible-pointer-types) Florian Weimer
@ 2023-12-09 17:12 ` Bart Schaefer
  2023-12-09 22:13   ` Oliver Kiddle
  2023-12-11  8:51   ` Florian Weimer
  0 siblings, 2 replies; 4+ messages in thread
From: Bart Schaefer @ 2023-12-09 17:12 UTC (permalink / raw)
  To: zsh-workers

On Fri, Dec 8, 2023 at 12:58 PM Florian Weimer <fweimer@redhat.com> wrote:
>
> Avoid incompatible pointer types in terminfo global variable checks.

For the record, the incompatibility seems to be that ncurses now
declares these as arrays of const pointer to const char.

Curiously (incorrectly?) the Solaris 11.3 documentation available
online shows them as only char*, not even char**.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] C compatiblity fixes for the configure script (incompatible-pointer-types)
  2023-12-09 17:12 ` Bart Schaefer
@ 2023-12-09 22:13   ` Oliver Kiddle
  2023-12-11  8:51   ` Florian Weimer
  1 sibling, 0 replies; 4+ messages in thread
From: Oliver Kiddle @ 2023-12-09 22:13 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

Bart Schaefer wrote:
> On Fri, Dec 8, 2023 at 12:58 PM Florian Weimer <fweimer@redhat.com> wrote:
> >
> > Avoid incompatible pointer types in terminfo global variable checks.
>
> For the record, the incompatibility seems to be that ncurses now
> declares these as arrays of const pointer to const char.
>
> Curiously (incorrectly?) the Solaris 11.3 documentation available
> online shows them as only char*, not even char**.

Checking /usr/include/term.h on 11.4 and 10, it is:

extern  char    term_parm_err[], *term_err_strings[], *Def_term,
                *boolnames[], *boolcodes[], *boolfnames[],
                *numnames[], *numcodes[], *numfnames[],
                *strnames[], *strcodes[], *strfnames[];

The patch has no impact on a Solaris build.

And while I don't have a new enough compiler to verify the described
problem, I don't doubt it. I can't see adding a cast to the type it is
being assigned to causing problems so no objections from me.

Oliver


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] C compatiblity fixes for the configure script (incompatible-pointer-types)
  2023-12-09 17:12 ` Bart Schaefer
  2023-12-09 22:13   ` Oliver Kiddle
@ 2023-12-11  8:51   ` Florian Weimer
  1 sibling, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2023-12-11  8:51 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

* Bart Schaefer:

> On Fri, Dec 8, 2023 at 12:58 PM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> Avoid incompatible pointer types in terminfo global variable checks.
>
> For the record, the incompatibility seems to be that ncurses now
> declares these as arrays of const pointer to const char.

I haven't investigated whether this is a recent ncurses changes.  Until
recently, all free software compilers issued only a warning for this
type error, so it's the compilers that are changing.  Not necessarily
ncurses.

Thanks,
Florian



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-11  8:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-08 20:58 [PATCH] C compatiblity fixes for the configure script (incompatible-pointer-types) Florian Weimer
2023-12-09 17:12 ` Bart Schaefer
2023-12-09 22:13   ` Oliver Kiddle
2023-12-11  8:51   ` Florian Weimer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).