summaryrefslogtreecommitdiff
path: root/asmrun
diff options
context:
space:
mode:
authorSébastien Hinderer <Sebastien.Hinderer@inria.fr>2016-11-15 15:02:09 +0100
committerDavid Allsopp <david.allsopp@metastack.com>2016-12-06 17:24:36 +0100
commitf16c5fb1d4acfb73a28496c7d12e5c59945d838a (patch)
tree96a5f197fc33c85ab8c5c04dfca629569cac8fca /asmrun
parenta35c6117e6a2c957d5dc3ba950375718f09a5cb5 (diff)
downloadocaml-f16c5fb1d4acfb73a28496c7d12e5c59945d838a.tar.gz
Fix a couple of warnings in C code.
This commit fixes the list of warnings below. They have been obtained while compiling the MinGW port with gcc version 4.9.2. A few remarks are due: 1. Several warnings are about the _WIN32_WINNT macro. This commit gets rid of those warnings by #undef-ing the macro in those files that define it anyway. 2. In win32graph/draw.c, the function caml_gr_show_bitmap which causes a warning has been removed, because this (broken) code is actually not called by any other function. It turned out that all the functions defined in the win32graph/dib.c module are unused, too. This dib.c module has thus been removed completely. 3. The warnings about variables that might be used without having been previously initialised occur because the C compiler does not realise that unix_error never returns. So, fixing this warning does not require any modification of the source files where it occurs. It rather requires to declare that unix_error does not return on Windows, as is actually already done on Unix. List of fixed warnings : asmrun/clambda_checks.c: clambda_checks.c: In function ‘caml_check_field_access’: clambda_checks.c:62:7: warning: unknown conversion type character ‘l’ in format [-Wformat=] (ARCH_UINT64_TYPE) Long_val(pos), descr); ^ clambda_checks.c:62:7: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘long long unsigned int’ [-Wformat=] clambda_checks.c:62:7: warning: too many arguments for format [-Wformat-extra-args] clambda_checks.c:68:7: warning: unknown conversion type character ‘l’ in format [-Wformat=] (ARCH_UINT64_TYPE) Long_val(pos), (void*) v, descr); ^ clambda_checks.c:68:7: warning: format ‘%p’ expects argument of type ‘void *’, but argument 3 has type ‘long long unsigned int’ [-Wformat=] clambda_checks.c:68:7: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘void *’ [-Wformat=] clambda_checks.c:68:7: warning: too many arguments for format [-Wformat-extra-args] clambda_checks.c:82:7: warning: unknown conversion type character ‘l’ in format [-Wformat=] descr); ^ clambda_checks.c:82:7: warning: format ‘%p’ expects argument of type ‘void *’, but argument 3 has type ‘long long unsigned int’ [-Wformat=] clambda_checks.c:82:7: warning: unknown conversion type character ‘l’ in format [-Wformat=] clambda_checks.c:82:7: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘void *’ [-Wformat=] clambda_checks.c:82:7: warning: too many arguments for format [-Wformat-extra-args] otherlibs/win32unix/createprocess.c: createprocess.c: In function ‘win_create_process_native’: createprocess.c:66:5: warning: implicit declaration of function ‘caml_stat_free’ [-Wimplicit-function-declaration] caml_stat_free(exefile); ^ otherlibs/win32unix/select.c: In file included from select.c:21:0: winworker.h:19:0: warning: "_WIN32_WINNT" redefined #define _WIN32_WINNT 0x0400 ^ In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/crtdefs.h:10:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/stdint.h:28, from /usr/lib/gcc/i686-w64-mingw32/4.9.2/include/stdint.h:9, from ../../byterun/caml/config.h:34, from ../../byterun/caml/mlvalues.h:22, from select.c:16: /usr/i686-w64-mingw32/sys-root/mingw/include/_mingw.h:225:0: note: this is the location of the previous definition #define _WIN32_WINNT 0x502 ^ select.c: In function ‘find_handle’: select.c:906:3: warning: enumeration value ‘SELECT_MODE_NONE’ not handled in switch [-Wswitch] switch( iterResult->EMode ) ^ select.c: In function ‘unix_select’: select.c:1267:19: warning: enumeration value ‘SELECT_MODE_NONE’ not handled in switch [-Wswitch] switch (iterResult->EMode) ^ otherlibs/win32unix/sockopt.c: sockopt.c: In function ‘unix_setsockopt_aux’: sockopt.c:200:7: warning: ‘optsize’ may be used uninitialized in this function [-Wmaybe-uninitialized] if (setsockopt(Socket_val(socket), level, option, ^ otherlibs/win32unix/startup.cstartup.c: In file included from startup.c:20:0: winworker.h:19:0: warning: "_WIN32_WINNT" redefined #define _WIN32_WINNT 0x0400 ^ In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/crtdefs.h:10:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/stdio.h:9, from startup.c:16: /usr/i686-w64-mingw32/sys-root/mingw/include/_mingw.h:225:0: note: this is the location of the previous definition #define _WIN32_WINNT 0x502 ^ otherlibs/win32unix/winworker.c In file included from winworker.c:20:0: winworker.h:19:0: warning: "_WIN32_WINNT" redefined #define _WIN32_WINNT 0x0400 ^ In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/crtdefs.h:10:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/stdint.h:28, from /usr/lib/gcc/i686-w64-mingw32/4.9.2/include/stdint.h:9, from ../../byterun/caml/config.h:34, from ../../byterun/caml/mlvalues.h:22, from winworker.c:16: /usr/i686-w64-mingw32/sys-root/mingw/include/_mingw.h:225:0: note: this is the location of the previous definition #define _WIN32_WINNT 0x502 ^ otherlibs/unix/access.c: access.c:36:0: warning: "X_OK" redefined # define X_OK 4/* test for execute permission - not implemented in Win32 */ ^ In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/direct.h:10:0, from unixsupport.h:23, from access.c:20: /usr/i686-w64-mingw32/sys-root/mingw/include/io.h:174:0: note: this is the location of the previous definition #define X_OK 1 /* Check for execute permission. */ ^ otherlibs/unix/socketaddr.c: socketaddr.c: In function ‘alloc_sockaddr’: socketaddr.c:153:3: warning: ‘res’ may be used uninitialized in this function [-Wmaybe-uninitialized] return res; ^ otherlibs/win32graph/open.c: open.c: In function ‘caml_gr_open_graph’: open.c:270:18: warning: pointer targets in passing argument 6 of ‘CreateThread’ differ in signedness [-Wpointer-sign] &tid); ^ In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/winbase.h:29:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:70, from libgraph.h:17, from open.c:20: /usr/i686-w64-mingw32/sys-root/mingw/include/processthreadsapi.h:160:28: note: expected ‘LPDWORD’ but argument is of type ‘long int *’ WINBASEAPI HANDLE WINAPI CreateThread (LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId); ^ otherlibs/win32graph/draw.c: draw.c: In function ‘caml_gr_show_bitmap’: draw.c:309:9: warning: implicit declaration of function ‘AfficheBitmap’ [-Wimplicit-function-declaration] AfficheBitmap(filename,grwindow.gcBitmap,x,Wcvt(y)); ^ otherlibs/systhreads/st_stubs.c: In file included from st_stubs.c:50:0: st_win32.h:18:0: warning: "_WIN32_WINNT" redefined #define _WIN32_WINNT 0x0400 ^ In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/crtdefs.h:10:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/stdint.h:28, from /usr/lib/gcc/i686-w64-mingw32/4.9.2/include/stdint.h:9, from ../../byterun/caml/config.h:34, from ../../byterun/caml/misc.h:24, from ../../byterun/caml/alloc.h:23, from st_stubs.c:18: /usr/i686-w64-mingw32/sys-root/mingw/include/_mingw.h:225:0: note: this is the location of the previous definition #define _WIN32_WINNT 0x502 ^
Diffstat (limited to 'asmrun')
-rw-r--r--asmrun/clambda_checks.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/asmrun/clambda_checks.c b/asmrun/clambda_checks.c
index 7409fa1dad..1d25ecbc4f 100644
--- a/asmrun/clambda_checks.c
+++ b/asmrun/clambda_checks.c
@@ -58,13 +58,15 @@ value caml_check_field_access(value v, value pos, value v_descr)
const char* descr = String_val(v_descr);
value orig_v = v;
if (v == (value) 0) {
- fprintf(stderr, "Access to field %lld of NULL: %s\n",
- (ARCH_UINT64_TYPE) Long_val(pos), descr);
+ fprintf(stderr,
+ "Access to field %" ARCH_INT64_PRINTF_FORMAT
+ "u of NULL: %s\n", (ARCH_UINT64_TYPE) Long_val(pos), descr);
abort();
}
if (!Is_block(v)) {
fprintf(stderr,
- "Access to field %lld of non-boxed value %p is illegal: %s\n",
+ "Access to field %" ARCH_INT64_PRINTF_FORMAT
+ "u of non-boxed value %p is illegal: %s\n",
(ARCH_UINT64_TYPE) Long_val(pos), (void*) v, descr);
abort();
}
@@ -76,7 +78,8 @@ value caml_check_field_access(value v, value pos, value v_descr)
assert(Long_val(pos) >= 0);
if (Long_val(pos) >= Wosize_val(v)) {
fprintf(stderr,
- "Access to field %lld of value %p of size %lld is illegal: %s\n",
+ "Access to field %" ARCH_INT64_PRINTF_FORMAT
+ "u of value %p of size %" ARCH_INT64_PRINTF_FORMAT "u is illegal: %s\n",
(ARCH_UINT64_TYPE) Long_val(pos), (void*) v,
(ARCH_UINT64_TYPE) Wosize_val(v),
descr);