From: Dale Weiler Date: Fri, 30 Aug 2013 10:49:24 +0000 (-0400) Subject: Rid of util_debug X-Git-Tag: 0.3.5~115 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=commitdiff_plain;h=76c37d9cc0c488bacb927c94e63d0bb8747188db Rid of util_debug --- diff --git a/code.c b/code.c index f3d60ff..5703e50 100644 --- a/code.c +++ b/code.c @@ -253,8 +253,6 @@ static void code_create_header(code_t *code, prog_header_t *code_header, const c code_header->entfield = code->entfields; if (OPTS_FLAG(DARKPLACES_STRING_TABLE_BUG)) { - util_debug("GEN", "Patching stringtable for -fdarkplaces-stringtablebug\n"); - /* >= + P */ vec_push(code->chars, '\0'); /* > */ vec_push(code->chars, '\0'); /* = */ @@ -403,8 +401,7 @@ static bool code_write_memory(code_t *code, uint8_t **datmem, size_t *sizedat, u bool code_write(code_t *code, const char *filename, const char *lnofile) { prog_header_t code_header; - FILE *fp = NULL; - size_t it = 2; + FILE *fp = NULL; code_create_header(code, &code_header, filename, lnofile); @@ -451,60 +448,6 @@ bool code_write(code_t *code, const char *filename, const char *lnofile) { return false; } - util_debug("GEN","HEADER:\n"); - util_debug("GEN"," version: = %d\n", code_header.version ); - util_debug("GEN"," crc16: = %d\n", code_header.crc16 ); - util_debug("GEN"," entfield: = %d\n", code_header.entfield); - util_debug("GEN"," statements = {.offset = % 8d, .length = % 8d}\n", code_header.statements.offset, code_header.statements.length); - util_debug("GEN"," defs = {.offset = % 8d, .length = % 8d}\n", code_header.defs .offset, code_header.defs .length); - util_debug("GEN"," fields = {.offset = % 8d, .length = % 8d}\n", code_header.fields .offset, code_header.fields .length); - util_debug("GEN"," functions = {.offset = % 8d, .length = % 8d}\n", code_header.functions .offset, code_header.functions .length); - util_debug("GEN"," globals = {.offset = % 8d, .length = % 8d}\n", code_header.globals .offset, code_header.globals .length); - util_debug("GEN"," strings = {.offset = % 8d, .length = % 8d}\n", code_header.strings .offset, code_header.strings .length); - - /* FUNCTIONS */ - util_debug("GEN", "FUNCTIONS:\n"); - for (; it < vec_size(code->functions); it++) { - size_t j = code->functions[it].entry; - util_debug("GEN", " {.entry =% 5d, .firstlocal =% 5d, .locals =% 5d, .profile =% 5d, .name =% 5d, .file =% 5d, .nargs =% 5d, .argsize ={%d,%d,%d,%d,%d,%d,%d,%d} }\n", - code->functions[it].entry, - code->functions[it].firstlocal, - code->functions[it].locals, - code->functions[it].profile, - code->functions[it].name, - code->functions[it].file, - code->functions[it].nargs, - code->functions[it].argsize[0], - code->functions[it].argsize[1], - code->functions[it].argsize[2], - code->functions[it].argsize[3], - code->functions[it].argsize[4], - code->functions[it].argsize[5], - code->functions[it].argsize[6], - code->functions[it].argsize[7] - - ); - util_debug("GEN", " NAME: %s\n", &code->chars[code->functions[it].name]); - /* Internal functions have no code */ - if (code->functions[it].entry >= 0) { - util_debug("GEN", " CODE:\n"); - for (;;) { - if (code->statements[j].opcode != INSTR_DONE) - util_debug("GEN", " %-12s {% 5i,% 5i,% 5i}\n", - util_instr_str[code->statements[j].opcode], - code->statements[j].o1.s1, - code->statements[j].o2.s1, - code->statements[j].o3.s1 - ); - else { - util_debug("GEN", " DONE {0x00000,0x00000,0x00000}\n"); - break; - } - j++; - } - } - } - fs_file_close(fp); code_stats(filename, lnofile, code, &code_header); return true; diff --git a/gmqcc.h b/gmqcc.h index 86b0bff..0ecd55f 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -332,7 +332,6 @@ void *stat_mem_allocate (size_t, size_t, const char *); bool util_filexists (const char *); bool util_strupper (const char *); bool util_strdigit (const char *); -void util_debug (const char *, const char *, ...); void util_endianswap (void *, size_t, unsigned int); size_t util_strtocmd (const char *, char *, size_t); diff --git a/main.c b/main.c index eab582d..70d46c5 100644 --- a/main.c +++ b/main.c @@ -568,6 +568,8 @@ int main(int argc, char **argv) { util_seed(time(0)); + printf("size is: %u\n", (unsigned)sizeof(opts_cmd_t)); + if (!options_parse(argc, argv)) { return usage(); } @@ -650,8 +652,6 @@ int main(int argc, char **argv) { } } - util_debug("COM", "starting ...\n"); - /* add macros */ if (OPTS_OPTION_BOOL(OPTION_PP_ONLY) || OPTS_FLAG(FTEPP)) { for (itr = 0; itr < vec_size(ppems); itr++) { @@ -772,7 +772,6 @@ int main(int argc, char **argv) { } cleanup: - util_debug("COM", "cleaning ...\n"); if (ftepp) ftepp_finish(ftepp); con_close(); diff --git a/test.c b/test.c index 4c14931..fdf3777 100644 --- a/test.c +++ b/test.c @@ -736,7 +736,6 @@ static bool task_propagate(const char *curdir, size_t *pad, const char *defs) { char *qcflags = NULL; task_t task; - util_debug("TEST", "compiling task template: %s/%s\n", directories[i], files->d_name); found ++; if (!tmpl) { con_err("error compiling task template: %s\n", files->d_name); @@ -847,8 +846,6 @@ static bool task_propagate(const char *curdir, size_t *pad, const char *defs) { continue; } - util_debug("TEST", "executing test: `%s` [%s]\n", tmpl->description, buf); - /* * Open up some file desciptors for logging the stdout/stderr * to our own. @@ -876,11 +873,6 @@ static bool task_propagate(const char *curdir, size_t *pad, const char *defs) { } vec_free(directories); - util_debug("TEST", "compiled %d task template files out of %d\n", - vec_size(task_tasks), - found - ); - return success; } @@ -903,8 +895,6 @@ static void task_precleanup(const char *curdir) { util_snprintf(buffer, sizeof(buffer), "%s/%s", curdir, files->d_name); if (remove(buffer)) con_err("error removing temporary file: %s\n", buffer); - else - util_debug("TEST", "removed temporary file: %s\n", buffer); } } @@ -934,12 +924,8 @@ static void task_destroy(void) { if (task_tasks[i].compiled || !strcmp(task_tasks[i].tmpl->proceduretype, "-fail")) { if (remove(task_tasks[i].stdoutlogfile)) con_err("error removing stdout log file: %s\n", task_tasks[i].stdoutlogfile); - else - util_debug("TEST", "removed stdout log file: %s\n", task_tasks[i].stdoutlogfile); if (remove(task_tasks[i].stderrlogfile)) con_err("error removing stderr log file: %s\n", task_tasks[i].stderrlogfile); - else - util_debug("TEST", "removed stderr log file: %s\n", task_tasks[i].stderrlogfile); (void)!remove(task_tasks[i].tmpl->tempfilename); } @@ -987,11 +973,6 @@ static bool task_trymatch(size_t i, char ***line) { ); } - util_debug("TEST", "executing qcvm: `%s` [%s]\n", - tmpl->description, - buffer - ); - execute = popen(buffer, "r"); if (!execute) return false; @@ -1138,7 +1119,6 @@ static size_t task_schedualize(size_t *pad) { con_out("test #%u %*s", i + 1, strlen(space[0]) - strlen(space[1]), ""); - util_debug("TEST", "executing task: %d: %s\n", i, task_tasks[i].tmpl->description); /* * Generate a task from thin air if it requires execution in * the QCVM. diff --git a/util.c b/util.c index 6a701e4..9b32e48 100644 --- a/util.c +++ b/util.c @@ -54,20 +54,6 @@ const char *util_instr_str[VINSTR_END] = { "BITAND", "BITOR" }; -void util_debug(const char *area, const char *ms, ...) { - va_list va; - if (!OPTS_OPTION_BOOL(OPTION_DEBUG)) - return; - - if (!strcmp(area, "MEM") && !OPTS_OPTION_BOOL(OPTION_MEMCHK)) - return; - - va_start(va, ms); - con_out ("[%s] ", area); - con_vout(ms, va); - va_end (va); -} - /* * only required if big endian .. otherwise no need to swap * data.