Re: Avoid warning on cygwin

2008-04-11 Thread Eric Blake
Ralf Wildenhues  gmx.de> writes:

> 
> * Eric Blake wrote on Thu, Apr 10, 2008 at 06:56:07PM CEST:
> > src/.libs/lt-m4.c: In function `main':
> > src/.libs/lt-m4.c:288: warning: implicit declaration of function `_setmode'
> 
> > OK to apply this?
> 
> OK provided it's been tested under MinGW.  I tested linux -> mingw
> cross, where _setmode is declared, and setmode is declared #if UWIN.

I've completed a test of cross-compiling cygwin->mingw, with no change in 
behavior.  I tweaked the patch slighly, since the call to setmode was only 
emitted into the wrapper source for $host of *mingw* or *cygwin*, so I only 
restricted the additional #include  to just __CYGWIN__ rather than 
unconditionally (in case the cwrapper_exe is ever used on other platforms, 
where setmode is not present).  In the end, I committed this:


Index: libltdl/config/ltmain.m4sh
===
RCS file: /sources/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.105
diff -u -p -r1.105 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  10 Apr 2008 21:18:02 -  1.105
+++ libltdl/config/ltmain.m4sh  11 Apr 2008 17:19:00 -
@@ -2506,9 +2506,13 @@ EOF
 # include 
 # include 
 # include 
+# define setmode _setmode
 #else
 # include 
 # include 
+# ifdef __CYGWIN__
+#  include 
+# endif
 #endif
 #include 
 #include 
@@ -2652,7 +2656,7 @@ EOF
case "$host" in
  *mingw* | *cygwin* )
# make stdout use "unix" line endings
-   echo "  _setmode(1,_O_BINARY);"
+   echo "  setmode(1,_O_BINARY);"
;;
  esac
 






Re: Avoid warning on cygwin

2008-04-10 Thread Ralf Wildenhues
* Eric Blake wrote on Thu, Apr 10, 2008 at 06:56:07PM CEST:
> src/.libs/lt-m4.c: In function `main':
> src/.libs/lt-m4.c:288: warning: implicit declaration of function `_setmode'

> OK to apply this?

OK provided it's been tested under MinGW.  I tested linux -> mingw
cross, where _setmode is declared, and setmode is declared #if UWIN.

Cheers,
Ralf

> 2008-04-10  Eric Blake  <[EMAIL PROTECTED]>
> 
>   Avoid usage of setmode without declaration on cygwin.
>   * libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src): Ensure
>   setmode has prototype for both mingw and cygwin.




Avoid warning on cygwin

2008-04-10 Thread Eric Blake
The libtool wrapper executable is triggering a warning when building on cygwin:

src/.libs/lt-m4.c: In function `main':
src/.libs/lt-m4.c:288: warning: implicit declaration of function `_setmode'

Cygwin declares setmode in , whereas mingw declares _setmode in .  
Even though  is not standard, my understanding is that the cwrapperexe is 
only created on platforms where it is present.

OK to apply this?

2008-04-10  Eric Blake  <[EMAIL PROTECTED]>

Avoid usage of setmode without declaration on cygwin.
* libltdl/config/ltmain.m4sh (func_emit_cwrapperexe_src): Ensure
setmode has prototype for both mingw and cygwin.

Index: libltdl/config/ltmain.m4sh
===
RCS file: /sources/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.102
diff -u -p -r1.102 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  16 Mar 2008 08:34:25 -  1.102
+++ libltdl/config/ltmain.m4sh  10 Apr 2008 16:54:24 -
@@ -2514,10 +2514,11 @@ EOF
cat <<"EOF"
 #include 
 #include 
+#include 
 #ifdef _MSC_VER
 # include 
 # include 
-# include 
+# define setmode _setmode
 #else
 # include 
 # include 
@@ -2664,7 +2665,7 @@ EOF
case "$host" in
  *mingw* | *cygwin* )
# make stdout use "unix" line endings
-   echo "  _setmode(1,_O_BINARY);"
+   echo "  setmode(1,_O_BINARY);"
;;
  esac