x86: return proper error if cs_option() enables AT&T syntax but AT&T support is opt-out at compile time

This commit is contained in:
Nguyen Anh Quynh 2014-08-20 14:02:14 +08:00
parent a65e77baee
commit 663829431e
4 changed files with 8 additions and 2 deletions

View File

@ -27,7 +27,7 @@ Capstone requires no prerequisite packages, so it is easy to compile & install.
- CAPSTONE_USE_SYS_DYN_MEM: change this if you have your own dynamic memory management.
- CAPSTONE_DIET: use this to make the output binaries more compact.
- CAPSTONE_X86_REDUCE: another option to make X86 binary smaller.
- CAPSTONE_X86_ATT_DISABLE: disables AT&T syntax on x86
- CAPSTONE_X86_ATT_DISABLE: disables AT&T syntax on x86.
By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE
modes are disable.

View File

@ -37,7 +37,7 @@ Get CMake for free from http://www.cmake.org.
- USE_SYS_DYN_MEM: change this to OFF to use your own dynamic memory management.
- BUILD_DIET: change this to ON to make the binaries more compact.
- X86_REDUCE: change this to ON to make X86 binary smaller.
- X86_ATT_DISABLE: change this to ON to disable AT&T syntax on x86
- X86_ATT_DISABLE: change this to ON to disable AT&T syntax on x86.
By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE
modes are disabled. To use your own memory allocations, turn ON both DIET &

View File

@ -48,6 +48,10 @@ static cs_err option(cs_struct *handle, cs_opt_type type, size_t value)
handle->printer = X86_ATT_printInst;
handle->syntax = CS_OPT_SYNTAX_ATT;
break;
#elif !defined(CAPSTONE_DIET) && defined(CAPSTONE_X86_ATT_DISABLE)
// ATT syntax is unsupported
handle->errnum = CS_ERR_X86_ATT;
return CS_ERR_X86_ATT;
#else
// this is irrelevant in CAPSTONE_DIET mode
handle->errnum = CS_ERR_DIET;

View File

@ -243,6 +243,8 @@ typedef enum cs_err {
CS_ERR_VERSION, // Unsupported version (bindings)
CS_ERR_DIET, // Access irrelevant data in "diet" engine
CS_ERR_SKIPDATA, // Access irrelevant data for "data" instruction in SKIPDATA mode
CS_ERR_X86_ATT, // X86 AT&T syntax is unsupported (opt-out at compile time)
CS_ERR_X86_INTEL, // X86 Intel syntax is unsupported (opt-out at compile time)
} cs_err;
/*