X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Date: Wed, 24 Sep 2014 05:48:32 +0200 (CEST) X-X-Sender: igor2 AT igor2priv To: geda-user AT delorie DOT com X-Debug: to=geda-user AT delorie DOT com from="gedau AT igor2 DOT repo DOT hu" From: gedau AT igor2 DOT repo DOT hu Subject: Re: [geda-user] Banging my head against the guile-for-windows wall In-Reply-To: Message-ID: References: <20140923045453 DOT 56dc3de2 AT akka> <5421FF2E DOT 4010709 AT sbcglobal DOT net> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 24 Sep 2014, Kai-Martin Knaak wrote: > Girvin Herr wrote: > >> If there are warnings, what >> other, worse bugs are in there? > > Lets see... > > > (6k lines(!)) there are actually quite a few warnings: > > (...) > read.c: In function 'try_read_ci_chars': > read.c:983:3: warning: implicit declaration of function 'alloca' [-Wimplicit-function-declaration] > char *chars_read = alloca (num_chars_wanted); > ^ > read.c:983:22: warning: incompatible implicit declaration of built-in function 'alloca' > char *chars_read = alloca (num_chars_wanted); > ^ #include (or something else depending on your libc there) to get the declaration of alloca(). Alternatively an ugly workaround is to declare it manually before the call (in case it's impossible to determine which .h to include or auto* gets in the way): extern void *alloca(size_t size); The extern is optional. Manual declaration of such builtin may cause problems if the C compiler is clever enough. Background: On many systems this is a serious problem: without an explicit declaration, alloca() will default to return int which is then casted to a pointer. This happens to work on some systems with sizeof(int) == sizeof(char *), but will almost always break on others. With gcc a 32 bit i386 is normally in the first group while x86_64 is in the second. > > posix.c: In function 'scm_execl': > posix.c:1144:3: warning: passing argument 2 of 'execv' from incompatible pointer type > execv (exec_file, exec_argv); > ^ > In file included from /usr/local/src/mxe/usr/i686-pc-mingw32.static/include/unistd.h:13:0, > from ../lib/unistd.h:40, > from posix.c:50: > /usr/local/src/mxe/usr/i686-pc-mingw32.static/include/process.h:118:42: note: expected 'const char * const*' but argument is of type 'char **' > _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execv (const char*, const char* const*); > ^ > posix.c: In function 'scm_execlp': > posix.c:1173:3: warning: passing argument 2 of 'execvp' from incompatible pointer type > execvp (exec_file, exec_argv); > ^ > In file included from /usr/local/src/mxe/usr/i686-pc-mingw32.static/include/unistd.h:13:0, > from ../lib/unistd.h:40, > from posix.c:50: > /usr/local/src/mxe/usr/i686-pc-mingw32.static/include/process.h:120:42: note: expected 'const char * const*' but argument is of type 'char **' > _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execvp (const char*, const char* const*); > ^ > posix.c: In function 'scm_execle': > posix.c:1207:3: warning: passing argument 2 of 'execve' from incompatible pointer type > execve (exec_file, exec_argv, exec_env); > ^ > In file included from /usr/local/src/mxe/usr/i686-pc-mingw32.static/include/unistd.h:13:0, > from ../lib/unistd.h:40, > from posix.c:50: > /usr/local/src/mxe/usr/i686-pc-mingw32.static/include/process.h:119:42: note: expected 'const char * const*' but argument is of type 'char **' > _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execve (const char*, const char* const*, const char* const*); > ^ > posix.c:1207:3: warning: passing argument 3 of 'execve' from incompatible pointer type > execve (exec_file, exec_argv, exec_env); > ^ > In file included from /usr/local/src/mxe/usr/i686-pc-mingw32.static/include/unistd.h:13:0, > from ../lib/unistd.h:40, > from posix.c:50: > /usr/local/src/mxe/usr/i686-pc-mingw32.static/include/process.h:119:42: note: expected 'const char * const*' but argument is of type 'char **' > _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execve (const char*, const char* const*, const char* const*); > I wouldn't worry much about these: exec() takes const so it won't change the content, you pass on non-const so you potentially don't care whether it changes the content. At the end, if exec() doesn't fail, it won't even matter anymore as exec() won't return. The only case where it would matter if exec() failed and returned and you'd want to do something with the args; but even that would matter only in the other direction when you had a const arg that shouldn't be changed and exec() would take non-const and change it. You can suppress these warnings with an explicit cast of the argument. Regards, Igor2