diff options
author | MITSUNARI Shigeo <[email protected]> | 2020-02-26 15:24:47 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2020-02-26 15:35:37 +0900 |
commit | 5fc69fc8e2577c071549e00f9b6dc410813fb713 (patch) | |
tree | 709474d1b7267053fa71c0fdd2ca4b7c13d4aea1 | |
parent | e69e0b420a7e3f415527b9a0bd80f5a9708439f2 (diff) | |
download | xbyak-5fc69fc8e2577c071549e00f9b6dc410813fb713.tar.gz xbyak-5fc69fc8e2577c071549e00f9b6dc410813fb713.zip |
remove warning of testv5.891
-rw-r--r-- | test/make_nm.cpp | 13 | ||||
-rw-r--r-- | test/nm_frame.cpp | 34 | ||||
-rw-r--r-- | test/set_opt.bat | 2 |
3 files changed, 18 insertions, 31 deletions
diff --git a/test/make_nm.cpp b/test/make_nm.cpp index 960cd87..67c523b 100644 --- a/test/make_nm.cpp +++ b/test/make_nm.cpp @@ -1,5 +1,4 @@ #include <stdio.h> -#define XBYAK_NO_OP_NAMES #include "xbyak/xbyak.h" #include "xbyak/xbyak_bin2hex.h" #include <stdlib.h> @@ -897,7 +896,7 @@ class Test { for (size_t j = 0; j < NUM_OF_ARRAY(sufTbl); j++) { if (!(p->mode & (1 << j))) continue; 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) { put(buf, XMM, XMM|MEM, IMM); } else { @@ -984,7 +983,9 @@ class Test { } void putCmov() const { - const char tbl[][4] = { + const struct { + const char *s; + } tbl[] = { "o", "no", "b", @@ -1017,12 +1018,12 @@ class Test { "g", }; for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) { - char buf[16]; - sprintf(buf, "cmov%s", tbl[i]); + char buf[32]; + snprintf(buf, sizeof(buf), "cmov%s", tbl[i].s); put(buf, REG16, REG16|MEM); put(buf, REG32, REG32|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); } } diff --git a/test/nm_frame.cpp b/test/nm_frame.cpp index 9deceba..5a18579 100644 --- a/test/nm_frame.cpp +++ b/test/nm_frame.cpp @@ -1,7 +1,8 @@ #include <stdio.h> -#define XBYAK_NO_OP_NAMES #define XBYAK_ENABLE_OMITTED_OPERAND #include "xbyak/xbyak.h" +#define CYBOZU_TEST_DISABLE_AUTO_RUN +#include "cybozu/test.hpp" using namespace Xbyak; @@ -15,39 +16,24 @@ public: #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 { void operator=(const ErrorSample&); public: void gen() { - bool err; - TEST(mov(ptr[eax],1)); - TEST(test(ptr[eax],1)); - TEST(adc(ptr[eax],1)); - TEST(setz(eax)); + CYBOZU_TEST_EXCEPTION(mov(ptr[eax],1), std::exception); + CYBOZU_TEST_EXCEPTION(test(ptr[eax],1), std::exception); + CYBOZU_TEST_EXCEPTION(adc(ptr[eax],1), std::exception); + CYBOZU_TEST_EXCEPTION(setz(eax), std::exception); } }; + int main() - try { - size_t size = sizeof(Xbyak::Operand); - if (size != 4) { - printf("sizeof Operand %d\n", (int)size); - } - try { - Sample s; - s.gen(); - } catch (std::exception& e) { - printf("ERR:%s\n", e.what()); - } catch (...) { - printf("unknown error\n"); - } + CYBOZU_TEST_EQUAL(sizeof(Xbyak::Operand), 4u); + Sample s; + s.gen(); ErrorSample es; es.gen(); -} catch (std::exception& e) { - printf("err %s\n", e.what()); - return 1; } diff --git a/test/set_opt.bat b/test/set_opt.bat index 836d059..73a83f6 100644 --- a/test/set_opt.bat +++ b/test/set_opt.bat @@ -1,2 +1,2 @@ @echo off -set OPT=/EHsc -I../xbyak /W4 -D_CRT_SECURE_NO_WARNINGS /nologo
\ No newline at end of file +set OPT=/EHsc -I../xbyak -I./ /W4 -D_CRT_SECURE_NO_WARNINGS /nologo
\ No newline at end of file |