From: Klaus Treichel Date: Fri, 23 May 2008 11:00:42 +0000 (+0000) Subject: Fix build with MS cl on windows and some ANSI C issues. X-Git-Tag: before.move.to.git~74 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=71f45b30b04b918412d74b83881d825de69fe889;p=francis%2Flibjit.git Fix build with MS cl on windows and some ANSI C issues. --- diff --git a/ChangeLog b/ChangeLog index 2280d30..c50b998 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-05-23 Klaus Treichel + + * dpas/dpas-scanner.l, tools/gen-rules-scanner.l, + tools/gen-sel-scanner.l: Define YY_NO_UNISTD_H if unistd.h is not + available to prevent flex from including unistd.h. + + * include/jit/jit-arch-x86.h, include/jit/jit-arch-x86.h: Fix the + definition of _JIT_ARCH_GET_CURRENT_FRAME for MS cl. Use a + temporary value for ebp/rbp because cl doesn't like arguments like + f->x in the __asm statements. + + * jit/jit-rules-x86.ins: Move declaration of patch to the start of + the block in JIT_OP_ULONG_TO_NFLOAT to be ANSI C compliant. + 2008-05-21 Aleksey Demakov * include/jit/jit-walk.h (jit_get_next_frame_address): use diff --git a/dpas/dpas-scanner.l b/dpas/dpas-scanner.l index 952b802..5755889 100644 --- a/dpas/dpas-scanner.l +++ b/dpas/dpas-scanner.l @@ -23,6 +23,10 @@ #include "dpas-internal.h" #include "dpas-parser.h" +#include +#ifndef HAVE_UNISTD_H + #define YY_NO_UNISTD_H +#endif extern YYSTYPE yylval; diff --git a/include/jit/jit-arch-x86-64.h b/include/jit/jit-arch-x86-64.h index 6d506f0..5d647b0 100644 --- a/include/jit/jit-arch-x86-64.h +++ b/include/jit/jit-arch-x86-64.h @@ -44,10 +44,12 @@ struct _jit_arch_frame #elif defined(_MSC_VER) && defined(_M_IX86) #define _JIT_ARCH_GET_CURRENT_FRAME(f) \ do { \ + void *__ptr; \ __asm \ { \ - mov qword ptr f, rbp \ + __asm mov qword ptr __ptr, rbp \ } \ + (f) = __ptr; \ } while(0) #else #undef _JIT_ARCH_GET_CURRENT_FRAME diff --git a/include/jit/jit-arch-x86.h b/include/jit/jit-arch-x86.h index e4f285e..12848a9 100644 --- a/include/jit/jit-arch-x86.h +++ b/include/jit/jit-arch-x86.h @@ -34,10 +34,12 @@ #elif defined(_MSC_VER) && defined(_M_IX86) #define _JIT_ARCH_GET_CURRENT_FRAME(f) \ do { \ + void *__ptr; \ __asm \ { \ - mov dword ptr f, ebp \ + __asm mov dword ptr __ptr, ebp \ } \ + (f) = __ptr; \ } while(0) #else #undef _JIT_ARCH_GET_CURRENT_FRAME diff --git a/jit/jit-rules-x86.ins b/jit/jit-rules-x86.ins index b1dfef3..44bfe0d 100644 --- a/jit/jit-rules-x86.ins +++ b/jit/jit-rules-x86.ins @@ -221,12 +221,12 @@ JIT_OP_ULONG_TO_NFLOAT: more_space /* TODO: review wrt relocation for elf pre-compilation */ static float f2pow64; static int inited; + unsigned char *patch; if(!inited) { f2pow64 = jit_float32_pow(2.0, 64); inited = 1; } - unsigned char *patch; x86_push_reg(inst, %2); x86_push_reg(inst, $2); x86_fild_membase(inst, X86_ESP, 0, 1); diff --git a/tools/gen-rules-scanner.l b/tools/gen-rules-scanner.l index 4360ec2..b747787 100644 --- a/tools/gen-rules-scanner.l +++ b/tools/gen-rules-scanner.l @@ -32,6 +32,9 @@ #ifdef HAVE_STDLIB_H #include #endif +#ifndef HAVE_UNISTD_H + #define YY_NO_UNISTD_H +#endif extern YYSTYPE yylval; diff --git a/tools/gen-sel-scanner.l b/tools/gen-sel-scanner.l index 2dc9a33..0759e02 100644 --- a/tools/gen-sel-scanner.l +++ b/tools/gen-sel-scanner.l @@ -32,6 +32,9 @@ #ifdef HAVE_STDLIB_H #include #endif +#ifndef HAVE_UNISTD_H + #define YY_NO_UNISTD_H +#endif extern YYSTYPE yylval;