mirror of
https://github.com/herumi/xbyak
synced 2024-11-20 16:06:14 -07:00
remove warning of test
This commit is contained in:
parent
e69e0b420a
commit
5fc69fc8e2
3 changed files with 18 additions and 31 deletions
|
@ -1,5 +1,4 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define XBYAK_NO_OP_NAMES
|
|
||||||
#include "xbyak/xbyak.h"
|
#include "xbyak/xbyak.h"
|
||||||
#include "xbyak/xbyak_bin2hex.h"
|
#include "xbyak/xbyak_bin2hex.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -897,7 +896,7 @@ class Test {
|
||||||
for (size_t j = 0; j < NUM_OF_ARRAY(sufTbl); j++) {
|
for (size_t j = 0; j < NUM_OF_ARRAY(sufTbl); j++) {
|
||||||
if (!(p->mode & (1 << j))) continue;
|
if (!(p->mode & (1 << j))) continue;
|
||||||
char buf[16];
|
char buf[16];
|
||||||
sprintf(buf, "%s%s", p->name, sufTbl[j].name);
|
snprintf(buf, sizeof(buf), "%s%s", p->name, sufTbl[j].name);
|
||||||
if (p->hasImm) {
|
if (p->hasImm) {
|
||||||
put(buf, XMM, XMM|MEM, IMM);
|
put(buf, XMM, XMM|MEM, IMM);
|
||||||
} else {
|
} else {
|
||||||
|
@ -984,7 +983,9 @@ class Test {
|
||||||
}
|
}
|
||||||
void putCmov() const
|
void putCmov() const
|
||||||
{
|
{
|
||||||
const char tbl[][4] = {
|
const struct {
|
||||||
|
const char *s;
|
||||||
|
} tbl[] = {
|
||||||
"o",
|
"o",
|
||||||
"no",
|
"no",
|
||||||
"b",
|
"b",
|
||||||
|
@ -1017,12 +1018,12 @@ class Test {
|
||||||
"g",
|
"g",
|
||||||
};
|
};
|
||||||
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
|
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
|
||||||
char buf[16];
|
char buf[32];
|
||||||
sprintf(buf, "cmov%s", tbl[i]);
|
snprintf(buf, sizeof(buf), "cmov%s", tbl[i].s);
|
||||||
put(buf, REG16, REG16|MEM);
|
put(buf, REG16, REG16|MEM);
|
||||||
put(buf, REG32, REG32|MEM);
|
put(buf, REG32, REG32|MEM);
|
||||||
put(buf, REG64, REG64|MEM);
|
put(buf, REG64, REG64|MEM);
|
||||||
sprintf(buf, "set%s", tbl[i]);
|
snprintf(buf, sizeof(buf), "set%s", tbl[i].s);
|
||||||
put(buf, REG8|REG8_3|MEM);
|
put(buf, REG8|REG8_3|MEM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define XBYAK_NO_OP_NAMES
|
|
||||||
#define XBYAK_ENABLE_OMITTED_OPERAND
|
#define XBYAK_ENABLE_OMITTED_OPERAND
|
||||||
#include "xbyak/xbyak.h"
|
#include "xbyak/xbyak.h"
|
||||||
|
#define CYBOZU_TEST_DISABLE_AUTO_RUN
|
||||||
|
#include "cybozu/test.hpp"
|
||||||
|
|
||||||
using namespace Xbyak;
|
using namespace Xbyak;
|
||||||
|
|
||||||
|
@ -15,39 +16,24 @@ public:
|
||||||
#include "nm.cpp"
|
#include "nm.cpp"
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _STR(x) #x
|
|
||||||
#define TEST(syntax) err = true; try { syntax; err = false; } catch (Xbyak::Error) { } catch (...) { } if (!err) printf("should be err:%s;\n", _STR(syntax))
|
|
||||||
|
|
||||||
class ErrorSample : public CodeGenerator {
|
class ErrorSample : public CodeGenerator {
|
||||||
void operator=(const ErrorSample&);
|
void operator=(const ErrorSample&);
|
||||||
public:
|
public:
|
||||||
void gen()
|
void gen()
|
||||||
{
|
{
|
||||||
bool err;
|
CYBOZU_TEST_EXCEPTION(mov(ptr[eax],1), std::exception);
|
||||||
TEST(mov(ptr[eax],1));
|
CYBOZU_TEST_EXCEPTION(test(ptr[eax],1), std::exception);
|
||||||
TEST(test(ptr[eax],1));
|
CYBOZU_TEST_EXCEPTION(adc(ptr[eax],1), std::exception);
|
||||||
TEST(adc(ptr[eax],1));
|
CYBOZU_TEST_EXCEPTION(setz(eax), std::exception);
|
||||||
TEST(setz(eax));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
try
|
|
||||||
{
|
{
|
||||||
size_t size = sizeof(Xbyak::Operand);
|
CYBOZU_TEST_EQUAL(sizeof(Xbyak::Operand), 4u);
|
||||||
if (size != 4) {
|
Sample s;
|
||||||
printf("sizeof Operand %d\n", (int)size);
|
s.gen();
|
||||||
}
|
|
||||||
try {
|
|
||||||
Sample s;
|
|
||||||
s.gen();
|
|
||||||
} catch (std::exception& e) {
|
|
||||||
printf("ERR:%s\n", e.what());
|
|
||||||
} catch (...) {
|
|
||||||
printf("unknown error\n");
|
|
||||||
}
|
|
||||||
ErrorSample es;
|
ErrorSample es;
|
||||||
es.gen();
|
es.gen();
|
||||||
} catch (std::exception& e) {
|
|
||||||
printf("err %s\n", e.what());
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
@echo off
|
@echo off
|
||||||
set OPT=/EHsc -I../xbyak /W4 -D_CRT_SECURE_NO_WARNINGS /nologo
|
set OPT=/EHsc -I../xbyak -I./ /W4 -D_CRT_SECURE_NO_WARNINGS /nologo
|
Loading…
Reference in a new issue