From 25e4bb040cfc9494ee15d5608072e87714abac02 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Wed, 21 Feb 2018 13:02:05 +0000 Subject: [PATCH] added a new debugging macro HCL_DEBUG_LEXER removed the debugging macro HCL_DBEUG_BIGINT --- lib/hcl-prv.h | 12 +++++++----- lib/read.c | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/hcl-prv.h b/lib/hcl-prv.h index 282efa6..33b0080 100644 --- a/lib/hcl-prv.h +++ b/lib/hcl-prv.h @@ -57,11 +57,10 @@ #define HCL_USE_OBJECT_TRAILER - #if defined(HCL_BUILD_DEBUG) +#define HCL_DEBUG_LEXER 1 #define HCL_DEBUG_VM_PROCESSOR 1 #define HCL_DEBUG_VM_EXEC 1 -#define HCL_DEBUG_BIGINT 1 #define HCL_PROFILE_VM 1 #endif @@ -76,10 +75,12 @@ */ #define HCL_LIMIT_OBJ_SIZE -#include /* TODO: delete these header inclusion lines */ -#include - #if defined(__has_builtin) + +# if (!__has_builtin(__builtin_memset) || !__has_builtin(__builtin_memcpy) || !__has_builtin(__builtin_memmove) || !__has_builtin(__builtin_memcmp)) +# include +# endif + # if __has_builtin(__builtin_memset) # define HCL_MEMSET(dst,src,size) __builtin_memset(dst,src,size) # else @@ -109,6 +110,7 @@ # define HCL_MEMCMP(dst,src,size) __builtin_memcmp(dst,src,size) #else +# include # define HCL_MEMSET(dst,src,size) memset(dst,src,size) # define HCL_MEMCPY(dst,src,size) memcpy(dst,src,size) # define HCL_MEMMOVE(dst,src,size) memmove(dst,src,size) diff --git a/lib/read.c b/lib/read.c index ad6edee..233ee04 100644 --- a/lib/read.c +++ b/lib/read.c @@ -1196,7 +1196,9 @@ retry: break; } -HCL_DEBUG2 (hcl, "TOKEN: [%.*js]\n", (hcl_ooi_t)TOKEN_NAME_LEN(hcl), TOKEN_NAME_PTR(hcl)); +#if defined(HCL_DEBUG_LEXER) + HCL_DEBUG2 (hcl, "TOKEN: [%.*js]\n", (hcl_ooi_t)TOKEN_NAME_LEN(hcl), TOKEN_NAME_PTR(hcl)); +#endif return 0; }