remove warning for gcc 4.7
This commit is contained in:
parent
0ed670f409
commit
17a9cd71be
6 changed files with 12 additions and 12 deletions
|
@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
|||
Brainfuck bf(ifs);
|
||||
if (mode == 0) {
|
||||
static int stack[128 * 1024];
|
||||
((void (*)(void*, void*, int *))(void*)bf.getCode())((void*)putchar, (void*)getchar, stack);
|
||||
((void (*)(void*, void*, int *))(const void*)bf.getCode())((void*)putchar, (void*)getchar, stack);
|
||||
} else {
|
||||
dump(bf.getCode(), bf.getSize());
|
||||
}
|
||||
|
|
|
@ -194,10 +194,10 @@ int main(int argc, char *argv[])
|
|||
valTbl.resize(varTbl.size());
|
||||
#ifdef XBYAK32
|
||||
puts("32bit mode");
|
||||
void (*func)(double *ret, const double *valTbl) = (void (*)(double *, const double*))(void*)funcGen.getCode();
|
||||
void (*func)(double *ret, const double *valTbl) = (void (*)(double *, const double*))(const void*)funcGen.getCode();
|
||||
#else
|
||||
puts("64bit mode");
|
||||
double (*func)(const double *valTbl) = (double (*)(const double*))(void*)funcGen.getCode();
|
||||
double (*func)(const double *valTbl) = (double (*)(const double*))(const void*)funcGen.getCode();
|
||||
#endif
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (size_t j = 0, n = valTbl.size(); j < n; j++) {
|
||||
|
|
|
@ -192,7 +192,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
Quantize jit(qTbl);
|
||||
//printf("jit size=%d, ptr=%p\n", jit.getSize(), jit.getCode());
|
||||
void (*quantize2)(uint32*, const uint32*, const uint32 *) = (void (*)(uint32*, const uint32*, const uint32 *))(void*)jit.getCode();
|
||||
void (*quantize2)(uint32*, const uint32*, const uint32 *) = (void (*)(uint32*, const uint32*, const uint32 *))(const void*)jit.getCode();
|
||||
|
||||
quantize(dest, src, qTbl);
|
||||
quantize2(dest2, src, qTbl);
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
#endif
|
||||
ret();
|
||||
}
|
||||
int (*get() const)(int) { return (int (*)(int))(void*)getCode(); }
|
||||
int (*get() const)(int) { return (int (*)(int))(const void*)getCode(); }
|
||||
};
|
||||
|
||||
class CallAtoi : public Xbyak::CodeGenerator {
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
#endif
|
||||
ret();
|
||||
}
|
||||
int (*get() const)(const char *) { return (int (*)(const char *))(void*)getCode(); }
|
||||
int (*get() const)(const char *) { return (int (*)(const char *))(const void*)getCode(); }
|
||||
};
|
||||
|
||||
class JmpAtoi : public Xbyak::CodeGenerator {
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
jmp((void*)atoi);
|
||||
#endif
|
||||
}
|
||||
int (*get() const)(const char *) { return (int (*)(const char *))(void*)getCode(); }
|
||||
int (*get() const)(const char *) { return (int (*)(const char *))(const void*)getCode(); }
|
||||
};
|
||||
|
||||
int main()
|
||||
|
@ -106,7 +106,7 @@ int main()
|
|||
#else
|
||||
puts("32bit");
|
||||
#endif
|
||||
int (*func)(int) = (int (*)(int))(void*)s.getCode();
|
||||
int (*func)(int) = (int (*)(int))(const void*)s.getCode();
|
||||
for (int i = 0; i <= 10; i++) {
|
||||
printf("0 + ... + %d = %d\n", i, func(i));
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ int main()
|
|||
uint8 *p = CodeArray::getAlignedAddress(buf);
|
||||
CodeArray::protect(p, codeSize, true);
|
||||
Sample s(p, codeSize);
|
||||
int (*func)(int) = (int (*)(int))(void*)s.getCode();
|
||||
int (*func)(int) = (int (*)(int))(const void*)s.getCode();
|
||||
if ((uint8*)func != p) {
|
||||
fprintf(stderr, "internal error %p %p\n", p, func);
|
||||
return 1;
|
||||
|
|
|
@ -50,7 +50,7 @@ void putCPUinfo()
|
|||
if (cpu.has(Cpu::tPOPCNT)) {
|
||||
const int n = 0x12345678; // bitcount = 13
|
||||
const int ok = 13;
|
||||
int r = ((int (*)())((void*)PopCountTest(n).getCode()))();
|
||||
int r = ((int (*)())((const void*)PopCountTest(n).getCode()))();
|
||||
if (r == ok) {
|
||||
puts("popcnt ok");
|
||||
} else {
|
||||
|
@ -71,7 +71,7 @@ struct EipTest : public Xbyak::CodeGenerator {
|
|||
void putEip()
|
||||
{
|
||||
EipTest s;
|
||||
int (*getEip)() = (int(*)())(void*)s.getCode();
|
||||
int (*getEip)() = (int(*)())(const void*)s.getCode();
|
||||
printf("eip=%08x\n", getEip());
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -274,7 +274,7 @@ public:
|
|||
}
|
||||
void runByJIT()
|
||||
{
|
||||
((void (*)())(void*)getCode())();
|
||||
((void (*)())(const void*)getCode())();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue