Fix warnings when compiling codegen_*.c

Patch from davefiddes. Original commit message :

This fixes the following warnings:

codegen_allocator.c:
 - implict function declaration of rand() due to missing stdlib.h

codegen_backend_x86-64.c:
 - implict function declaration of malloc() due to missing stdlib.h
 - unused variables in codegen_backend_init()
 - invalid typecast in use of host_x86_CALL()

codegen_backend_x86-64-uop.c:
 - Remove unused variable declarations in codegen_CALL_FUNC_RESULT(),
   codegen_LOAD_SEG(), codegen_OR_IMM(), codegen_XOR() and codegen_XOR_IMM()
 - Move debug only variable declarations under the debug conditional define in
   codegen_CALL_FUNC_RESULT(), codegen_LOAD_SEG(), codegen_MEM_LOAD_SINGLE(),
   codegen_MEM_LOAD_DOUBLE(), codegen_MEM_STORE_SINGLE(),
   codegen_MEM_STORE_DOUBLE()

codegen_reg.c:
 - Change (int) typecasts to the correct (intptr_t) for small values stored
   in a pointer. This fixes a series of 64-bit compilation warnings.

Tests:
 - Build with no warnings on Fedora 32 with gcc 10.1
 - Boot a Win98 machine with dynamic compilation enabled
This commit is contained in:
SarahW 2020-07-14 19:54:15 +01:00
commit 9b737f65b1
4 changed files with 20 additions and 24 deletions

View file

@ -1,6 +1,7 @@
#if defined(__linux__) || defined(__APPLE__)
#include <sys/mman.h>
#include <unistd.h>
#include <stdlib.h>
#endif
#if defined WIN32 || defined _WIN32 || defined _WIN32
#include <windows.h>