Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Fix readline for platforms without <wchar.h>
@ 2003-05-25 11:29 Mark Kettenis
  2003-05-26 15:33 ` Elena Zannoni
       [not found] ` <"Message from kettenis"@chello.nl>
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Kettenis @ 2003-05-25 11:29 UTC (permalink / raw)
  To: gdb-patches, ezannoni; +Cc: chet

[ Chet, I don't now if you ever received the change that was
  origionally made to the copy of readline in the GDB tree.  Just in
  case you intend to incorporate such a change in the next release of
  readline, this patch solves a problem with it. ]

There is a problem with one of our local GDB fixes for readline:

2003-03-03  Kris Warkentin  <kewarken@qnx.com>

	* aclocal.m4: Cause wcwidth check to substitute
	HAVE_WCWIDTH for building.
	* Makefile.in: Add wcwidth object to lib if required.
	* shlib/Makefile.in: Likewise.
	* configure: Regenerate.
	
The problem is that this patch is that support/wcwidth.c
unconditionally includes <wchar.h>.  Compilation of support/wcwidth.c
will therefore fail on platforms that don't have <wchar.h>, such as
OpenBSD 3.0.

The attached patch fixes this.  I chose to fix this in aclocal.m4
instead of using HAVE_WCHAR_H in support/wcwidth.c since it keeps that
file unchanged from the upstream sources.

OK to check this in Elena?

Mark

Index: ChangeLog.gdb
from  Mark Kettenis  <kettenis@gnu.org>

	* aclocal.m4: Don't add wcwidth.o if we don't have wchar.h.
	* configure: Regenerate.

Index: aclocal.m4
===================================================================
RCS file: /cvs/src/src/readline/aclocal.m4,v
retrieving revision 1.6
diff -u -p -r1.6 aclocal.m4
--- aclocal.m4 3 Mar 2003 18:52:27 -0000 1.6
+++ aclocal.m4 25 May 2003 11:26:57 -0000
@@ -1654,13 +1654,13 @@ AC_CHECK_HEADERS(langinfo.h)
 
 AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC))
 AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
-AC_CHECK_FUNC(wcwidth, have_wcwidth=yes)
-if test "$have_wcwidth" = yes; then
-  AC_DEFINE(HAVE_WCWIDTH)
-  AC_SUBST(WCWIDTH_OBJ,)
+AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
+if test "$ac_cv_func_wcwidth" = no && test "$ac_cv_header_wchar_h" = yes; then
+  WCWIDTH_OBJ=wcwidth.o
 else
-  AC_SUBST(WCWIDTH_OBJ,wcwidth.o)
+  WCWIDTH_OBJ=
 fi
+AC_SUBST(WCWIDTH_OBJ)
 
 AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
 [AC_TRY_RUN([


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

* Re: Fix readline for platforms without <wchar.h>
  2003-05-25 11:29 Fix readline for platforms without <wchar.h> Mark Kettenis
@ 2003-05-26 15:33 ` Elena Zannoni
  2003-05-27 23:30   ` Mark Kettenis
       [not found] ` <"Message from kettenis"@chello.nl>
  1 sibling, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2003-05-26 15:33 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: gdb-patches, ezannoni, chet

Mark Kettenis writes:
 > [ Chet, I don't now if you ever received the change that was
 >   origionally made to the copy of readline in the GDB tree.  Just in
 >   case you intend to incorporate such a change in the next release of
 >   readline, this patch solves a problem with it. ]
 > 
 > There is a problem with one of our local GDB fixes for readline:
 > 
 > 2003-03-03  Kris Warkentin  <kewarken@qnx.com>
 > 
 > 	* aclocal.m4: Cause wcwidth check to substitute
 > 	HAVE_WCWIDTH for building.
 > 	* Makefile.in: Add wcwidth object to lib if required.
 > 	* shlib/Makefile.in: Likewise.
 > 	* configure: Regenerate.
 > 	
 > The problem is that this patch is that support/wcwidth.c
 > unconditionally includes <wchar.h>.  Compilation of support/wcwidth.c
 > will therefore fail on platforms that don't have <wchar.h>, such as
 > OpenBSD 3.0.
 > 
 > The attached patch fixes this.  I chose to fix this in aclocal.m4
 > instead of using HAVE_WCHAR_H in support/wcwidth.c since it keeps that
 > file unchanged from the upstream sources.
 > 
 > OK to check this in Elena?

Ok with me.

thanks
elena


 > 
 > Mark
 > 
 > Index: ChangeLog.gdb
 > from  Mark Kettenis  <kettenis@gnu.org>
 > 
 > 	* aclocal.m4: Don't add wcwidth.o if we don't have wchar.h.
 > 	* configure: Regenerate.
 > 
 > Index: aclocal.m4
 > ===================================================================
 > RCS file: /cvs/src/src/readline/aclocal.m4,v
 > retrieving revision 1.6
 > diff -u -p -r1.6 aclocal.m4
 > --- aclocal.m4 3 Mar 2003 18:52:27 -0000 1.6
 > +++ aclocal.m4 25 May 2003 11:26:57 -0000
 > @@ -1654,13 +1654,13 @@ AC_CHECK_HEADERS(langinfo.h)
 >  
 >  AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC))
 >  AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
 > -AC_CHECK_FUNC(wcwidth, have_wcwidth=yes)
 > -if test "$have_wcwidth" = yes; then
 > -  AC_DEFINE(HAVE_WCWIDTH)
 > -  AC_SUBST(WCWIDTH_OBJ,)
 > +AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
 > +if test "$ac_cv_func_wcwidth" = no && test "$ac_cv_header_wchar_h" = yes; then
 > +  WCWIDTH_OBJ=wcwidth.o
 >  else
 > -  AC_SUBST(WCWIDTH_OBJ,wcwidth.o)
 > +  WCWIDTH_OBJ=
 >  fi
 > +AC_SUBST(WCWIDTH_OBJ)
 >  
 >  AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
 >  [AC_TRY_RUN([


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

* Re: Fix readline for platforms without <wchar.h>
       [not found] ` <"Message from kettenis"@chello.nl>
@ 2003-05-27 14:22   ` Chet Ramey
  2003-05-27 23:46     ` Mark Kettenis
  0 siblings, 1 reply; 5+ messages in thread
From: Chet Ramey @ 2003-05-27 14:22 UTC (permalink / raw)
  To: kettenis; +Cc: gdb-patches, ezannoni, chet

> [ Chet, I don't now if you ever received the change that was
>   origionally made to the copy of readline in the GDB tree.  Just in
>   case you intend to incorporate such a change in the next release of
>   readline, this patch solves a problem with it. ]
> 
> There is a problem with one of our local GDB fixes for readline:

I'm not going to include wcwidth in libreadline.  It's not appropriate
for libraries to be conditionally including C library functions -- it
just causes problems down the line.  That's what the calling
application should be doing. 

That said, your fix was better than changing the source, since I don't
see how wcwidth is going to work without wchar.h anyway. 

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )

Chet Ramey, ITS, CWRU    chet@po.CWRU.Edu    http://cnswww.cns.cwru.edu/~chet/


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

* Re: Fix readline for platforms without <wchar.h>
  2003-05-26 15:33 ` Elena Zannoni
@ 2003-05-27 23:30   ` Mark Kettenis
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Kettenis @ 2003-05-27 23:30 UTC (permalink / raw)
  To: ezannoni; +Cc: gdb-patches

   From: Elena Zannoni <ezannoni@redhat.com>
   Date: Mon, 26 May 2003 11:38:02 -0400

   Mark Kettenis writes:
    > There is a problem with one of our local GDB fixes for readline:
    > 
    > 2003-03-03  Kris Warkentin  <kewarken@qnx.com>
    > 
    > 	* aclocal.m4: Cause wcwidth check to substitute
    > 	HAVE_WCWIDTH for building.
    > 	* Makefile.in: Add wcwidth object to lib if required.
    > 	* shlib/Makefile.in: Likewise.
    > 	* configure: Regenerate.
    > 	
    > OK to check this in Elena?

   Ok with me.

Checked in,

Mark


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

* Re: Fix readline for platforms without <wchar.h>
  2003-05-27 14:22   ` Chet Ramey
@ 2003-05-27 23:46     ` Mark Kettenis
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Kettenis @ 2003-05-27 23:46 UTC (permalink / raw)
  To: chet; +Cc: gdb-patches, ezannoni, chet

   Date: Tue, 27 May 2003 10:14:12 -0400
   From: Chet Ramey <chet@nike.ins.cwru.edu>

   > [ Chet, I don't now if you ever received the change that was
   >   origionally made to the copy of readline in the GDB tree.  Just in
   >   case you intend to incorporate such a change in the next release of
   >   readline, this patch solves a problem with it. ]
   > 
   > There is a problem with one of our local GDB fixes for readline:

   I'm not going to include wcwidth in libreadline.  It's not appropriate
   for libraries to be conditionally including C library functions -- it
   just causes problems down the line.  That's what the calling
   application should be doing. 

Thanks!  Yes, that makes sense.  I'll see if I can get rid of this
local fix in the GDB repository by adding some hackery to the GDB
configure script instead.

Mark


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

end of thread, other threads:[~2003-05-27 23:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-25 11:29 Fix readline for platforms without <wchar.h> Mark Kettenis
2003-05-26 15:33 ` Elena Zannoni
2003-05-27 23:30   ` Mark Kettenis
     [not found] ` <"Message from kettenis"@chello.nl>
2003-05-27 14:22   ` Chet Ramey
2003-05-27 23:46     ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox