Changeset 719
- Timestamp:
- 04/09/2011 12:22:14 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 4 modified
-
mkstructinfo.awk (modified) (1 diff)
-
processor/head.m4 (modified) (1 diff)
-
processor/main.m4 (modified) (1 diff)
-
processor/struct.m4 (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/mkstructinfo.awk
r393 r719 50 50 51 51 if (i == 0) { 52 elms = buffer[i];52 elms = "\"" buffer[i] "\""; 53 53 } 54 54 else { 55 elms = elms "," buffer[i];55 elms = elms "," "\"" buffer[i] "\""; 56 56 } 57 57 } -
trunk/processor/head.m4
r690 r719 306 306 } 307 307 /* }}} */ 308 /* {{{ field name checker */ 309 IFASSERT(`dnl 310 int xc_check_names(const char *file, int line, const char *functionName, const char **assert_names, int assert_names_count, HashTable *done_names) 311 { 312 int errors = 0; 313 if (assert_names_count) { 314 int i; 315 Bucket *b; 316 317 for (i = 0; i < assert_names_count; ++i) { 318 if (!zend_hash_exists(done_names, assert_names[i], strlen(assert_names[i]) + 1)) { 319 fprintf(stderr 320 , "missing field at %s `#'%d %s`' : %s\n" 321 , file, line, functionName 322 , assert_names[i] 323 ); 324 ++errors; 325 } 326 } 327 328 for (b = done_names->pListHead; b != NULL; b = b->pListNext) { 329 int known = 0; 330 int i; 331 for (i = 0; i < assert_names_count; ++i) { 332 if (strcmp(assert_names[i], BUCKET_KEY_S(b)) == 0) { 333 known = 1; 334 break; 335 } 336 } 337 if (!known) { 338 fprintf(stderr 339 , "unknown field at %s `#'%d %s`' : %s\n" 340 , file, line, functionName 341 , BUCKET_KEY_S(b) 342 ); 343 ++errors; 344 } 345 } 346 } 347 return errors; 348 } 349 ') 350 /* }}} */ 308 351 dnl ================ export API 309 352 define(`DEFINE_STORE_API', ` -
trunk/processor/main.m4
r715 r719 206 206 dnl }}} 207 207 dnl {{{ DONE_* 208 define(`DONE_SIZE', `IFASSERT(` 208 define(`DONE_SIZE', `IFASSERT(`dnl 209 209 done_size += $1`'; 210 210 done_count ++; 211 211 ')') 212 212 define(`DONE', ` 213 define(`ELEMENTS_DONE', defn(`ELEMENTS_DONE')`,$1') 213 define(`ELEMENTS_DONE', defn(`ELEMENTS_DONE')`,"$1"') 214 IFASSERT(`dnl 215 if (zend_hash_exists(&done_names, "$1", sizeof("$1"))) { 216 fprintf(stderr 217 , "duplicate field at %s `#'%d FUNC_NAME`' : %s\n" 218 , __FILE__, __LINE__ 219 , "$1" 220 ); 221 } 222 else { 223 zend_uchar b = 1; 224 zend_hash_add(&done_names, "$1", sizeof("$1"), (void*)&b, sizeof(b), NULL); 225 } 226 ') 214 227 DONE_SIZE(`sizeof(src->$1)') 215 228 ') -
trunk/processor/struct.m4
r662 r719 30 30 { 31 31 pushdef(`ELEMENTS_DONE') 32 ifdef(`SIZEOF_$1', , `m4_errprint(`AUTOCHECK WARN: $1: missing structinfo, dont panic')define(`SIZEOF_$1', 0)')33 32 IFASSERT(` 34 33 /* {{{ init assert */ 35 ifdef(`SIZEOF_$1', , `m4_errprint(`missing SIZEOF_$1, safe to ignore') define(`SIZEOF_$1', 0)')36 ifdef(`COUNTOF_$1', , `m4_errprint(`missing COUNTOF_$1, safe to ignore') define(`COUNTOF_$1', 0)')34 ifdef(`SIZEOF_$1', , `m4_errprint(`missing SIZEOF_$1, safe to ignore')') 35 ifdef(`COUNTOF_$1', , `m4_errprint(`missing COUNTOF_$1, safe to ignore'))') 37 36 dnl SIZEOF_x COUNTOF_x can be both defined or both not 38 37 ifdef(`SIZEOF_$1', ` … … 48 47 int assert_size = SIZEOF_$1, assert_count = COUNTOF_$1; 49 48 int done_size = 0, done_count = 0; 49 const char *assert_names[] = { ifdef(`ELEMENTSOF_$1', `ELEMENTSOF_$1') }; 50 HashTable done_names; 51 zend_hash_init(&done_names, 0, NULL, NULL, 0); 50 52 /* }}} */ 51 53 IFRESTORE(`assert(xc_is_shm(src));') … … 53 55 do { 54 56 ') 57 ifdef(`SIZEOF_$1', , `m4_errprint(`AUTOCHECK WARN: $1: missing structinfo, dont panic')') 55 58 56 59 ifdef(`USEMEMCPY', `IFCOPY(` … … 68 71 INDENT()fprintf(stderr, "}\n"); 69 72 ') 70 ifdef(`SKIPASSERT_ONCE', `undefine(`SKIPASSERT_ONCE')', ` 73 ifdef(`SKIPASSERT_ONCE', ` 74 undefine(`SKIPASSERT_ONCE') 71 75 IFASSERT(` 72 /* {{{ check assert */ 76 zend_hash_destroy(&done_names); 77 ') 78 ', ` 79 IFASSERT(` 80 /* {{{ check assert */ do { 81 int name_check_errors = xc_check_names(__FILE__, __LINE__, "FUNC_NAME", assert_names, sizeof(assert_names) / sizeof(assert_names[0]), &done_names); 82 zend_hash_destroy(&done_names); 83 73 84 if (done_count != assert_count) { 74 85 fprintf(stderr … … 85 96 ); 86 97 } 87 if ( done_count != assert_count || done_size != assert_size) {98 if (name_check_errors || done_count != assert_count || done_size != assert_size) { 88 99 assert(0); 89 100 } 90 /* }}} */101 } while (0); /* }}} */ 91 102 ') 92 103 ifdef(`ELEMENTSOF_$1', `

