1
0
Fork 0

kill warning

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@877 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 2012-04-01 03:39:31 +00:00
parent f4df9ff62c
commit 0a9fa1c496
5 changed files with 88 additions and 89 deletions

View File

@ -28,7 +28,7 @@
typedef int bbid_t;
enum {
BBID_INVALID = -1,
BBID_INVALID = -1
};
/* {{{ basic block */
typedef struct _bb_t {

View File

@ -98,11 +98,11 @@ struct _xc_processor_t {
const xc_op_array_info_t *active_op_array_infos_src;
zend_bool readonly_protection; /* wheather it's present */
IFASSERT(xc_stack_t allocsizes;)
IFAUTOCHECK(xc_stack_t allocsizes;)
};
/* }}} */
/* {{{ memsetptr */
IFASSERT(`dnl
IFAUTOCHECK(`dnl
static void *memsetptr(void *mem, void *content, size_t n)
{
void **p = (void **) mem;
@ -170,11 +170,11 @@ static inline int xc_zstrlen(int type, const_zstr s)
REDEF(`KIND', `calc')
#undef C_RELAYLINE
#define C_RELAYLINE
IFASSERT(`
IFAUTOCHECK(`
#undef C_RELAYLINE
#define C_RELAYLINE , __LINE__
')
static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFASSERT(`, int relayline')) {
static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFAUTOCHECK(`, int relayline')) {
pushdef(`__LINE__', `relayline')
int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size);
long dummy = 1;
@ -186,7 +186,7 @@ static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type,
/* new string */
ALLOC(, char, realsize)
}
IFASSERT(`
IFAUTOCHECK(`
else {
dnl fprintf(stderr, "dupstr %s\n", ZSTR_S(str));
}
@ -196,7 +196,7 @@ static inline void xc_calc_string_n(xc_processor_t *processor, zend_uchar type,
/* }}} */
/* {{{ xc_store_string_n */
REDEF(`KIND', `store')
static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFASSERT(`, int relayline')) {
static inline zstr xc_store_string_n(xc_processor_t *processor, zend_uchar type, const_zstr str, long size IFAUTOCHECK(`, int relayline')) {
pushdef(`__LINE__', `relayline')
int realsize = UNISW(size, (type == IS_UNICODE) ? UBYTES(size) : size);
zstr ret, *pret;
@ -340,7 +340,7 @@ static void xc_zend_extension_op_array_ctor_handler(zend_extension *extension, z
}
/* }}} */
/* {{{ field name checker */
IFASSERT(`dnl
IFAUTOCHECK(`dnl
static int xc_check_names(const char *file, int line, const char *functionName, const char **assert_names, int assert_names_count, HashTable *done_names)
{
int errors = 0;
@ -393,7 +393,7 @@ $1 *xc_processor_store_$1(xc_cache_t *cache, $1 *src TSRMLS_DC) {
processor.reference = 1;
processor.cache = cache;
IFASSERT(`xc_stack_init(&processor.allocsizes);')
IFAUTOCHECK(`xc_stack_init(&processor.allocsizes);')
/* calc size */ {
zend_hash_init(&processor.strings, 0, NULL, NULL, 0);
@ -419,10 +419,10 @@ $1 *xc_processor_store_$1(xc_cache_t *cache, $1 *src TSRMLS_DC) {
`$1', `xc_entry_data_php_t', `src->have_references = processor.have_references;'
)
IFASSERT(`xc_stack_reverse(&processor.allocsizes);')
IFAUTOCHECK(`xc_stack_reverse(&processor.allocsizes);')
/* store {{{ */
{
IFASSERT(`char *oldp;')
IFAUTOCHECK(`char *oldp;')
zend_hash_init(&processor.strings, 0, NULL, NULL, 0);
if (processor.reference) {
zend_hash_init(&processor.zvalptrs, 0, NULL, NULL, 0);
@ -434,7 +434,7 @@ $1 *xc_processor_store_$1(xc_cache_t *cache, $1 *src TSRMLS_DC) {
dst = NULL;
goto err_alloc;
}
IFASSERT(`oldp = processor.p;')
IFAUTOCHECK(`oldp = processor.p;')
assert(processor.p == (char *) ALIGN(processor.p));
/* allocate */
@ -442,7 +442,7 @@ $1 *xc_processor_store_$1(xc_cache_t *cache, $1 *src TSRMLS_DC) {
processor.p = (char *) ALIGN(processor.p + sizeof(dst[0]));
xc_store_$1(&processor, dst, src TSRMLS_CC);
IFASSERT(` {
IFAUTOCHECK(` {
int real = processor.p - oldp;
int should = processor.size;
if (real != processor.size) {
@ -458,7 +458,7 @@ err_alloc:
}
/* }}} */
IFASSERT(`xc_stack_destroy(&processor.allocsizes);')
IFAUTOCHECK(`xc_stack_destroy(&processor.allocsizes);')
return dst;
}

View File

@ -31,7 +31,7 @@ define(`ALLOC', `
pushdef(`REALTYPE', `ifelse(`$5', , `$2', `$5')')
/* allocate */
IFCALC(`
IFASSERT(`
IFAUTOCHECK(`
xc_stack_push(&processor->allocsizes, (void *) (long) (SIZE));
xc_stack_push(&processor->allocsizes, (void *) (long) (__LINE__));
')
@ -39,7 +39,7 @@ define(`ALLOC', `
processor->size += SIZE;
')
IFSTORE(`
IFASSERT(`{
IFAUTOCHECK(`{
if (!xc_stack_count(&processor->allocsizes)) {
fprintf(stderr, "mismatch `$@' at line %d\n", __LINE__);
}
@ -57,7 +57,7 @@ define(`ALLOC', `
')
$1 = (REALTYPE *) (processor->p = (char *) ALIGN(processor->p));
ifelse(`$4', `', `
IFASSERT(`memsetptr($1, (void *) (unsigned long) __LINE__, SIZE);')
IFAUTOCHECK(`memsetptr($1, (void *) (unsigned long) __LINE__, SIZE);')
', `
memset($1, 0, SIZE);
')
@ -74,7 +74,7 @@ define(`ALLOC', `
REALTYPE*COUNT, `zval*1', `ALLOC_ZVAL($1);',
REALTYPE*COUNT, `HashTable*1', `ALLOC_HASHTABLE($1);',
`', `', `$1 = (REALTYPE *) emalloc(SIZE);')
IFASSERT(`memsetptr($1, (void *) __LINE__, SIZE);')
IFAUTOCHECK(`memsetptr($1, (void *) __LINE__, SIZE);')
', `
$1 = (REALTYPE *) ecalloc(COUNT, sizeof($2));
')
@ -104,11 +104,11 @@ define(`PROC_CLASS_ENTRY_P_EX', `
}
')
dnl }}}
dnl {{{ IFASSERTEX
define(`IFASSERTEX', `ifdef(`XCACHE_ENABLE_TEST', `$1', `$2')')
dnl {{{ IFAUTOCHECKEX
define(`IFAUTOCHECKEX', `ifdef(`XCACHE_ENABLE_TEST', `$1', `$2')')
dnl }}}
dnl {{{ IFASSERT
define(`IFASSERT', `IFASSERTEX(`
dnl {{{ IFAUTOCHECK
define(`IFAUTOCHECK', `IFAUTOCHECKEX(`
#ifndef NDEBUG
$1
#endif
@ -205,14 +205,14 @@ foreach(`i', `($1)', `popdef(`item_'defn(`i'))')dnl
')
dnl }}}
dnl {{{ DONE_*
define(`DONE_SIZE', `IFASSERT(`dnl
done_size += $1`';
done_count ++;
define(`DONE_SIZE', `IFAUTOCHECK(`dnl
xc_autocheck_done_size += $1`';
xc_autocheck_done_count ++;
')')
define(`DONE', `
define(`ELEMENTS_DONE', defn(`ELEMENTS_DONE')`,"$1"')
IFASSERT(`dnl
if (zend_u_hash_exists(&done_names, IS_STRING, "$1", sizeof("$1"))) {
IFAUTOCHECK(`dnl
if (zend_u_hash_exists(&xc_autocheck_done_names, IS_STRING, "$1", sizeof("$1"))) {
fprintf(stderr
, "duplicate field at %s `#'%d FUNC_NAME`' : %s\n"
, __FILE__, __LINE__
@ -221,7 +221,7 @@ define(`DONE', `
}
else {
zend_uchar b = 1;
zend_hash_add(&done_names, "$1", sizeof("$1"), (void*)&b, sizeof(b), NULL);
zend_hash_add(&xc_autocheck_done_names, "$1", sizeof("$1"), (void*)&b, sizeof(b), NULL);
}
')
DONE_SIZE(`sizeof(SRC(`$1'))')
@ -235,15 +235,15 @@ $1
')
dnl }}}
dnl {{{ IF**
define(`IFCALC', `ifelse(KIND, `calc', `$1', `$2')')
define(`IFSTORE', `ifelse(KIND, `store', `$1', `$2')')
define(`IFCALC', `ifelse(PROCESSOR_TYPE, `calc', `$1', `$2')')
define(`IFSTORE', `ifelse(PROCESSOR_TYPE, `store', `$1', `$2')')
define(`IFCALCSTORE', `IFSTORE(`$1', `IFCALC(`$1', `$2')')')
define(`IFRESTORE', `ifelse(KIND, `restore', `$1', `$2')')
define(`IFRESTORE', `ifelse(PROCESSOR_TYPE, `restore', `$1', `$2')')
define(`IFCOPY', `IFSTORE(`$1', `IFRESTORE(`$1', `$2')')')
define(`IFCALCCOPY', `IFCALC(`$1', `IFCOPY(`$1', `$2')')')
define(`IFDPRINT', `ifelse(KIND, `dprint', `$1', `$2')')
define(`IFASM', `ifelse(KIND, `asm', `$1', `$2')')
define(`IFDASM', `ifelse(KIND, `dasm', `$1', `$2')')
define(`IFDPRINT', `ifelse(PROCESSOR_TYPE, `dprint', `$1', `$2')')
define(`IFASM', `ifelse(PROCESSOR_TYPE, `asm', `$1', `$2')')
define(`IFDASM', `ifelse(PROCESSOR_TYPE, `dasm', `$1', `$2')')
dnl }}}
EXPORT(`zend_op')
EXPORT(`zend_op_array')
@ -264,23 +264,23 @@ include(srcdir`/processor/process.m4')
include(srcdir`/processor/head.m4')
define(`IFNOTMEMCPY', `ifdef(`USEMEMCPY', `', `$1')')
REDEF(`KIND', `calc') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `calc') include(srcdir`/processor/processor.m4')
pushdef(`xc_get_class_num', ``xc_get_class_num'($@)')
REDEF(`KIND', `store') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `store') include(srcdir`/processor/processor.m4')
popdef(`xc_get_class_num')
pushdef(`xc_get_class', ``xc_get_class'($@)')
REDEF(`KIND', `restore') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `restore') include(srcdir`/processor/processor.m4')
popdef(`xc_get_class')
REDEF(`IFNOTMEMCPY', `$1')
#ifdef HAVE_XCACHE_DPRINT
REDEF(`KIND', `dprint') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `dprint') include(srcdir`/processor/processor.m4')
#endif /* HAVE_XCACHE_DPRINT */
#ifdef HAVE_XCACHE_DISASSEMBLER
REDEF(`KIND', `dasm') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `dasm') include(srcdir`/processor/processor.m4')
#endif /* HAVE_XCACHE_DISASSEMBLER */
#ifdef HAVE_XCACHE_ASSEMBLER
REDEF(`KIND', `asm') include(srcdir`/processor/processor.m4')
REDEF(`PROCESSOR_TYPE', `asm') include(srcdir`/processor/processor.m4')
#endif /* HAVE_XCACHE_ASSEMBLER */
ifdef(`EXIT_PENDING', `m4exit(EXIT_PENDING)')

View File

@ -61,7 +61,6 @@ DEF_STRUCT_P_FUNC(`zend_brk_cont_element', , `dnl {{{
')
dnl }}}
DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr', `zval_ptr')
DEF_HASH_TABLE_FUNC(`HashTable_zval_ptr_nullable', `zval_ptr_nullable')
DEF_HASH_TABLE_FUNC(`HashTable_zend_function', `zend_function')
#ifdef ZEND_ENGINE_2
DEF_HASH_TABLE_FUNC(`HashTable_zend_property_info', `zend_property_info')
@ -172,7 +171,7 @@ DEF_STRUCT_P_FUNC(`zval_ptr', , `dnl {{{
IFCOPY(`
dst[0] = *ppzv;
/* *dst is updated */
dnl fprintf(stderr, "*dst is set to %p, KIND is_shm %d\n", dst[0], xc_is_shm(dst[0]));
dnl fprintf(stderr, "*dst is set to %p, PROCESSOR_TYPE is_shm %d\n", dst[0], xc_is_shm(dst[0]));
')
IFCALCSTORE(`processor->have_references = 1;')
IFSTORE(`assert(xc_is_shm(dst[0]));')
@ -781,7 +780,7 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
gc_op_array.opcodes = gc_opcodes ? dst->opcodes : NULL;
xc_gc_add_op_array(&gc_op_array TSRMLS_CC);
}
define(`SKIPASSERT_ONCE')
xc_autocheck_skip = 1;
}
else
')
@ -988,6 +987,7 @@ DEF_STRUCT_P_FUNC(`xc_constinfo_t', , `dnl {{{
')
dnl }}}
#endif
IFRESTORE(`', `
DEF_STRUCT_P_FUNC(`xc_op_array_info_detail_t', , `dnl {{{
PROCESS(zend_uint, index)
PROCESS(zend_uint, info)
@ -1003,6 +1003,7 @@ DEF_STRUCT_P_FUNC(`xc_op_array_info_t', , `dnl {{{
#endif
')
dnl }}}
')
DEF_STRUCT_P_FUNC(`xc_funcinfo_t', , `dnl {{{
PROCESS(zend_uint, key_size)
#ifdef IS_UNICODE
@ -1049,6 +1050,7 @@ DEF_STRUCT_P_FUNC(`xc_classinfo_t', , `dnl {{{
#endif
')
dnl }}}
IFRESTORE(`', `
#ifdef ZEND_ENGINE_2_1
DEF_STRUCT_P_FUNC(`xc_autoglobal_t', , `dnl {{{
PROCESS(zend_uint, key_len)
@ -1062,6 +1064,8 @@ DEF_STRUCT_P_FUNC(`xc_autoglobal_t', , `dnl {{{
')
dnl }}}
#endif
')
IFRESTORE(`', `
#ifdef E_STRICT
DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{
PROCESS(int, type)
@ -1071,6 +1075,7 @@ DEF_STRUCT_P_FUNC(`xc_compilererror_t', , `dnl {{{
')
dnl }}}
#endif
')
DEF_STRUCT_P_FUNC(`xc_entry_data_php_t', , `dnl {{{
IFCOPY(`
processor->php_dst = dst;

View File

@ -1,5 +1,5 @@
define(`pushdefFUNC_NAME', `
pushdef(`FUNC_NAME', `xc_`'KIND`'_`'ifelse(`$2', `', `$1', `$2')')
pushdef(`FUNC_NAME', `xc_`'PROCESSOR_TYPE`'_`'ifelse(`$2', `', `$1', `$2')')
')
dnl {{{ DECL_STRUCT_P_FUNC(1:type, 2:name, 3:comma=;)
define(`DECL_STRUCT_P_FUNC', `translit(
@ -29,7 +29,7 @@ define(`DEF_STRUCT_P_FUNC', `
DECL_STRUCT_P_FUNC(`$1', `$2', 1)
{
pushdef(`ELEMENTS_DONE')
IFASSERT(`
IFAUTOCHECK(`
/* {{{ init assert */
ifdef(`SIZEOF_$1', , `m4_errprint(`missing SIZEOF_$1, safe to ignore')')
ifdef(`COUNTOF_$1', , `m4_errprint(`missing COUNTOF_$1, safe to ignore')')
@ -44,11 +44,12 @@ DECL_STRUCT_P_FUNC(`$1', `$2', 1)
', `
define(`COUNTOF_$1', 0)
')
int assert_size = SIZEOF_$1, assert_count = COUNTOF_$1;
int done_size = 0, done_count = 0;
const char *assert_names[] = { ifdef(`ELEMENTSOF_$1', `ELEMENTSOF_$1') };
HashTable done_names;
zend_hash_init(&done_names, 0, NULL, NULL, 0);
int xc_autocheck_assert_size = SIZEOF_$1, assert_count = COUNTOF_$1;
int xc_autocheck_done_size = 0, xc_autocheck_done_count = 0;
const char *xc_autocheck_assert_names[] = { ifdef(`ELEMENTSOF_$1', `ELEMENTSOF_$1') };
zend_bool xc_autocheck_skip = 0;
HashTable xc_autocheck_done_names;
zend_hash_init(&xc_autocheck_done_names, 0, NULL, NULL, 0);
/* }}} */
IFRESTORE(`assert(xc_is_shm(src));')
IFCALCSTORE(`assert(!xc_is_shm(src));')
@ -70,51 +71,44 @@ DECL_STRUCT_P_FUNC(`$1', `$2', 1)
indent --;
INDENT()fprintf(stderr, "}\n");
')
ifdef(`SKIPASSERT_ONCE', `
undefine(`SKIPASSERT_ONCE')
IFASSERT(`
zend_hash_destroy(&done_names);
')
', `
IFASSERT(`
/* {{{ check assert */ do {
int name_check_errors = xc_check_names(__FILE__, __LINE__, "FUNC_NAME", assert_names, sizeof(assert_names) / sizeof(assert_names[0]), &done_names);
zend_hash_destroy(&done_names);
IFAUTOCHECK(`
/* {{{ autocheck */ if (!xc_autocheck_skip) {
int name_check_errors = xc_check_names(__FILE__, __LINE__, "FUNC_NAME", xc_autocheck_assert_names, sizeof(xc_autocheck_assert_names) / sizeof(xc_autocheck_assert_names[0]), &xc_autocheck_done_names);
zend_hash_destroy(&xc_autocheck_done_names);
if (done_count != assert_count) {
fprintf(stderr
, "count assertion failed at %s `#'%d FUNC_NAME`' : unexpected:%d - expecting:%d = %d != 0\n"
, __FILE__, __LINE__
, done_count, assert_count, done_count - assert_count
);
}
if (done_size != assert_size) {
fprintf(stderr
, "size assertion failed at %s `#'%d FUNC_NAME`' : unexpected:%d - expecting:%d = %d != 0\n"
, __FILE__, __LINE__
, done_size, assert_size, done_size - assert_size
);
}
if (name_check_errors || done_count != assert_count || done_size != assert_size) {
assert(0);
}
} while (0); /* }}} */
')
ifdef(`ELEMENTSOF_$1', `
pushdef(`ELEMENTS_UNDONE', LIST_DIFF(defn(`ELEMENTSOF_$1'), defn(`ELEMENTS_DONE')))
ifelse(defn(`ELEMENTS_UNDONE'), , `m4_errprint(`AUTOCHECK INFO: $1: processor looks good')', `
m4_errprint(`AUTOCHECK ERROR: ====' KIND `$1 =================')
m4_errprint(`AUTOCHECK expected:' defn(`ELEMENTSOF_$1'))
m4_errprint(`AUTOCHECK missing :' defn(`ELEMENTS_UNDONE'))
define(`EXIT_PENDING', 1)
')
popdef(`ELEMENTS_UNDONE')
if (xc_autocheck_done_count != assert_count) {
fprintf(stderr
, "count assertion failed at %s `#'%d FUNC_NAME`' : unexpected:%d - expecting:%d = %d != 0\n"
, __FILE__, __LINE__
, xc_autocheck_done_count, assert_count, xc_autocheck_done_count - assert_count
);
}
if (xc_autocheck_done_size != xc_autocheck_assert_size) {
fprintf(stderr
, "size assertion failed at %s `#'%d FUNC_NAME`' : unexpected:%d - expecting:%d = %d != 0\n"
, __FILE__, __LINE__
, xc_autocheck_done_size, xc_autocheck_assert_size, xc_autocheck_done_size - xc_autocheck_assert_size
);
}
if (name_check_errors || xc_autocheck_done_count != assert_count || xc_autocheck_done_size != xc_autocheck_assert_size) {
assert(0);
}
} while (0); /* }}} */
')
ifdef(`ELEMENTSOF_$1', `
pushdef(`ELEMENTS_UNDONE', LIST_DIFF(defn(`ELEMENTSOF_$1'), defn(`ELEMENTS_DONE')))
ifelse(defn(`ELEMENTS_UNDONE'), , `m4_errprint(`AUTOCHECK INFO: $1: processor looks good')', `
m4_errprint(`AUTOCHECK ERROR: ====' PROCESSOR_TYPE `$1 =================')
m4_errprint(`AUTOCHECK expected:' defn(`ELEMENTSOF_$1'))
m4_errprint(`AUTOCHECK missing :' defn(`ELEMENTS_UNDONE'))
define(`EXIT_PENDING', 1)
')
popdef(`ELEMENTS_UNDONE')
')
ifdef(`USEMEMCPY', `IFCOPY(`
} while (0);
')')
IFASSERT(`
IFAUTOCHECK(`
} while (0);
')
popdef(`ELEMENTS_DONE')