[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: msys/mingw warnings about string length and putenv absence with gcc

From: Charles Wilson
Subject: Re: msys/mingw warnings about string length and putenv absence with gcc -Wall -ansi
Date: Tue, 30 Dec 2008 11:42:47 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/20081105 Thunderbird/ Mnenhy/

Bob Friesenhahn wrote:
>> If I compile my project on MSYS/MinGW with gcc -Wall -ansi (plus other
>> warning stuff that shouldn't matter here) I get two unexpected
>> warnings. Problem 1 is string lengths that are too long, problem 2 is
>> a missing putenv declaration.  Based on a previous bug report, it
>> seems the string lengths
> Neither of these issues seem to have anything to do with libtool so why
> are you posting about the issue with your code here?

Actually, I believe the OP's issues occur when compiling the libtool
exectable wrapper program, so it definitely involves libtool. The
problem(s) occur when the surrounding project is compiled using
non-default CFLAGS (like -ansi) -- these CFLAGS propagate to the
LTCOMPILE command used to build the (libtool-provided) cwrapper program.

Problem #1 was fixed here:

commit d34008adff36714b3a593da2377202df0d94bffe
Author: Charles Wilson
Date:   Fri Apr 25 21:08:04 2008 -0400

    Ensure cwrapper compiles without warnings under -std=c99.

    * libltdl/config/ltmain.m4sh (func_emit_wrapper_part1):
    new function.
    (func_emit_wrapper_part2): new function.
    (func_emit_wrapper): delegate to new functions.
    (func_emit_cwrapperexe_src) [__CYGWIN__ && __STRICT_ANSI__]:
    ensure realpath is declared.
    (func_emit_cwrapperexe_src): declare two different strings
    to each hold part of the wrapper script content. Initialize
    using new func_emit_wrapper_partX functions.
    (func_emit_cwrapperexe_src) [main]: when emitting wrapper
    script content, use both strings.
    Reported by Yaakov Selkowitz.

Problem #2 was fixed -- for CYGWIN -- here:

commit fae94962aa3c36f3cee00a453c2a7d01baaf4ff0
Author: Charles Wilson
Date:   Sat Apr 26 16:03:50 2008 -0400

    [mingw|cygwin] Modify cwrapper to invoke target directly.

    * libltdl/config/ltmain.m4sh ...
    (func_emit_cwrapperexe_src) [__CYGWIN__ && __STRICT_ANSI__]:
    Ensure putenv and setenv are declared. Define HAVE_SETENV.
    (func_emit_cwrapperexe_src) [main]: ...

It isn't difficult to extend this fix for the MINGW case, as well --
something like the following (around line 2840 in ltmain.m4sh):

 #ifdef _MSC_VER
 # include <direct.h>
 # include <process.h>
 # include <io.h>
 # define setmode _setmode
+# ifdef __STRICT_ANSI__
+int putenv (char *);
+# endif
 # include <unistd.h>
 # include <stdint.h>
 # ifdef __CYGWIN__
 #  include <io.h>
 #  define HAVE_SETENV
 #  ifdef __STRICT_ANSI__
 char *realpath (const char *, char *);
 int putenv (char *);
 int setenv (const char *, const char *, int);
 #  endif
 # endif

Would this qualify as an "obvious" fix, that I could push without the
the whole round of testing?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]