bug-make
[Top][All Lists]
Advanced

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

mingw-w64 build breaks and warnings


From: Stephan T. Lavavej
Subject: mingw-w64 build breaks and warnings
Date: Mon, 25 Nov 2013 19:39:17 -0800

Hi,

make's HEAD is currently broken for mingw-w64, and is also emitting several
warnings.

I'm building http://git.savannah.gnu.org/cgit/make.git/commit/?id=f5f5adb
with "build_w32.bat gcc".

The attached make-mingw-w64.patch fixes all errors and warnings, and
shouldn't affect other platforms.


Here are the build breaks:

#1:
job.c: In function 'free_child':
job.c:1015:11: warning: passing argument 1 of 'strlen' makes pointer from
integer without a cast [enabled by default]
           OSN (fatal, NILF,
           ^
In file included from c:\mingw\x86_64-w64-mingw32\include\io.h:10:0,
                 from c:\mingw\x86_64-w64-mingw32\include\sys\stat.h:14,
                 from makeint.h:71,
                 from job.c:17:
c:\mingw\x86_64-w64-mingw32\include\string.h:54:18: note: expected 'const
char *' but argument is of type 'DWORD'
   size_t __cdecl strlen(const char *_Str);
                  ^

job.c: In function 'new_job':
job.c:1962:13: warning: passing argument 1 of 'strlen' makes pointer from
integer without a cast [enabled by default]
             OSN (fatal, NILF,
             ^
In file included from c:\mingw\x86_64-w64-mingw32\include\io.h:10:0,
                 from c:\mingw\x86_64-w64-mingw32\include\sys\stat.h:14,
                 from makeint.h:71,
                 from job.c:17:
c:\mingw\x86_64-w64-mingw32\include\string.h:54:18: note: expected 'const
char *' but argument is of type 'DWORD'
   size_t __cdecl strlen(const char *_Str);
                  ^

main.c: In function 'main':
main.c:1984:11: warning: passing argument 1 of 'strlen' makes pointer from
integer without a cast [enabled by default]
           OSN (fatal, NILF,
           ^
In file included from c:\mingw\x86_64-w64-mingw32\include\io.h:10:0,
                 from c:\mingw\x86_64-w64-mingw32\include\sys\stat.h:14,
                 from makeint.h:71,
                 from main.c:17:
c:\mingw\x86_64-w64-mingw32\include\string.h:54:18: note: expected 'const
char *' but argument is of type 'DWORD'
   size_t __cdecl strlen(const char *_Str);
                  ^

This was introduced by
http://git.savannah.gnu.org/cgit/make.git/commit/?id=757849c . Each of these
lines is saying "(Error %ld: %s)", which corresponds to ONS() (I'm assuming
that's Output Number, then String).

#2:
w32err.c: In function 'map_windows32_error_to_string':
w32err.c:70:3: warning: passing argument 2 of 'fatal' makes integer from
pointer without a cast [enabled by default]
   fatal(NILF, szMessageBuffer);
   ^
In file included from w32err.c:19:0:
../../makeint.h:433:6: note: expected 'size_t' but argument is of type 'char
*'
 void fatal (const gmk_floc *flocp, size_t length, const char *fmt, ...)
      ^
w32err.c:70:3: error: too few arguments to function 'fatal'
   fatal(NILF, szMessageBuffer);
   ^
In file included from w32err.c:19:0:
../../makeint.h:433:6: note: declared here
 void fatal (const gmk_floc *flocp, size_t length, const char *fmt, ...)
      ^

This call wasn't updated by 757849c. Since it has no arguments for the
ellipsis, I believe it needs plain O().


Then there is a severe warning:

#3:
main.c: In function 'prepare_mutex_handle_string':
main.c:796:7: warning: format '%x' expects argument of type 'unsigned int',
but argument 3 has type 'sync_handle_t' [-Wformat=]
       sprintf (sync_mutex, "0x%x", handle);
       ^

job.h typedefs sync_handle_t to intptr_t for WINDOWS32 (otherwise it's int).
When intptr_t is 64-bit, "%x" is definitely wrong.

Note that this sprintf() is guarded by #ifdef WINDOWS32 above, so we don't
need to worry about other platforms. Using the MS length modifier, "%Ix"
will work for both 32-bit and 64-bit builds.

Also note that job.c 197 is already using this length modifier in sprintf
(pidstring, "%Id", pid);.


Then there are innocuous warnings:

#4:
function.c: In function 'func_shell_base':
function.c:1625:7: warning: variable 'errfd' set but not used
[-Wunused-but-set-variable]
   int errfd;
       ^

#5:
getopt.c: In function '_getopt_internal':
getopt.c:679:8: warning: suggest explicit braces to avoid ambiguous 'else'
[-Wparentheses]
     if (opterr)
        ^

#6:
job.c: In function 'reap_children':
job.c:666:9: warning: label 'remote_status_lose' defined but not used
[-Wunused-label]
         remote_status_lose:
         ^

#7:
job.c: In function 'construct_command_argv_internal':
job.c:2667:9: warning: variable 'end' set but not used
[-Wunused-but-set-variable]
   char *end;
         ^

These were all easy to fix.

Thanks,
STL

Attachment: make-mingw-w64.patch
Description: Binary data


reply via email to

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