diff options
author | MITSUNARI Shigeo <[email protected]> | 2012-05-10 16:06:05 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2012-05-10 16:06:05 +0900 |
commit | 17a9cd71bea73e7c0d7ca04f3cdf363481f50c4c (patch) | |
tree | ffbdbe849a0452f504a2eab48455d60da08119c4 /sample | |
parent | 0ed670f409edace0f65849f022313d5fa48957d2 (diff) | |
download | xbyak-17a9cd71bea73e7c0d7ca04f3cdf363481f50c4c.tar.gz xbyak-17a9cd71bea73e7c0d7ca04f3cdf363481f50c4c.zip |
remove warning for gcc 4.7
Diffstat (limited to 'sample')
-rw-r--r-- | sample/bf.cpp | 2 | ||||
-rw-r--r-- | sample/calc.cpp | 4 | ||||
-rw-r--r-- | sample/quantize.cpp | 2 | ||||
-rw-r--r-- | sample/test0.cpp | 10 | ||||
-rw-r--r-- | sample/test_util.cpp | 4 | ||||
-rw-r--r-- | sample/toyvm.cpp | 2 |
6 files changed, 12 insertions, 12 deletions
diff --git a/sample/bf.cpp b/sample/bf.cpp index aec6ef4..b907f95 100644 --- a/sample/bf.cpp +++ b/sample/bf.cpp @@ -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()); } diff --git a/sample/calc.cpp b/sample/calc.cpp index 826e23e..68e01a3 100644 --- a/sample/calc.cpp +++ b/sample/calc.cpp @@ -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++) { diff --git a/sample/quantize.cpp b/sample/quantize.cpp index 6b79a62..101feb0 100644 --- a/sample/quantize.cpp +++ b/sample/quantize.cpp @@ -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); diff --git a/sample/test0.cpp b/sample/test0.cpp index 04d616a..8acff9e 100644 --- a/sample/test0.cpp +++ b/sample/test0.cpp @@ -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; diff --git a/sample/test_util.cpp b/sample/test_util.cpp index 7826010..fc969eb 100644 --- a/sample/test_util.cpp +++ b/sample/test_util.cpp @@ -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 diff --git a/sample/toyvm.cpp b/sample/toyvm.cpp index 8516249..733fe60 100644 --- a/sample/toyvm.cpp +++ b/sample/toyvm.cpp @@ -274,7 +274,7 @@ public: } void runByJIT() { - ((void (*)())(void*)getCode())(); + ((void (*)())(const void*)getCode())(); } }; |