From: Florian Krohm Date: Sat, 27 Oct 2012 18:39:11 +0000 (+0000) Subject: More Char/HChar fixes and constification. X-Git-Tag: svn/VALGRIND_3_9_0~580 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5337376bf2e094fb96a8914340525b8f890b41ea;p=thirdparty%2Fvalgrind.git More Char/HChar fixes and constification. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13088 --- diff --git a/cachegrind/cg_main.c b/cachegrind/cg_main.c index 78c9d60627..c161177d93 100644 --- a/cachegrind/cg_main.c +++ b/cachegrind/cg_main.c @@ -1259,7 +1259,8 @@ static void fprint_CC_table_and_calc_totals(void) { Int i, fd; SysRes sres; - Char buf[512], *currFile = NULL, *currFn = NULL; + HChar buf[512]; + Char *currFile = NULL, *currFn = NULL; LineCC* lineCC; // Setup output filename. Nb: it's important to do this now, ie. as late @@ -1464,7 +1465,7 @@ static UInt ULong_width(ULong n) static void cg_fini(Int exitcode) { - static Char buf1[128], buf2[128], buf3[128], buf4[123]; + static HChar buf1[128], buf2[128], buf3[128], buf4[123]; static HChar fmt[128]; CacheCC D_total; diff --git a/cachegrind/cg_sim.c b/cachegrind/cg_sim.c index 152e5dd711..ec3fa29f54 100644 --- a/cachegrind/cg_sim.c +++ b/cachegrind/cg_sim.c @@ -46,7 +46,7 @@ typedef struct { Int sets_min_1; Int line_size_bits; Int tag_shift; - Char desc_line[128]; + HChar desc_line[128]; UWord* tags; } cache_t2; diff --git a/callgrind/dump.c b/callgrind/dump.c index 93f711deb5..e923783a78 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -41,7 +41,7 @@ static Char* out_directory = 0; static Bool dumps_initialized = False; /* Command */ -static Char cmdbuf[BUF_LEN]; +static HChar cmdbuf[BUF_LEN]; /* Total reads/writes/misses sum over all dumps and threads. * Updated during CC traversal at dump time. @@ -55,7 +55,7 @@ EventMapping* CLG_(dumpmap) = 0; * print_fn_pos, fprint_apos, fprint_fcost, fprint_jcc, * fprint_fcc_ln, dump_run_info, dump_state_info */ -static Char outbuf[FILENAME_LEN + FN_NAME_LEN + OBJ_NAME_LEN + COSTS_LEN]; +static HChar outbuf[FILENAME_LEN + FN_NAME_LEN + OBJ_NAME_LEN + COSTS_LEN]; Int CLG_(get_dump_counter)(void) { @@ -145,15 +145,15 @@ void init_fpos(FnPos* p) #if 0 static __inline__ -static void my_fwrite(Int fd, Char* buf, Int len) +static void my_fwrite(Int fd, HChar* buf, Int len) { - VG_(write)(fd, (void*)buf, len); + VG_(write)(fd, buf, len); } #else #define FWRITE_BUFSIZE 32000 #define FWRITE_THROUGH 10000 -static Char fwrite_buf[FWRITE_BUFSIZE]; +static HChar fwrite_buf[FWRITE_BUFSIZE]; static Int fwrite_pos; static Int fwrite_fd = -1; @@ -161,11 +161,11 @@ static __inline__ void fwrite_flush(void) { if ((fwrite_fd>=0) && (fwrite_pos>0)) - VG_(write)(fwrite_fd, (void*)fwrite_buf, fwrite_pos); + VG_(write)(fwrite_fd, fwrite_buf, fwrite_pos); fwrite_pos = 0; } -static void my_fwrite(Int fd, Char* buf, Int len) +static void my_fwrite(Int fd, HChar* buf, Int len) { if (fwrite_fd != fd) { fwrite_flush(); @@ -173,7 +173,7 @@ static void my_fwrite(Int fd, Char* buf, Int len) } if (len > FWRITE_THROUGH) { fwrite_flush(); - VG_(write)(fd, (void*)buf, len); + VG_(write)(fd, buf, len); return; } if (FWRITE_BUFSIZE - fwrite_pos <= len) fwrite_flush(); @@ -183,7 +183,7 @@ static void my_fwrite(Int fd, Char* buf, Int len) #endif -static void print_obj(Char* buf, obj_node* obj) +static void print_obj(HChar* buf, obj_node* obj) { //int n; @@ -212,7 +212,7 @@ static void print_obj(Char* buf, obj_node* obj) #endif } -static void print_file(Char* buf, file_node* file) +static void print_file(HChar* buf, file_node* file) { if (CLG_(clo).compress_strings) { CLG_ASSERT(file_dumped != 0); @@ -231,7 +231,7 @@ static void print_file(Char* buf, file_node* file) /* * tag can be "fn", "cfn", "jfn" */ -static void print_fn(Int fd, Char* buf, const HChar* tag, fn_node* fn) +static void print_fn(Int fd, HChar* buf, const HChar* tag, fn_node* fn) { int p; p = VG_(sprintf)(buf, "%s=",tag); @@ -251,7 +251,7 @@ static void print_fn(Int fd, Char* buf, const HChar* tag, fn_node* fn) my_fwrite(fd, buf, p); } -static void print_mangled_fn(Int fd, Char* buf, const HChar* tag, +static void print_mangled_fn(Int fd, HChar* buf, const HChar* tag, Context* cxt, int rec_index) { int p, i; @@ -346,7 +346,7 @@ static Bool print_fn_pos(int fd, FnPos* last, BBCC* bbcc) if (!CLG_(clo).mangle_names) { if (last->rec_index != bbcc->rec_index) { VG_(sprintf)(outbuf, "rec=%d\n\n", bbcc->rec_index); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); last->rec_index = bbcc->rec_index; last->cxt = 0; /* reprint context */ res = True; @@ -361,7 +361,7 @@ static Bool print_fn_pos(int fd, FnPos* last, BBCC* bbcc) if (last_from != 0) { /* switch back to no context */ VG_(sprintf)(outbuf, "frfn=(spontaneous)\n"); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); res = True; } } @@ -376,7 +376,7 @@ static Bool print_fn_pos(int fd, FnPos* last, BBCC* bbcc) if (last->obj != bbcc->cxt->fn[0]->file->obj) { VG_(sprintf)(outbuf, "ob="); print_obj(outbuf+3, bbcc->cxt->fn[0]->file->obj); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); last->obj = bbcc->cxt->fn[0]->file->obj; res = True; } @@ -384,7 +384,7 @@ static Bool print_fn_pos(int fd, FnPos* last, BBCC* bbcc) if (last->file != bbcc->cxt->fn[0]->file) { VG_(sprintf)(outbuf, "fl="); print_file(outbuf+3, bbcc->cxt->fn[0]->file); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); last->file = bbcc->cxt->fn[0]->file; res = True; } @@ -534,13 +534,13 @@ static void fprint_apos(Int fd, AddrPos* curr, AddrPos* last, file_node* func_fi else VG_(sprintf)(outbuf, "fi="); print_file(outbuf+3, curr->file); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); } if (CLG_(clo).dump_bbs) { if (curr->line != last->line) { VG_(sprintf)(outbuf, "ln=%d\n", curr->line); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); } } } @@ -606,7 +606,7 @@ void fprint_pos(Int fd, AddrPos* curr, AddrPos* last) VG_(sprintf)(outbuf+p, "%u ", curr->line); } } - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); } @@ -619,7 +619,7 @@ void fprint_cost(int fd, EventMapping* es, ULong* cost) { int p = CLG_(sprint_mappingcost)(outbuf, es, cost); VG_(sprintf)(outbuf+p, "\n"); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); return; } @@ -692,7 +692,7 @@ static void fprint_jcc(Int fd, jCC* jcc, AddrPos* curr, AddrPos* last, ULong eco if (last->file != target.file) { VG_(sprintf)(outbuf, "jfi="); print_file(outbuf+4, target.file); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); } if (jcc->from->cxt != jcc->to->cxt) { @@ -713,7 +713,7 @@ static void fprint_jcc(Int fd, jCC* jcc, AddrPos* curr, AddrPos* last, ULong eco VG_(sprintf)(outbuf, "jump=%llu ", jcc->call_counter); } - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); fprint_pos(fd, &target, last); my_fwrite(fd, "\n", 1); @@ -731,14 +731,14 @@ static void fprint_jcc(Int fd, jCC* jcc, AddrPos* curr, AddrPos* last, ULong eco if (jcc->from->cxt->fn[0]->file->obj != obj) { VG_(sprintf)(outbuf, "cob="); print_obj(outbuf+4, obj); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); } /* file of called position different to current file? */ if (last->file != file) { VG_(sprintf)(outbuf, "cfi="); print_file(outbuf+4, file); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); } if (CLG_(clo).mangle_names) @@ -749,7 +749,7 @@ static void fprint_jcc(Int fd, jCC* jcc, AddrPos* curr, AddrPos* last, ULong eco if (!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost)) { VG_(sprintf)(outbuf, "calls=%llu ", jcc->call_counter); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); fprint_pos(fd, &target, last); my_fwrite(fd, "\n", 1); @@ -893,7 +893,7 @@ static Bool fprint_bbcc(Int fd, BBCC* bbcc, AddrPos* last) currCost->cost, bbcc->skipped ); #if 0 VG_(sprintf)(outbuf, "# Skipped\n"); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); #endif fprint_fcost(fd, currCost, last); } @@ -915,7 +915,7 @@ static Bool fprint_bbcc(Int fd, BBCC* bbcc, AddrPos* last) fprint_apos(fd, &(currCost->p), last, bbcc->cxt->fn[0]->file); fprint_fcost(fd, currCost, last); } - if (CLG_(clo).dump_bbs) my_fwrite(fd, (void*)"\n", 1); + if (CLG_(clo).dump_bbs) my_fwrite(fd, "\n", 1); /* when every cost was immediatly written, we must have done so, * as this function is only called when there's cost in a BBCC @@ -1259,11 +1259,11 @@ static void fprint_cost_ln(int fd, const HChar* prefix, p = VG_(sprintf)(outbuf, "%s", prefix); p += CLG_(sprint_mappingcost)(outbuf + p, em, cost); VG_(sprintf)(outbuf + p, "\n"); - my_fwrite(fd, (void*)outbuf, VG_(strlen)(outbuf)); + my_fwrite(fd, outbuf, VG_(strlen)(outbuf)); } static ULong bbs_done = 0; -static Char* filename = 0; +static HChar* filename = 0; static void file_err(void) @@ -1283,7 +1283,7 @@ void file_err(void) * * Returns the file descriptor, and -1 on error (no write permission) */ -static int new_dumpfile(Char buf[BUF_LEN], int tid, const HChar* trigger) +static int new_dumpfile(HChar buf[BUF_LEN], int tid, const HChar* trigger) { Bool appending = False; int i, fd; @@ -1331,27 +1331,27 @@ static int new_dumpfile(Char buf[BUF_LEN], int tid, const HChar* trigger) if (!appending) { /* version */ VG_(sprintf)(buf, "version: 1\n"); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); /* creator */ VG_(sprintf)(buf, "creator: callgrind-" VERSION "\n"); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); /* "pid:" line */ VG_(sprintf)(buf, "pid: %d\n", VG_(getpid)()); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); /* "cmd:" line */ VG_(strcpy)(buf, "cmd: "); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); - my_fwrite(fd, (void*)cmdbuf, VG_(strlen)(cmdbuf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); + my_fwrite(fd, cmdbuf, VG_(strlen)(cmdbuf)); } VG_(sprintf)(buf, "\npart: %d\n", out_counter); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); if (CLG_(clo).separate_threads) { VG_(sprintf)(buf, "thread: %d\n", tid); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); } /* "desc:" lines */ @@ -1362,36 +1362,36 @@ static int new_dumpfile(Char buf[BUF_LEN], int tid, const HChar* trigger) /* Global options changing the tracing behaviour */ VG_(sprintf)(buf, "\ndesc: Option: --skip-plt=%s\n", CLG_(clo).skip_plt ? "yes" : "no"); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); VG_(sprintf)(buf, "desc: Option: --collect-jumps=%s\n", CLG_(clo).collect_jumps ? "yes" : "no"); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); VG_(sprintf)(buf, "desc: Option: --separate-recs=%d\n", CLG_(clo).separate_recursions); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); VG_(sprintf)(buf, "desc: Option: --separate-callers=%d\n", CLG_(clo).separate_callers); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); VG_(sprintf)(buf, "desc: Option: --dump-bbs=%s\n", CLG_(clo).dump_bbs ? "yes" : "no"); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); VG_(sprintf)(buf, "desc: Option: --separate-threads=%s\n", CLG_(clo).separate_threads ? "yes" : "no"); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); #endif (*CLG_(cachesim).getdesc)(buf); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); } VG_(sprintf)(buf, "\ndesc: Timerange: Basic block %llu - %llu\n", bbs_done, CLG_(stat).bb_executions); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); VG_(sprintf)(buf, "desc: Trigger: %s\n", trigger ? trigger : "Program termination"); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); #if 0 /* Output function specific config @@ -1401,27 +1401,27 @@ static int new_dumpfile(Char buf[BUF_LEN], int tid, const HChar* trigger) while (fnc) { if (fnc->skip) { VG_(sprintf)(buf, "desc: Option: --fn-skip=%s\n", fnc->name); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); } if (fnc->dump_at_enter) { VG_(sprintf)(buf, "desc: Option: --fn-dump-at-enter=%s\n", fnc->name); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); } if (fnc->dump_at_leave) { VG_(sprintf)(buf, "desc: Option: --fn-dump-at-leave=%s\n", fnc->name); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); } if (fnc->separate_callers != CLG_(clo).separate_callers) { VG_(sprintf)(buf, "desc: Option: --separate-callers%d=%s\n", fnc->separate_callers, fnc->name); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); } if (fnc->separate_recursions != CLG_(clo).separate_recursions) { VG_(sprintf)(buf, "desc: Option: --separate-recs%d=%s\n", fnc->separate_recursions, fnc->name); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); } fnc = fnc->next; } @@ -1433,12 +1433,12 @@ static int new_dumpfile(Char buf[BUF_LEN], int tid, const HChar* trigger) CLG_(clo).dump_instr ? " instr" : "", CLG_(clo).dump_bb ? " bb" : "", CLG_(clo).dump_line ? " line" : ""); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); /* "events:" line */ i = VG_(sprintf)(buf, "events: "); CLG_(sprint_eventmapping)(buf+i, CLG_(dumpmap)); - my_fwrite(fd, (void*)buf, VG_(strlen)(buf)); + my_fwrite(fd, buf, VG_(strlen)(buf)); my_fwrite(fd, "\n", 1); /* summary lines */ @@ -1504,7 +1504,7 @@ static void close_dumpfile(int fd) static Int print_fd; static const HChar* print_trigger; -static Char print_buf[BUF_LEN]; +static HChar print_buf[BUF_LEN]; static void print_bbccs_of_thread(thread_info* ti) { @@ -1541,7 +1541,7 @@ static void print_bbccs_of_thread(thread_info* ti) /* switch back to file of function */ VG_(sprintf)(print_buf, "fe="); print_file(print_buf+3, lastFnPos.cxt->fn[0]->file); - my_fwrite(print_fd, (void*)print_buf, VG_(strlen)(print_buf)); + my_fwrite(print_fd, print_buf, VG_(strlen)(print_buf)); } my_fwrite(print_fd, "\n", 1); } @@ -1571,7 +1571,7 @@ static void print_bbccs_of_thread(thread_info* ti) VG_(sprintf)(print_buf+pos, "%d %llu\n", (*p)->bb->instr_count, ecounter); - my_fwrite(print_fd, (void*)print_buf, VG_(strlen)(print_buf)); + my_fwrite(print_fd, print_buf, VG_(strlen)(print_buf)); } fprint_bbcc(print_fd, *p, &lastAPos); diff --git a/callgrind/events.c b/callgrind/events.c index b942e5d96e..566b5e8b0c 100644 --- a/callgrind/events.c +++ b/callgrind/events.c @@ -192,7 +192,7 @@ EventSet* CLG_(add_event_set)(EventSet* es1, EventSet* es2) return eventset_from_mask(es1->mask | es2->mask); } -Int CLG_(sprint_eventset)(Char* buf, EventSet* es) +Int CLG_(sprint_eventset)(HChar* buf, EventSet* es) { Int i, j, pos; UInt mask; @@ -446,7 +446,7 @@ Bool CLG_(add_diff_cost_lz)(EventSet* es, ULong** pdst, ULong* old, ULong* new_c /* Returns number of characters written */ -Int CLG_(sprint_cost)(Char* buf, EventSet* es, ULong* c) +Int CLG_(sprint_cost)(HChar* buf, EventSet* es, ULong* c) { Int i, pos, skipped = 0; @@ -518,7 +518,7 @@ void CLG_(append_event)(EventMapping* em, const HChar* n) /* Returns number of characters written */ -Int CLG_(sprint_eventmapping)(Char* buf, EventMapping* em) +Int CLG_(sprint_eventmapping)(HChar* buf, EventMapping* em) { Int i, pos = 0; EventGroup* eg; @@ -537,7 +537,7 @@ Int CLG_(sprint_eventmapping)(Char* buf, EventMapping* em) } /* Returns number of characters written */ -Int CLG_(sprint_mappingcost)(Char* buf, EventMapping* em, ULong* c) +Int CLG_(sprint_mappingcost)(HChar* buf, EventMapping* em, ULong* c) { Int i, pos, skipped = 0; diff --git a/callgrind/events.h b/callgrind/events.h index f110110a26..37bc7cc9e0 100644 --- a/callgrind/events.h +++ b/callgrind/events.h @@ -79,7 +79,7 @@ EventSet* CLG_(add_event_group)(EventSet*, Int id); EventSet* CLG_(add_event_group2)(EventSet*, Int id1, Int id2); EventSet* CLG_(add_event_set)(EventSet*, EventSet*); /* Writes event names into buf. Returns number of characters written */ -Int CLG_(sprint_eventset)(Char* buf, EventSet*); +Int CLG_(sprint_eventset)(HChar* buf, EventSet*); /* Operations on costs. A cost pointer of 0 means zero cost. @@ -106,7 +106,7 @@ Bool CLG_(add_and_zero_cost2)(EventSet*,ULong* dst,EventSet*,ULong* src); Bool CLG_(add_diff_cost)(EventSet*,ULong* dst, ULong* old, ULong* new_cost); Bool CLG_(add_diff_cost_lz)(EventSet*,ULong** pdst, ULong* old, ULong* new_cost); /* Returns number of characters written */ -Int CLG_(sprint_cost)(Char* buf, EventSet*, ULong*); +Int CLG_(sprint_cost)(HChar* buf, EventSet*, ULong*); /* EventMapping: An ordered subset of events from an event set. * This is used to print out part of an EventSet, or in another order. @@ -128,8 +128,8 @@ struct _EventMapping { EventMapping* CLG_(get_eventmapping)(EventSet*); void CLG_(append_event)(EventMapping*, const HChar*); /* Returns number of characters written */ -Int CLG_(sprint_eventmapping)(Char* buf, EventMapping*); +Int CLG_(sprint_eventmapping)(HChar* buf, EventMapping*); /* Returns number of characters written */ -Int CLG_(sprint_mappingcost)(Char* buf, EventMapping*, ULong*); +Int CLG_(sprint_mappingcost)(HChar* buf, EventMapping*, ULong*); #endif /* CLG_EVENTS */ diff --git a/callgrind/fn.c b/callgrind/fn.c index bd05ee4150..09546f3bb9 100644 --- a/callgrind/fn.c +++ b/callgrind/fn.c @@ -488,7 +488,7 @@ static BB* exit_bb = 0; */ fn_node* CLG_(get_fn_node)(BB* bb) { - Char filename[FILENAME_LEN], fnname[FN_NAME_LEN]; + HChar filename[FILENAME_LEN], fnname[FN_NAME_LEN]; DebugInfo* di; UInt line_num; fn_node* fn; diff --git a/callgrind/global.h b/callgrind/global.h index 1ed0b2fdba..e51f2108ee 100644 --- a/callgrind/global.h +++ b/callgrind/global.h @@ -660,7 +660,7 @@ struct cachesim_if Bool (*parse_opt)(Char* arg); void (*post_clo_init)(void); void (*clear)(void); - void (*getdesc)(Char* buf); + void (*getdesc)(HChar* buf); void (*printstat)(Int,Int,Int); void (*add_icost)(SimCost, BBCC*, InstrInfo*, ULong); void (*finish)(void); diff --git a/callgrind/main.c b/callgrind/main.c index 22919137a0..2cae802364 100644 --- a/callgrind/main.c +++ b/callgrind/main.c @@ -1403,7 +1403,7 @@ void CLG_(set_instrument_state)(const HChar* reason, Bool state) /* helper for dump_state_togdb */ static void dump_state_of_thread_togdb(thread_info* ti) { - static Char buf[512]; + static HChar buf[512]; static FullCost sum = 0, tmp = 0; Int t, p, i; BBCC *from, *to; @@ -1449,7 +1449,7 @@ static void dump_state_of_thread_togdb(thread_info* ti) /* Dump current state */ static void dump_state_togdb(void) { - static Char buf[512]; + static HChar buf[512]; thread_info** th; int t, p; Int orig_tid = CLG_(current_tid); @@ -1700,7 +1700,7 @@ static UInt ULong_width(ULong n) static void branchsim_printstat(int l1, int l2, int l3) { - static Char buf1[128], buf2[128], buf3[128]; + static HChar buf1[128], buf2[128], buf3[128]; static HChar fmt[128]; FullCost total; ULong Bc_total_b, Bc_total_mp, Bi_total_b, Bi_total_mp; diff --git a/callgrind/sim.c b/callgrind/sim.c index f252cd7c60..eb6ba42bba 100644 --- a/callgrind/sim.c +++ b/callgrind/sim.c @@ -66,7 +66,7 @@ typedef struct { /* Cache state */ typedef struct { - char* name; + const HChar* name; int size; /* bytes */ int assoc; int line_size; /* bytes */ @@ -76,7 +76,7 @@ typedef struct { int line_size_bits; int tag_shift; UWord tag_mask; - char desc_line[128]; + HChar desc_line[128]; UWord* tags; /* for cache use */ @@ -1418,7 +1418,7 @@ void cachesim_clear(void) } -static void cachesim_getdesc(Char* buf) +static void cachesim_getdesc(HChar* buf) { Int p; p = VG_(sprintf)(buf, "\ndesc: I1 cache: %s\n", I1.desc_line); @@ -1472,7 +1472,7 @@ static Bool cachesim_parse_opt(Char* arg) /* Adds commas to ULong, right justifying in a field field_width wide, returns * the string in buf. */ static -Int commify(ULong n, int field_width, char* buf) +Int commify(ULong n, int field_width, HChar* buf) { int len, n_commas, i, j, new_len, space; @@ -1502,7 +1502,7 @@ Int commify(ULong n, int field_width, char* buf) } static -void percentify(Int n, Int ex, Int field_width, char buf[]) +void percentify(Int n, Int ex, Int field_width, HChar buf[]) { int i, len, space; @@ -1796,4 +1796,3 @@ struct cachesim_if CLG_(cachesim) = { /*--------------------------------------------------------------------*/ /*--- end ct_sim.c ---*/ /*--------------------------------------------------------------------*/ - diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c index 07b6303593..45d7d086d3 100644 --- a/coregrind/m_aspacemgr/aspacemgr-common.c +++ b/coregrind/m_aspacemgr/aspacemgr-common.c @@ -64,14 +64,14 @@ void ML_(am_exit)( Int status ) aspacem_assert(2+2 == 5); } -void ML_(am_barf) ( HChar* what ) +void ML_(am_barf) ( const HChar* what ) { VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: %s\n", what); VG_(debugLog)(0, "aspacem", "Exiting now.\n"); ML_(am_exit)(1); } -void ML_(am_barf_toolow) ( HChar* what ) +void ML_(am_barf_toolow) ( const HChar* what ) { VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: %s is too low.\n", what); @@ -81,9 +81,9 @@ void ML_(am_barf_toolow) ( HChar* what ) } void ML_(am_assert_fail)( const HChar* expr, - const Char* file, + const HChar* file, Int line, - const Char* fn ) + const HChar* fn ) { VG_(debugLog)(0, "aspacem", "Valgrind: FATAL: aspacem assertion failed:\n"); @@ -115,7 +115,7 @@ static UInt local_vsprintf ( HChar* buf, const HChar *format, va_list vargs ) { Int ret; - Char *aspacem_sprintf_ptr = buf; + HChar *aspacem_sprintf_ptr = buf; ret = VG_(debugLog_vprintf) ( local_add_to_aspacem_sprintf_buf, @@ -240,7 +240,7 @@ SysRes ML_(am_do_relocate_nooverlap_mapping_NO_NOTIFY)( /* --- Pertaining to files --- */ -SysRes ML_(am_open) ( const Char* pathname, Int flags, Int mode ) +SysRes ML_(am_open) ( const HChar* pathname, Int flags, Int mode ) { SysRes res = VG_(do_syscall3)(__NR_open, (UWord)pathname, flags, mode); return res; diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index b56da6a335..77d9d5f5b6 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -334,7 +334,7 @@ static Int find_nsegment_idx ( Addr a ); static void parse_procselfmaps ( void (*record_mapping)( Addr addr, SizeT len, UInt prot, ULong dev, ULong ino, Off64T offset, - const UChar* filename ), + const HChar* filename ), void (*record_gap)( Addr addr, SizeT len ) ); @@ -419,7 +419,7 @@ static Int allocate_segname ( const HChar* name ) /*--- ---*/ /*-----------------------------------------------------------------*/ -static HChar* show_SegKind ( SegKind sk ) +static const HChar* show_SegKind ( SegKind sk ) { switch (sk) { case SkFree: return " "; @@ -433,7 +433,7 @@ static HChar* show_SegKind ( SegKind sk ) } } -static HChar* show_ShrinkMode ( ShrinkMode sm ) +static const HChar* show_ShrinkMode ( ShrinkMode sm ) { switch (sm) { case SmLower: return "SmLower"; @@ -445,7 +445,7 @@ static HChar* show_ShrinkMode ( ShrinkMode sm ) static void show_len_concisely ( /*OUT*/HChar* buf, Addr start, Addr end ) { - HChar* fmt; + const HChar* fmt; ULong len = ((ULong)end) - ((ULong)start) + 1; if (len < 10*1000*1000ULL) { @@ -477,7 +477,7 @@ static void __attribute__ ((unused)) show_nsegment_full ( Int logLevel, Int segNo, NSegment* seg ) { HChar len_buf[20]; - HChar* name = "(none)"; + const HChar* name = "(none)"; if (seg->fnIdx >= 0 && seg->fnIdx < segnames_used && segnames[seg->fnIdx].inUse @@ -570,7 +570,7 @@ static void show_nsegment ( Int logLevel, Int segNo, NSegment* seg ) } /* Print out the segment array (debugging only!). */ -void VG_(am_show_nsegments) ( Int logLevel, HChar* who ) +void VG_(am_show_nsegments) ( Int logLevel, const HChar* who ) { Int i; VG_(debugLog)(logLevel, "aspacem", @@ -862,7 +862,7 @@ static Bool sync_check_ok = False; static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot, ULong dev, ULong ino, Off64T offset, - const UChar* filename ) + const HChar* filename ) { Int iLo, iHi, i; Bool sloppyXcheck; @@ -990,7 +990,7 @@ static void sync_check_mapping_callback ( Addr addr, SizeT len, UInt prot, prot & VKI_PROT_READ ? 'r' : '-', prot & VKI_PROT_WRITE ? 'w' : '-', prot & VKI_PROT_EXEC ? 'x' : '-', - dev, ino, offset, filename ? (HChar*)filename : "(none)" ); + dev, ino, offset, filename ? filename : "(none)" ); return; } @@ -1535,7 +1535,7 @@ static void init_resvn ( /*OUT*/NSegment* seg, Addr start, Addr end ) static void read_maps_callback ( Addr addr, SizeT len, UInt prot, ULong dev, ULong ino, Off64T offset, - const UChar* filename ) + const HChar* filename ) { NSegment seg; init_nsegment( &seg ); @@ -3098,14 +3098,14 @@ Bool VG_(am_relocate_nooverlap_client)( /*OUT*/Bool* need_discard, #define M_PROCMAP_BUF 100000 /* static ... to keep it out of the stack frame. */ -static Char procmap_buf[M_PROCMAP_BUF]; +static HChar procmap_buf[M_PROCMAP_BUF]; /* Records length of /proc/self/maps read into procmap_buf. */ static Int buf_n_tot; /* Helper fns. */ -static Int hexdigit ( Char c ) +static Int hexdigit ( HChar c ) { if (c >= '0' && c <= '9') return (Int)(c - '0'); if (c >= 'a' && c <= 'f') return 10 + (Int)(c - 'a'); @@ -3113,20 +3113,20 @@ static Int hexdigit ( Char c ) return -1; } -static Int decdigit ( Char c ) +static Int decdigit ( HChar c ) { if (c >= '0' && c <= '9') return (Int)(c - '0'); return -1; } -static Int readchar ( const Char* buf, Char* ch ) +static Int readchar ( const HChar* buf, HChar* ch ) { if (*buf == 0) return 0; *ch = *buf; return 1; } -static Int readhex ( const Char* buf, UWord* val ) +static Int readhex ( const HChar* buf, UWord* val ) { /* Read a word-sized hex number. */ Int n = 0; @@ -3138,7 +3138,7 @@ static Int readhex ( const Char* buf, UWord* val ) return n; } -static Int readhex64 ( const Char* buf, ULong* val ) +static Int readhex64 ( const HChar* buf, ULong* val ) { /* Read a potentially 64-bit hex number. */ Int n = 0; @@ -3150,7 +3150,7 @@ static Int readhex64 ( const Char* buf, ULong* val ) return n; } -static Int readdec64 ( const Char* buf, ULong* val ) +static Int readdec64 ( const HChar* buf, ULong* val ) { Int n = 0; *val = 0; @@ -3219,14 +3219,14 @@ static void read_procselfmaps_into_buf ( void ) static void parse_procselfmaps ( void (*record_mapping)( Addr addr, SizeT len, UInt prot, ULong dev, ULong ino, Off64T offset, - const UChar* filename ), + const HChar* filename ), void (*record_gap)( Addr addr, SizeT len ) ) { Int i, j, i_eol; Addr start, endPlusOne, gapStart; - UChar* filename; - UChar rr, ww, xx, pp, ch, tmp; + HChar* filename; + HChar rr, ww, xx, pp, ch, tmp; UInt prot; UWord maj, min; ULong foffset, dev, ino; @@ -3428,7 +3428,7 @@ static UInt stats_machcalls = 0; static void parse_procselfmaps ( void (*record_mapping)( Addr addr, SizeT len, UInt prot, ULong dev, ULong ino, Off64T offset, - const UChar* filename ), + const HChar* filename ), void (*record_gap)( Addr addr, SizeT len ) ) { @@ -3486,7 +3486,7 @@ static Addr Addr__min ( Addr a, Addr b ) { return a < b ? a : b; } static void add_mapping_callback(Addr addr, SizeT len, UInt prot, ULong dev, ULong ino, Off64T offset, - const UChar *filename) + const HChar *filename) { // derived from sync_check_mapping_callback() diff --git a/coregrind/m_aspacemgr/priv_aspacemgr.h b/coregrind/m_aspacemgr/priv_aspacemgr.h index daa2d8cc1b..cb48bdce31 100644 --- a/coregrind/m_aspacemgr/priv_aspacemgr.h +++ b/coregrind/m_aspacemgr/priv_aspacemgr.h @@ -65,14 +65,14 @@ __attribute__ ((noreturn)) extern void ML_(am_exit) ( Int status ); -extern void ML_(am_barf) ( HChar* what ); -extern void ML_(am_barf_toolow) ( HChar* what ); +extern void ML_(am_barf) ( const HChar* what ); +extern void ML_(am_barf_toolow) ( const HChar* what ); __attribute__ ((noreturn)) extern void ML_(am_assert_fail) ( const HChar* expr, - const Char* file, + const HChar* file, Int line, - const Char* fn ); + const HChar* fn ); #define aspacem_assert(expr) \ ((void) ((expr) ? 0 : \ @@ -105,7 +105,7 @@ extern SysRes ML_(am_do_relocate_nooverlap_mapping_NO_NOTIFY)( /* There is also VG_(do_mmap_NO_NOTIFY), but that's not declared here (obviously). */ -extern SysRes ML_(am_open) ( const Char* pathname, Int flags, Int mode ); +extern SysRes ML_(am_open) ( const HChar* pathname, Int flags, Int mode ); extern void ML_(am_close) ( Int fd ); extern Int ML_(am_read) ( Int fd, void* buf, Int count); extern Int ML_(am_readlink) ( HChar* path, HChar* buf, UInt bufsiz ); diff --git a/coregrind/m_coredump/coredump-elf.c b/coregrind/m_coredump/coredump-elf.c index 42a1965b77..1f8f0c131b 100644 --- a/coregrind/m_coredump/coredump-elf.c +++ b/coregrind/m_coredump/coredump-elf.c @@ -150,7 +150,7 @@ typedef struct note { struct note *next; ESZ(Nhdr) note; - Char name[0]; + HChar name[0]; }; static UInt note_size(const struct note *n) @@ -160,7 +160,7 @@ static UInt note_size(const struct note *n) } #if !defined(VGPV_arm_linux_android) && !defined(VGPV_x86_linux_android) -static void add_note(struct note **list, const Char *name, UInt type, +static void add_note(struct note **list, const HChar *name, UInt type, const void *data, UInt datasz) { Int namelen = VG_(strlen)(name)+1; @@ -191,7 +191,7 @@ static void write_note(Int fd, const struct note *n) static void fill_prpsinfo(const ThreadState *tst, struct vki_elf_prpsinfo *prpsinfo) { - static Char name[VKI_PATH_MAX]; + static HChar name[VKI_PATH_MAX]; VG_(memset)(prpsinfo, 0, sizeof(*prpsinfo)); @@ -219,7 +219,7 @@ static void fill_prpsinfo(const ThreadState *tst, prpsinfo->pr_gid = 0; if (VG_(resolve_filename)(VG_(cl_exec_fd), name, VKI_PATH_MAX)) { - Char *n = name+VG_(strlen)(name)-1; + HChar *n = name+VG_(strlen)(name)-1; while (n > name && *n != '/') n--; @@ -395,7 +395,7 @@ static void fill_fpu(const ThreadState *tst, vki_elf_fpregset_t *fpu) ThreadArchState* arch = (ThreadArchState*)&tst->arch; #if defined(VGP_x86_linux) -//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const Char *from) +//:: static void fill_fpu(vki_elf_fpregset_t *fpu, const HChar *from) //:: { //:: if (VG_(have_ssestate)) { //:: UShort *to; @@ -413,7 +413,7 @@ static void fill_fpu(const ThreadState *tst, vki_elf_fpregset_t *fpu) //:: VG_(memcpy)(fpu, from, sizeof(*fpu)); //:: } -//:: fill_fpu(fpu, (const Char *)&arch->m_sse); +//:: fill_fpu(fpu, (const HChar *)&arch->m_sse); #elif defined(VGP_amd64_linux) //:: fpu->cwd = ?; @@ -504,9 +504,9 @@ static void fill_xfpu(const ThreadState *tst, vki_elf_fpxregset_t *xfpu) static void make_elf_coredump(ThreadId tid, const vki_siginfo_t *si, UInt max_size) { - Char* buf = NULL; - Char *basename = "vgcore"; - Char *coreext = ""; + HChar* buf = NULL; + const HChar *basename = "vgcore"; + const HChar *coreext = ""; Int seq = 0; Int core_fd; NSegment const * seg; diff --git a/coregrind/m_debugger.c b/coregrind/m_debugger.c index 4fc636a72e..ede0fbce0b 100644 --- a/coregrind/m_debugger.c +++ b/coregrind/m_debugger.c @@ -379,11 +379,11 @@ void VG_(start_debugger) ( ThreadId tid ) VG_(kill)(pid, VKI_SIGSTOP) == 0 && VG_(ptrace)(VKI_PTRACE_DETACH, pid, NULL, 0) == 0) { - Char pidbuf[15]; - Char file[50]; - Char buf[N_BUF]; - Char *bufptr; - Char *cmdptr; + HChar pidbuf[15]; + HChar file[50]; + HChar buf[N_BUF]; + HChar *bufptr; + HChar *cmdptr; VG_(sprintf)(pidbuf, "%d", pid); VG_(sprintf)(file, "/proc/%d/fd/%d", pid, VG_(cl_exec_fd)); diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c index f817b59bd5..4baffc7307 100644 --- a/coregrind/m_debuglog.c +++ b/coregrind/m_debuglog.c @@ -71,7 +71,7 @@ void VG_(debugLog_setXml)(Bool xml) #if defined(VGP_x86_linux) -static UInt local_sys_write_stderr ( HChar* buf, Int n ) +static UInt local_sys_write_stderr ( const HChar* buf, Int n ) { Int result; @@ -104,7 +104,7 @@ static UInt local_sys_getpid ( void ) #elif defined(VGP_amd64_linux) __attribute__((noinline)) -static UInt local_sys_write_stderr ( HChar* buf, Int n ) +static UInt local_sys_write_stderr ( const HChar* buf, Int n ) { volatile Long block[2]; block[0] = (Long)buf; @@ -147,7 +147,7 @@ static UInt local_sys_getpid ( void ) #elif defined(VGP_ppc32_linux) -static UInt local_sys_write_stderr ( HChar* buf, Int n ) +static UInt local_sys_write_stderr ( const HChar* buf, Int n ) { volatile Int block[2]; block[0] = (Int)buf; @@ -190,7 +190,7 @@ static UInt local_sys_getpid ( void ) #elif defined(VGP_ppc64_linux) -static UInt local_sys_write_stderr ( HChar* buf, Int n ) +static UInt local_sys_write_stderr ( const HChar* buf, Int n ) { volatile Long block[2]; block[0] = (Long)buf; @@ -233,7 +233,7 @@ static UInt local_sys_getpid ( void ) #elif defined(VGP_arm_linux) -static UInt local_sys_write_stderr ( HChar* buf, Int n ) +static UInt local_sys_write_stderr ( const HChar* buf, Int n ) { volatile Int block[2]; block[0] = (Int)buf; @@ -274,7 +274,7 @@ static UInt local_sys_getpid ( void ) asm code. Both macros give the same results for Unix-class syscalls (which these all are, as identified by the use of 'int 0x80'). */ __attribute__((noinline)) -static UInt local_sys_write_stderr ( HChar* buf, Int n ) +static UInt local_sys_write_stderr ( const HChar* buf, Int n ) { UInt __res; __asm__ volatile ( @@ -316,7 +316,7 @@ static UInt local_sys_getpid ( void ) #elif defined(VGP_amd64_darwin) __attribute__((noinline)) -static UInt local_sys_write_stderr ( HChar* buf, Int n ) +static UInt local_sys_write_stderr ( const HChar* buf, Int n ) { UInt __res; __asm__ volatile ( @@ -350,12 +350,12 @@ static UInt local_sys_getpid ( void ) } #elif defined(VGP_s390x_linux) -static UInt local_sys_write_stderr ( HChar* buf, Int n ) +static UInt local_sys_write_stderr ( const HChar* buf, Int n ) { - register Int r2 asm("2") = 2; /* file descriptor STDERR */ - register HChar* r3 asm("3") = buf; - register ULong r4 asm("4") = n; - register ULong r2_res asm("2"); + register Int r2 asm("2") = 2; /* file descriptor STDERR */ + register const HChar* r3 asm("3") = buf; + register ULong r4 asm("4") = n; + register ULong r2_res asm("2"); ULong __res; __asm__ __volatile__ ( @@ -391,7 +391,7 @@ static UInt local_sys_getpid ( void ) } #elif defined(VGP_mips32_linux) -static UInt local_sys_write_stderr ( HChar* buf, Int n ) +static UInt local_sys_write_stderr ( const HChar* buf, Int n ) { volatile Int block[2]; block[0] = (Int)buf; @@ -453,7 +453,7 @@ static HChar local_toupper ( HChar c ) /* Emit buf[0 .. n-1] to stderr. Unfortunately platform-specific. */ -static void emit ( HChar* buf, Int n ) +static void emit ( const HChar* buf, Int n ) { if (n >= 1) (void)local_sys_write_stderr(buf, n); @@ -489,7 +489,7 @@ UInt myvprintf_str ( void(*send)(HChar,void*), void* send_arg2, Int flags, Int width, - HChar* str, + const HChar* str, Bool capitalise ) { # define MAYBE_TOUPPER(ch) (capitalise ? local_toupper(ch) : (ch)) @@ -535,12 +535,12 @@ UInt myvprintf_str ( void(*send)(HChar,void*), static UInt myvprintf_str_XML_simplistic ( void(*send)(HChar,void*), void* send_arg2, - HChar* str ) + const HChar* str ) { UInt ret = 0; Int i; Int len = local_strlen(str); - HChar* alt; + const HChar* alt; for (i = 0; i < len; i++) { switch (str[i]) { @@ -585,7 +585,7 @@ UInt myvprintf_int64 ( void(*send)(HChar,void*), Int ind = 0; Int i, nc = 0; Bool neg = False; - HChar* digits = capitalised ? "0123456789ABCDEF" : "0123456789abcdef"; + const HChar* digits = capitalised ? "0123456789ABCDEF" : "0123456789abcdef"; UInt ret = 0; if (base < 2 || base > 16) @@ -762,15 +762,15 @@ VG_(debugLog_vprintf) ( i++; /* %pS, like %s but escaping chars for XML safety */ /* Note: simplistic; ignores field width and flags */ - char *str = va_arg (vargs, char *); - if (str == (char*) 0) + HChar *str = va_arg (vargs, HChar *); + if (str == NULL) str = "(null)"; ret += myvprintf_str_XML_simplistic(send, send_arg2, str); } else if (format[i+1] == 's') { i++; /* %ps, synonym for %s with --xml=no / %pS with --xml=yes */ - char *str = va_arg (vargs, char *); - if (str == (char*) 0) + HChar *str = va_arg (vargs, HChar *); + if (str == NULL) str = "(null)"; if (clo_xml) ret += myvprintf_str_XML_simplistic(send, send_arg2, str); @@ -806,8 +806,8 @@ VG_(debugLog_vprintf) ( send(va_arg (vargs, int), send_arg2); break; case 's': case 'S': { /* %s */ - char *str = va_arg (vargs, char *); - if (str == (char*) 0) str = "(null)"; + HChar *str = va_arg (vargs, HChar *); + if (str == NULL) str = "(null)"; ret += myvprintf_str(send, send_arg2, flags, width, str, format[i]=='S'); break; @@ -849,7 +849,7 @@ static Int loglevel = 0; /* Module startup. */ /* EXPORTED */ -void VG_(debugLog_startup) ( Int level, HChar* who ) +void VG_(debugLog_startup) ( Int level, const HChar* who ) { if (level < 0) level = 0; if (level > 10) level = 10; @@ -925,7 +925,7 @@ void VG_(debugLog) ( Int level, const HChar* modulename, (void)myvprintf_str ( add_to_buf, &buf, 0, 1, ":", False ); (void)myvprintf_int64 ( add_to_buf, &buf, 0, 10, 1, False, (ULong)level ); (void)myvprintf_str ( add_to_buf, &buf, 0, 1, ":", False ); - (void)myvprintf_str ( add_to_buf, &buf, 0, 8, (HChar*)modulename, False ); + (void)myvprintf_str ( add_to_buf, &buf, 0, 8, modulename, False ); (void)myvprintf_str ( add_to_buf, &buf, 0, indent, "", False ); va_start(vargs,format); diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c index fe34d015a1..84bf89187b 100644 --- a/coregrind/m_errormgr.c +++ b/coregrind/m_errormgr.c @@ -348,7 +348,7 @@ static void gen_suppression(Error* err) { Char xtra[256]; /* assumed big enough (is overrun-safe) */ Bool anyXtra; - Char* name; + const HChar* name; ExeContext* ec; XArray* /* HChar */ text; diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c index 64db90d687..736bd914af 100644 --- a/coregrind/m_gdbserver/server.c +++ b/coregrind/m_gdbserver/server.c @@ -27,6 +27,7 @@ #include "pub_core_translate.h" #include "pub_core_mallocfree.h" #include "pub_core_initimg.h" +#include "pub_core_syswrap.h" // VG_(show_open_fds) unsigned long cont_thread; unsigned long general_thread; diff --git a/coregrind/m_hashtable.c b/coregrind/m_hashtable.c index 96b8902aaa..abf1df0452 100644 --- a/coregrind/m_hashtable.c +++ b/coregrind/m_hashtable.c @@ -47,7 +47,7 @@ struct _VgHashTable { UInt iterChain; // next chain to be traversed by the iterator VgHashNode** chains; // expanding array of hash chains Bool iterOK; // table safe to iterate over? - HChar* name; // name of table (for debugging only) + const HChar* name; // name of table (for debugging only) }; #define N_HASH_PRIMES 20 @@ -64,7 +64,7 @@ static SizeT primes[N_HASH_PRIMES] = { /*--- Functions ---*/ /*--------------------------------------------------------------------*/ -VgHashTable VG_(HT_construct) ( HChar* name ) +VgHashTable VG_(HT_construct) ( const HChar* name ) { /* Initialises to zero, ie. all entries NULL */ SizeT n_chains = primes[0]; diff --git a/coregrind/m_libcassert.c b/coregrind/m_libcassert.c index 93d333d357..8e555f10b1 100644 --- a/coregrind/m_libcassert.c +++ b/coregrind/m_libcassert.c @@ -271,7 +271,7 @@ void VG_(assert_fail) ( Bool isCore, const HChar* expr, const HChar* file, Int line, const HChar* fn, const HChar* format, ... ) { va_list vargs; - Char buf[256]; + HChar buf[256]; const HChar* component; const HChar* bugs_to; diff --git a/coregrind/m_libcfile.c b/coregrind/m_libcfile.c index 51e8de848a..4f76c83ff8 100644 --- a/coregrind/m_libcfile.c +++ b/coregrind/m_libcfile.c @@ -919,7 +919,7 @@ Int my_connect ( Int sockfd, struct vki_sockaddr_in* serv_addr, Int addrlen ) # endif } -Int VG_(write_socket)( Int sd, void *msg, Int count ) +Int VG_(write_socket)( Int sd, const void *msg, Int count ) { /* This is actually send(). */ diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c index 8f0b520b51..b4a6c2b707 100644 --- a/coregrind/m_libcprint.c +++ b/coregrind/m_libcprint.c @@ -57,7 +57,7 @@ OutputSink VG_(xml_output_sink) = { -1, False }; /* disabled */ /* Do the low-level send of a message to the logging sink. */ static -void send_bytes_to_logging_sink ( OutputSink* sink, Char* msg, Int nbytes ) +void send_bytes_to_logging_sink ( OutputSink* sink, const HChar* msg, Int nbytes ) { if (sink->is_socket) { Int rc = VG_(write_socket)( sink->fd, msg, nbytes ); @@ -179,7 +179,7 @@ static void add_to__sprintf_buf ( HChar c, void *p ) *(*b)++ = c; } -UInt VG_(vsprintf) ( Char* buf, const HChar *format, va_list vargs ) +UInt VG_(vsprintf) ( HChar* buf, const HChar *format, va_list vargs ) { Int ret; HChar* sprintf_ptr = buf; @@ -193,7 +193,7 @@ UInt VG_(vsprintf) ( Char* buf, const HChar *format, va_list vargs ) return ret; } -UInt VG_(sprintf) ( Char* buf, const HChar *format, ... ) +UInt VG_(sprintf) ( HChar* buf, const HChar *format, ... ) { UInt ret; va_list vargs; @@ -226,7 +226,7 @@ static void add_to__snprintf_buf ( HChar c, void* p ) } } -UInt VG_(vsnprintf) ( Char* buf, Int size, const HChar *format, va_list vargs ) +UInt VG_(vsnprintf) ( HChar* buf, Int size, const HChar *format, va_list vargs ) { snprintf_buf_t b; b.buf = buf; @@ -239,7 +239,7 @@ UInt VG_(vsnprintf) ( Char* buf, Int size, const HChar *format, va_list vargs ) return b.buf_used; } -UInt VG_(snprintf) ( Char* buf, Int size, const HChar *format, ... ) +UInt VG_(snprintf) ( HChar* buf, Int size, const HChar *format, ... ) { UInt ret; va_list vargs; @@ -267,11 +267,11 @@ void VG_(vcbprintf)( void(*char_sink)(HChar, void* opaque), // Percentify n/m with d decimal places. Includes the '%' symbol at the end. // Right justifies in 'buf'. -void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char buf[]) +void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, HChar buf[]) { Int i, len, space; ULong p1; - Char fmt[32]; + HChar fmt[32]; if (m == 0) { // Have to generate the format string in order to be flexible about diff --git a/coregrind/m_main.c b/coregrind/m_main.c index 8af79ba828..6658a70556 100644 --- a/coregrind/m_main.c +++ b/coregrind/m_main.c @@ -1415,7 +1415,7 @@ static void show_BB_profile ( BBProfEntry tops[], UInt n_tops, ULong score_total ) { ULong score_cumul, score_here; - Char buf_cumul[10], buf_here[10]; + HChar buf_cumul[10], buf_here[10]; Char name[64]; Int r; diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 75f28b22ff..24ff106cad 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -172,7 +172,7 @@ static struct sched_lock *the_BigLock; ------------------------------------------------------------------ */ static -void print_sched_event ( ThreadId tid, Char* what ) +void print_sched_event ( ThreadId tid, const HChar* what ) { VG_(message)(Vg_DebugMsg, " SCHED[%d]: %s\n", tid, what ); } @@ -253,7 +253,7 @@ ThreadId VG_(alloc_ThreadState) ( void ) When this returns, we'll actually be running. */ -void VG_(acquire_BigLock)(ThreadId tid, HChar* who) +void VG_(acquire_BigLock)(ThreadId tid, const HChar* who) { ThreadState *tst; @@ -301,7 +301,8 @@ void VG_(acquire_BigLock)(ThreadId tid, HChar* who) but it may mean that we remain in a Runnable state and we're just yielding the CPU to another thread). */ -void VG_(release_BigLock)(ThreadId tid, ThreadStatus sleepstate, HChar* who) +void VG_(release_BigLock)(ThreadId tid, ThreadStatus sleepstate, + const HChar* who) { ThreadState *tst = VG_(get_ThreadState)(tid); @@ -316,7 +317,7 @@ void VG_(release_BigLock)(ThreadId tid, ThreadStatus sleepstate, HChar* who) VG_(running_tid) = VG_INVALID_THREADID; if (VG_(clo_trace_sched)) { - Char buf[200]; + HChar buf[200]; vg_assert(VG_(strlen)(who) <= 200-100); VG_(sprintf)(buf, "releasing lock (%s) -> %s", who, VG_(name_of_ThreadStatus)(sleepstate)); @@ -341,13 +342,13 @@ static void deinit_BigLock(void) } /* See pub_core_scheduler.h for description */ -void VG_(acquire_BigLock_LL) ( HChar* who ) +void VG_(acquire_BigLock_LL) ( const HChar* who ) { ML_(acquire_sched_lock)(the_BigLock); } /* See pub_core_scheduler.h for description */ -void VG_(release_BigLock_LL) ( HChar* who ) +void VG_(release_BigLock_LL) ( const HChar* who ) { ML_(release_sched_lock)(the_BigLock); } @@ -1830,7 +1831,7 @@ void do_client_request ( ThreadId tid ) case VG_USERREQ__MAP_IP_TO_SRCLOC: { Addr ip = arg[1]; - UChar* buf64 = (UChar*)arg[2]; + HChar* buf64 = (HChar*)arg[2]; VG_(memset)(buf64, 0, 64); UInt linenum = 0; @@ -1907,8 +1908,8 @@ void do_client_request ( ThreadId tid ) if (!whined && VG_(clo_verbosity) > 2) { // Allow for requests in core, but defined by tools, which // have 0 and 0 in their two high bytes. - Char c1 = (arg[0] >> 24) & 0xff; - Char c2 = (arg[0] >> 16) & 0xff; + HChar c1 = (arg[0] >> 24) & 0xff; + HChar c2 = (arg[0] >> 16) & 0xff; if (c1 == 0) c1 = '_'; if (c2 == 0) c2 = '_'; VG_(message)(Vg_UserMsg, "Warning:\n" diff --git a/coregrind/m_tooliface.c b/coregrind/m_tooliface.c index 1b9522cc8e..b9229ca087 100644 --- a/coregrind/m_tooliface.c +++ b/coregrind/m_tooliface.c @@ -234,7 +234,7 @@ void VG_(needs_tool_errors)( Bool (*read_extra) (Int, Char**, SizeT*, Supp*), Bool (*matches) (Error*, Supp*), const HChar* (*name) (Error*), - Bool (*get_xtra_si)(Error*,/*OUT*/Char*,Int) + Bool (*get_xtra_si)(Error*,/*OUT*/HChar*,Int) ) { VG_(needs).tool_errors = True; diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c index 016d931122..db53b46293 100644 --- a/coregrind/m_translate.c +++ b/coregrind/m_translate.c @@ -73,7 +73,7 @@ static UInt n_SP_updates_generic_unknown = 0; void VG_(print_translation_stats) ( void ) { - Char buf[7]; + HChar buf[7]; UInt n_SP_updates = n_SP_updates_fast + n_SP_updates_generic_known + n_SP_updates_generic_unknown; VG_(percentify)(n_SP_updates_fast, n_SP_updates, 1, 6, buf); diff --git a/coregrind/m_vkiscnums.c b/coregrind/m_vkiscnums.c index dbd1f84093..f7fddcbb4d 100644 --- a/coregrind/m_vkiscnums.c +++ b/coregrind/m_vkiscnums.c @@ -46,13 +46,13 @@ #if defined(VGO_linux) //--------------------------------------------------------------------------- -Char* VG_(sysnum_string)(Word sysnum, SizeT n_buf, Char* buf) +HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf) { VG_(snprintf)(buf, n_buf, "%3ld", sysnum); return buf; } -Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf) +HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf) { return VG_(sysnum_string)(sysnum, n_buf, buf); } @@ -61,9 +61,9 @@ Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf) #elif defined(VGO_darwin) //--------------------------------------------------------------------------- -Char* VG_(sysnum_string)(Word sysnum, SizeT n_buf, Char* buf) +HChar* VG_(sysnum_string)(Word sysnum, SizeT n_buf, HChar* buf) { - Char* classname = NULL; + const HChar* classname = NULL; switch (VG_DARWIN_SYSNO_CLASS(sysnum)) { case VG_DARWIN_SYSCALL_CLASS_MACH: classname = "mach"; break; case VG_DARWIN_SYSCALL_CLASS_UNIX: classname = "unix"; break; @@ -76,7 +76,7 @@ Char* VG_(sysnum_string)(Word sysnum, SizeT n_buf, Char* buf) return buf; } -Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf) +HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf) { return VG_(sysnum_string)(sysnum, n_buf, buf); } diff --git a/coregrind/pub_core_aspacemgr.h b/coregrind/pub_core_aspacemgr.h index 45cac3c8ac..0ed1c4af0d 100644 --- a/coregrind/pub_core_aspacemgr.h +++ b/coregrind/pub_core_aspacemgr.h @@ -98,7 +98,7 @@ extern Bool VG_(am_is_valid_for_client_or_free_or_resvn) extern ULong VG_(am_get_anonsize_total)( void ); /* Show the segment array on the debug log, at given loglevel. */ -extern void VG_(am_show_nsegments) ( Int logLevel, HChar* who ); +extern void VG_(am_show_nsegments) ( Int logLevel, const HChar* who ); /* Get the filename corresponding to this segment, if known and if it has one. The returned name's storage cannot be assumed to be diff --git a/coregrind/pub_core_debuglog.h b/coregrind/pub_core_debuglog.h index 6b2a5a3eee..c49f8ae349 100644 --- a/coregrind/pub_core_debuglog.h +++ b/coregrind/pub_core_debuglog.h @@ -56,7 +56,7 @@ /* Module startup. */ extern -void VG_(debugLog_startup) ( Int level, HChar* who ); +void VG_(debugLog_startup) ( Int level, const HChar* who ); /* Whether %ps should escape XML metacharacters. */ diff --git a/coregrind/pub_core_libcfile.h b/coregrind/pub_core_libcfile.h index 265b280d2f..8e7c20b359 100644 --- a/coregrind/pub_core_libcfile.h +++ b/coregrind/pub_core_libcfile.h @@ -65,7 +65,7 @@ extern UShort VG_(ntohs) ( UShort x ); extern Int VG_(socket) ( Int domain, Int type, Int protocol ); -extern Int VG_(write_socket)( Int sd, void *msg, Int count ); +extern Int VG_(write_socket)( Int sd, const void *msg, Int count ); extern Int VG_(getsockname) ( Int sd, struct vki_sockaddr *name, Int *namelen ); extern Int VG_(getpeername) ( Int sd, struct vki_sockaddr *name, Int *namelen ); extern Int VG_(getsockopt) ( Int sd, Int level, Int optname, diff --git a/coregrind/pub_core_scheduler.h b/coregrind/pub_core_scheduler.h index 81045625bf..60d8c87520 100644 --- a/coregrind/pub_core_scheduler.h +++ b/coregrind/pub_core_scheduler.h @@ -57,12 +57,12 @@ extern void VG_(nuke_all_threads_except) ( ThreadId me, thread state to VgTs_Runnable, and the thread will attempt to take the CPU lock. By the time it returns, tid will be the running thread. */ -extern void VG_(acquire_BigLock) ( ThreadId tid, HChar* who ); +extern void VG_(acquire_BigLock) ( ThreadId tid, const HChar* who ); /* Simple version, which simply acquires the lock, but does not mess with the guest state in the same way as the non _LL version does. */ -extern void VG_(acquire_BigLock_LL) ( HChar* who ); +extern void VG_(acquire_BigLock_LL) ( const HChar* who ); /* Set a thread into a sleeping state. Before the call, the thread must be runnable, and holding the CPU lock. When this call @@ -73,10 +73,10 @@ extern void VG_(acquire_BigLock_LL) ( HChar* who ); the caller's responsibility to actually block until the thread is ready to run again. */ extern void VG_(release_BigLock) ( ThreadId tid, - ThreadStatus state, HChar* who ); + ThreadStatus state, const HChar* who ); /* Matching function to acquire_BigLock_LL. */ -extern void VG_(release_BigLock_LL) ( HChar* who ); +extern void VG_(release_BigLock_LL) ( const HChar* who ); /* Whether the specified thread owns the big lock. */ extern Bool VG_(owns_BigLock_LL) ( ThreadId tid ); diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h index 05d62a7e8a..10a6a75b5a 100644 --- a/coregrind/pub_core_tooliface.h +++ b/coregrind/pub_core_tooliface.h @@ -125,7 +125,7 @@ typedef struct { Bool (*tool_read_extra_suppression_info) (Int, Char**, SizeT*, Supp*); Bool (*tool_error_matches_suppression) (Error*, Supp*); const HChar* (*tool_get_error_name) (Error*); - Bool (*tool_get_extra_suppression_info) (Error*,/*OUT*/Char*,Int); + Bool (*tool_get_extra_suppression_info) (Error*,/*OUT*/HChar*,Int); // VG_(needs).superblock_discards void (*tool_discard_superblock_info)(Addr64, VexGuestExtents); diff --git a/drd/drd_error.c b/drd/drd_error.c index 85304d04a4..feb1494025 100644 --- a/drd/drd_error.c +++ b/drd/drd_error.c @@ -602,7 +602,7 @@ static const HChar* drd_get_error_name(Error* e) */ static Bool drd_get_extra_suppression_info(Error* e, - /*OUT*/Char* buf, Int nBuf) + /*OUT*/HChar* buf, Int nBuf) { return False; } diff --git a/drd/tests/unit_vc.c b/drd/tests/unit_vc.c index d9d9bb5dd6..1e0b984f86 100644 --- a/drd/tests/unit_vc.c +++ b/drd/tests/unit_vc.c @@ -40,7 +40,7 @@ Int VG_(memcmp)(const void* s1, const void* s2, SizeT n) { return memcmp(s1, s2, n); } UInt VG_(printf)(const HChar *format, ...) { UInt ret; va_list vargs; va_start(vargs, format); ret = vprintf(format, vargs); va_end(vargs); return ret; } -UInt VG_(snprintf)(Char* buf, Int size, const HChar *format, ...) +UInt VG_(snprintf)(HChar* buf, Int size, const HChar *format, ...) { UInt ret; va_list vargs; va_start(vargs, format); ret = vsnprintf(buf, size, format, vargs); va_end(vargs); return ret; } SizeT VG_(strlen)(const Char* str) { return strlen(str); } UInt VG_(message)(VgMsgKind kind, const HChar* format, ...) diff --git a/exp-bbv/bbv_main.c b/exp-bbv/bbv_main.c index f0b492aa39..43b8d8f5c2 100644 --- a/exp-bbv/bbv_main.c +++ b/exp-bbv/bbv_main.c @@ -66,7 +66,7 @@ static Bool instr_count_only=False; static Bool generate_pc_file=False; /* write buffer */ -static UChar buf[1024]; +static HChar buf[1024]; /* Global values */ static OSet* instr_info_table; /* table that holds the basic block info */ @@ -137,7 +137,7 @@ static void dumpPcFile(void) static Int open_tracefile(Int thread_num) { SysRes sres; - UChar temp_string[2048]; + HChar temp_string[2048]; /* For thread 1, don't append any thread number */ /* This lets the single-thread case not have any */ diff --git a/exp-sgcheck/pc_common.c b/exp-sgcheck/pc_common.c index 7f8db6c393..dc608a89d7 100644 --- a/exp-sgcheck/pc_common.c +++ b/exp-sgcheck/pc_common.c @@ -268,7 +268,7 @@ void pc_before_pp_Error ( Error* err ) { /* Do a printf-style operation on either the XML or normal output channel, depending on the setting of VG_(clo_xml). */ -static void emit_WRK ( HChar* format, va_list vargs ) +static void emit_WRK ( const HChar* format, va_list vargs ) { if (VG_(clo_xml)) { VG_(vprintf_xml)(format, vargs); @@ -276,15 +276,15 @@ static void emit_WRK ( HChar* format, va_list vargs ) VG_(vmessage)(Vg_UserMsg, format, vargs); } } -static void emit ( HChar* format, ... ) PRINTF_CHECK(1, 2); -static void emit ( HChar* format, ... ) +static void emit ( const HChar* format, ... ) PRINTF_CHECK(1, 2); +static void emit ( const HChar* format, ... ) { va_list vargs; va_start(vargs, format); emit_WRK(format, vargs); va_end(vargs); } -static void emiN ( HChar* format, ... ) /* With NO FORMAT CHECK */ +static void emiN ( const HChar* format, ... ) /* With NO FORMAT CHECK */ { va_list vargs; va_start(vargs, format); @@ -293,7 +293,7 @@ static void emiN ( HChar* format, ... ) /* With NO FORMAT CHECK */ } -static HChar* readwrite(SSizeT sszB) +static const HChar* readwrite(SSizeT sszB) { return ( sszB < 0 ? "write" : "read" ); } @@ -348,7 +348,7 @@ void pc_pp_Error ( Error* err ) //---------------------------------------------------------- case XE_Heap: { - HChar *place, *legit, *how_invalid; + const HChar *place, *legit, *how_invalid; Addr a = xe->XE.Heap.addr; Seg* vseg = xe->XE.Heap.vseg; @@ -468,7 +468,7 @@ void pc_pp_Error ( Error* err ) case XE_Arith: { Seg* seg1 = xe->XE.Arith.seg1; Seg* seg2 = xe->XE.Arith.seg2; - HChar* which; + const HChar* which; tl_assert(BOTTOM != seg1); tl_assert(BOTTOM != seg2 && UNKNOWN != seg2); @@ -545,7 +545,7 @@ void pc_pp_Error ( Error* err ) Seg* seglo = xe->XE.SysParam.seglo; Seg* seghi = xe->XE.SysParam.seghi; const HChar* s = VG_(get_error_string) (err); - HChar* what; + const HChar* what; tl_assert(BOTTOM != seglo && BOTTOM != seghi); @@ -778,7 +778,7 @@ const HChar* pc_get_error_name ( Error* err ) } Bool pc_get_extra_suppression_info ( Error* err, - /*OUT*/Char* buf, Int nBuf ) + /*OUT*/HChar* buf, Int nBuf ) { ErrorKind ekind = VG_(get_error_kind )(err); tl_assert(buf); diff --git a/exp-sgcheck/pc_common.h b/exp-sgcheck/pc_common.h index 86335e1524..20d5bbeabf 100644 --- a/exp-sgcheck/pc_common.h +++ b/exp-sgcheck/pc_common.h @@ -57,7 +57,7 @@ Bool pc_read_extra_suppression_info ( Int fd, Char** bufpp, Bool pc_error_matches_suppression (Error* err, Supp* su); const HChar* pc_get_error_name ( Error* err ); Bool pc_get_extra_suppression_info ( Error* err, - /*OUT*/Char* buf, Int nBuf ); + /*OUT*/HChar* buf, Int nBuf ); extern Bool h_clo_partial_loads_ok; /* extern Bool h_clo_lossage_check; */ diff --git a/helgrind/hg_errors.c b/helgrind/hg_errors.c index bcf89c3b49..9a51ad1fd2 100644 --- a/helgrind/hg_errors.c +++ b/helgrind/hg_errors.c @@ -1390,7 +1390,7 @@ Bool HG_(error_matches_suppression) ( Error* err, Supp* su ) } Bool HG_(get_extra_suppression_info) ( Error* err, - /*OUT*/Char* buf, Int nBuf ) + /*OUT*/HChar* buf, Int nBuf ) { /* Do nothing */ return False; diff --git a/helgrind/hg_errors.h b/helgrind/hg_errors.h index c391582423..919ff52845 100644 --- a/helgrind/hg_errors.h +++ b/helgrind/hg_errors.h @@ -45,7 +45,7 @@ Bool HG_(read_extra_suppression_info) ( Int fd, Char** bufpp, SizeT* nBufp, Bool HG_(error_matches_suppression) ( Error* err, Supp* su ); const HChar* HG_(get_error_name) ( Error* err ); Bool HG_(get_extra_suppression_info) ( Error* err, - /*OUT*/Char* buf, Int nBuf ); + /*OUT*/HChar* buf, Int nBuf ); /* Functions for recording various kinds of errors. */ void HG_(record_error_Race) ( Thread* thr, diff --git a/include/pub_tool_hashtable.h b/include/pub_tool_hashtable.h index f844c887a9..b8d80f4edd 100644 --- a/include/pub_tool_hashtable.h +++ b/include/pub_tool_hashtable.h @@ -53,7 +53,7 @@ typedef struct _VgHashTable * VgHashTable; be freed with VG_(free)(). The table starts small but will periodically be expanded. This is transparent to the users of this module. */ -extern VgHashTable VG_(HT_construct) ( HChar* name ); +extern VgHashTable VG_(HT_construct) ( const HChar* name ); /* Count the number of nodes in a table. */ extern Int VG_(HT_count_nodes) ( VgHashTable table ); diff --git a/include/pub_tool_libcprint.h b/include/pub_tool_libcprint.h index 91a51b4ce6..8536a815b4 100644 --- a/include/pub_tool_libcprint.h +++ b/include/pub_tool_libcprint.h @@ -35,23 +35,23 @@ Formatting functions ------------------------------------------------------------------ */ -extern UInt VG_(sprintf) ( Char* buf, const HChar* format, ... ) +extern UInt VG_(sprintf) ( HChar* buf, const HChar* format, ... ) PRINTF_CHECK(2, 3); -extern UInt VG_(vsprintf) ( Char* buf, const HChar* format, va_list vargs ) +extern UInt VG_(vsprintf) ( HChar* buf, const HChar* format, va_list vargs ) PRINTF_CHECK(2, 0); -extern UInt VG_(snprintf) ( Char* buf, Int size, +extern UInt VG_(snprintf) ( HChar* buf, Int size, const HChar *format, ... ) PRINTF_CHECK(3, 4); -extern UInt VG_(vsnprintf)( Char* buf, Int size, +extern UInt VG_(vsnprintf)( HChar* buf, Int size, const HChar *format, va_list vargs ) PRINTF_CHECK(3, 0); // Percentify n/m with d decimal places. Includes the '%' symbol at the end. // Right justifies in 'buf'. -extern void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, char buf[]); +extern void VG_(percentify)(ULong n, ULong m, UInt d, Int n_buf, HChar buf[]); /* --------------------------------------------------------------------- diff --git a/include/pub_tool_tooliface.h b/include/pub_tool_tooliface.h index aa23a0d5c0..cdd70a4bcf 100644 --- a/include/pub_tool_tooliface.h +++ b/include/pub_tool_tooliface.h @@ -343,7 +343,7 @@ extern void VG_(needs_tool_errors) ( // do nothing, and return False. This function is the inverse of // VG_(tdict).tool_read_extra_suppression_info(). Bool (*print_extra_suppression_info)(Error* err, - /*OUT*/Char* buf, Int nBuf) + /*OUT*/HChar* buf, Int nBuf) ); /* Is information kept by the tool about specific instructions or diff --git a/include/pub_tool_vkiscnums.h b/include/pub_tool_vkiscnums.h index 5eff7ae33b..074037b34b 100644 --- a/include/pub_tool_vkiscnums.h +++ b/include/pub_tool_vkiscnums.h @@ -39,18 +39,18 @@ // This converts a syscall number into a string, suitable for printing. It is // needed because some platforms (Darwin) munge sysnums in various ways. // It is used in places where the sycall name will be printed alongside. -extern Char* VG_(sysnum_string) (Word sysnum, SizeT n_buf, Char* buf); +extern HChar* VG_(sysnum_string) (Word sysnum, SizeT n_buf, HChar* buf); // This is like VG_(sysnum_string), but prints extra info if needed. It is // called in places where the syscall name will *not* be printed alongside. -extern Char* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, Char* buf); +extern HChar* VG_(sysnum_string_extra)(Word sysnum, SizeT n_buf, HChar* buf); // Macros that make the above functions easier to use by declaring a local // buffer. #define VG_SYSNUM_STRING(sysnum) \ - ({ Char qq_zz_buf[32]; VG_(sysnum_string)(sysnum, 32, qq_zz_buf); }) + ({ HChar qq_zz_buf[32]; VG_(sysnum_string)(sysnum, 32, qq_zz_buf); }) #define VG_SYSNUM_STRING_EXTRA(sysnum) \ - ({ Char qq_zz_buf[64]; VG_(sysnum_string_extra)(sysnum, 64, qq_zz_buf); }) + ({ HChar qq_zz_buf[64]; VG_(sysnum_string_extra)(sysnum, 64, qq_zz_buf); }) #endif // __PUB_TOOL_VKISCNUMS_H diff --git a/massif/ms_main.c b/massif/ms_main.c index efc49b0e03..3b7d0247d9 100644 --- a/massif/ms_main.c +++ b/massif/ms_main.c @@ -2139,7 +2139,7 @@ IRSB* ms_instrument ( VgCallbackClosure* closure, //--- Writing snapshots ---// //------------------------------------------------------------// -Char FP_buf[BUF_LEN]; +HChar FP_buf[BUF_LEN]; // XXX: implement f{,n}printf in m_libcprint.c eventually, and use it here. // Then change Cachegrind to use it too. @@ -2150,9 +2150,9 @@ Char FP_buf[BUF_LEN]; }) // Nb: uses a static buffer, each call trashes the last string returned. -static Char* make_perc(double x) +static HChar* make_perc(double x) { - static Char mbuf[32]; + static HChar mbuf[32]; VG_(percentify)((ULong)(x * 100), 10000, 2, 6, mbuf); // XXX: this is bogus if the denominator was zero -- resulting string is diff --git a/memcheck/mc_errors.c b/memcheck/mc_errors.c index dd8e0e4036..bbbc56b99f 100644 --- a/memcheck/mc_errors.c +++ b/memcheck/mc_errors.c @@ -270,7 +270,7 @@ void MC_(before_pp_Error) ( Error* err ) { /* Do a printf-style operation on either the XML or normal output channel, depending on the setting of VG_(clo_xml). */ -static void emit_WRK ( HChar* format, va_list vargs ) +static void emit_WRK ( const HChar* format, va_list vargs ) { if (VG_(clo_xml)) { VG_(vprintf_xml)(format, vargs); @@ -278,15 +278,15 @@ static void emit_WRK ( HChar* format, va_list vargs ) VG_(vmessage)(Vg_UserMsg, format, vargs); } } -static void emit ( HChar* format, ... ) PRINTF_CHECK(1, 2); -static void emit ( HChar* format, ... ) +static void emit ( const HChar* format, ... ) PRINTF_CHECK(1, 2); +static void emit ( const HChar* format, ... ) { va_list vargs; va_start(vargs, format); emit_WRK(format, vargs); va_end(vargs); } -static void emiN ( HChar* format, ... ) /* NO FORMAT CHECK */ +static void emiN ( const HChar* format, ... ) /* NO FORMAT CHECK */ { va_list vargs; va_start(vargs, format); @@ -433,9 +433,9 @@ static void mc_pp_origin ( ExeContext* ec, UInt okind ) } } -char * MC_(snprintf_delta) (char * buf, Int size, - SizeT current_val, SizeT old_val, - LeakCheckDeltaMode delta_mode) +HChar * MC_(snprintf_delta) (HChar * buf, Int size, + SizeT current_val, SizeT old_val, + LeakCheckDeltaMode delta_mode) { if (delta_mode == LCD_Any) buf[0] = '\0'; @@ -452,10 +452,10 @@ static void pp_LossRecord(UInt n_this_record, UInt n_total_records, { // char arrays to produce the indication of increase/decrease in case // of delta_mode != LCD_Any - char d_bytes[20]; - char d_direct_bytes[20]; - char d_indirect_bytes[20]; - char d_num_blocks[20]; + HChar d_bytes[20]; + HChar d_direct_bytes[20]; + HChar d_indirect_bytes[20]; + HChar d_num_blocks[20]; MC_(snprintf_delta) (d_bytes, 20, lr->szB + lr->indirect_szB, @@ -1559,7 +1559,7 @@ const HChar* MC_(get_error_name) ( Error* err ) } Bool MC_(get_extra_suppression_info) ( Error* err, - /*OUT*/Char* buf, Int nBuf ) + /*OUT*/HChar* buf, Int nBuf ) { ErrorKind ekind = VG_(get_error_kind )(err); tl_assert(buf); diff --git a/memcheck/mc_include.h b/memcheck/mc_include.h index 1e1ebeea2c..52ae577021 100644 --- a/memcheck/mc_include.h +++ b/memcheck/mc_include.h @@ -342,9 +342,9 @@ void MC_(who_points_at) ( Addr address, SizeT szB); // if delta_mode == LCD_Any, prints in buf an empty string // otherwise prints a delta in the layout " (+%'lu)" or " (-%'lu)" -extern char * MC_(snprintf_delta) (char * buf, Int size, - SizeT current_val, SizeT old_val, - LeakCheckDeltaMode delta_mode); +extern HChar * MC_(snprintf_delta) (HChar * buf, Int size, + SizeT current_val, SizeT old_val, + LeakCheckDeltaMode delta_mode); Bool MC_(is_valid_aligned_word) ( Addr a ); @@ -380,7 +380,7 @@ Bool MC_(read_extra_suppression_info) ( Int fd, Char** buf, Bool MC_(error_matches_suppression) ( Error* err, Supp* su ); Bool MC_(get_extra_suppression_info) ( Error* err, - /*OUT*/Char* buf, Int nBuf ); + /*OUT*/HChar* buf, Int nBuf ); const HChar* MC_(get_error_name) ( Error* err ); diff --git a/memcheck/mc_main.c b/memcheck/mc_main.c index 2d3eb95bbc..1408a7d198 100644 --- a/memcheck/mc_main.c +++ b/memcheck/mc_main.c @@ -966,7 +966,7 @@ static void gcSecVBitTable(void) secVBitTable = secVBitTable2; if (VG_(clo_verbosity) > 1) { - Char percbuf[7]; + HChar percbuf[7]; VG_(percentify)(n_survivors, n_nodes, 1, 6, percbuf); VG_(message)(Vg_DebugMsg, "memcheck GC: %d nodes, %d survivors (%s)\n", n_nodes, n_survivors, percbuf);