x86: return proper error if cs_option() enables AT&T syntax but AT&T support is opt-out at compile time
diff --git a/COMPILE.TXT b/COMPILE.TXT
index f65aa27..f9dfaea 100644
--- a/COMPILE.TXT
+++ b/COMPILE.TXT
@@ -27,7 +27,7 @@
- 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.
diff --git a/COMPILE_CMAKE.TXT b/COMPILE_CMAKE.TXT
index d41d7d4..a19ba43 100644
--- a/COMPILE_CMAKE.TXT
+++ b/COMPILE_CMAKE.TXT
@@ -37,7 +37,7 @@
- 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 &
diff --git a/arch/X86/X86Module.c b/arch/X86/X86Module.c
index ccbe2b2..ce1de15 100644
--- a/arch/X86/X86Module.c
+++ b/arch/X86/X86Module.c
@@ -48,6 +48,10 @@
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;
diff --git a/include/capstone.h b/include/capstone.h
index 2872846..7518eaa 100644
--- a/include/capstone.h
+++ b/include/capstone.h
@@ -243,6 +243,8 @@
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;
/*