coregrind files shall use vg_assert not tl_assert.
Tool files shall use tl_assert not vg_assert.
Fix code accordingly.
Adapted check_headers_and_includes to make sure the code
stays clean in that respect.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14542 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_addrinfo.c b/coregrind/m_addrinfo.c
index 49c8c5d..21fd413 100644
--- a/coregrind/m_addrinfo.c
+++ b/coregrind/m_addrinfo.c
@@ -474,7 +474,7 @@
);
if (ai->Addr.Block.block_kind==Block_Mallocd) {
VG_(pp_ExeContext)(ai->Addr.Block.allocated_at);
- tl_assert (ai->Addr.Block.freed_at == VG_(null_ExeContext)());
+ vg_assert (ai->Addr.Block.freed_at == VG_(null_ExeContext)());
}
else if (ai->Addr.Block.block_kind==Block_Freed) {
VG_(pp_ExeContext)(ai->Addr.Block.freed_at);
@@ -491,14 +491,14 @@
|| ai->Addr.Block.block_kind==Block_UserG) {
// client-defined
VG_(pp_ExeContext)(ai->Addr.Block.allocated_at);
- tl_assert (ai->Addr.Block.freed_at == VG_(null_ExeContext)());
+ vg_assert (ai->Addr.Block.freed_at == VG_(null_ExeContext)());
/* Nb: cannot have a freed_at, as a freed client-defined block
has a Block_Freed block_kind. */
} else {
// Client or Valgrind arena. At least currently, we never
// have stacktraces for these.
- tl_assert (ai->Addr.Block.allocated_at == VG_(null_ExeContext)());
- tl_assert (ai->Addr.Block.freed_at == VG_(null_ExeContext)());
+ vg_assert (ai->Addr.Block.allocated_at == VG_(null_ExeContext)());
+ vg_assert (ai->Addr.Block.freed_at == VG_(null_ExeContext)());
}
if (ai->Addr.Block.alloc_tinfo.tnr || ai->Addr.Block.alloc_tinfo.tid)
VG_(emit)(
diff --git a/coregrind/m_debuginfo/d3basics.c b/coregrind/m_debuginfo/d3basics.c
index f3d442e..0d882ed 100644
--- a/coregrind/m_debuginfo/d3basics.c
+++ b/coregrind/m_debuginfo/d3basics.c
@@ -1111,7 +1111,7 @@
VG_(printf)(" ML_(evaluate_trivial_GX): unhandled:\n ");
ML_(pp_GX)( gx );
VG_(printf)("\n");
- tl_assert(0);
+ vg_assert(0);
}
else
if (!badness)
@@ -1124,10 +1124,10 @@
res.kind = GXR_Failure;
- tl_assert(nGuards == VG_(sizeXA)( results ));
- tl_assert(nGuards >= 0);
+ vg_assert(nGuards == VG_(sizeXA)( results ));
+ vg_assert(nGuards >= 0);
if (nGuards == 0) {
- tl_assert(!badness);
+ vg_assert(!badness);
res.word = (UWord)"trivial GExpr has no guards (!)";
VG_(deleteXA)( results );
return res;
@@ -1151,11 +1151,11 @@
/* All the subexpressions produced a constant, but did they all produce
the same one? */
mul = VG_(indexXA)( results, 0 );
- tl_assert(mul->b == True); /* we just established that all exprs are ok */
+ vg_assert(mul->b == True); /* we just established that all exprs are ok */
for (i = 1; i < nGuards; i++) {
mul2 = VG_(indexXA)( results, i );
- tl_assert(mul2->b == True);
+ vg_assert(mul2->b == True);
if (mul2->ul != mul->ul) {
res.word = (UWord)"trivial GExpr: subexpressions disagree";
VG_(deleteXA)( results );
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
index ab11a5a..33e16d6 100644
--- a/coregrind/m_debuginfo/debuginfo.c
+++ b/coregrind/m_debuginfo/debuginfo.c
@@ -663,7 +663,7 @@
VG_(redir_notify_new_DebugInfo)( di );
/* Note that we succeeded */
di->have_dinfo = True;
- tl_assert(di->handle > 0);
+ vg_assert(di->handle > 0);
di_handle = di->handle;
} else {
@@ -2014,7 +2014,7 @@
}
for (i = 0; i < si->symtab_used; i++) {
HChar* pri_name = si->symtab[i].pri_name;
- tl_assert(pri_name);
+ vg_assert(pri_name);
if (0==VG_(strcmp)(name, pri_name)
&& (require_pToc ? GET_TOCPTR_AVMA(si->symtab[i].avmas) : True)) {
*avmas = si->symtab[i].avmas;
@@ -2022,7 +2022,7 @@
}
HChar** sec_names = si->symtab[i].sec_names;
if (sec_names) {
- tl_assert(sec_names[0]);
+ vg_assert(sec_names[0]);
while (*sec_names) {
if (0==VG_(strcmp)(name, *sec_names)
&& (require_pToc
@@ -3756,8 +3756,8 @@
GXResult res;
UWord sp_delta = res_sp_7k.word - res_sp_6k.word;
UWord fp_delta = res_fp_7k.word - res_fp_6k.word;
- tl_assert(sp_delta == 0 || sp_delta == 1024);
- tl_assert(fp_delta == 0 || fp_delta == 1024);
+ vg_assert(sp_delta == 0 || sp_delta == 1024);
+ vg_assert(fp_delta == 0 || fp_delta == 1024);
if (sp_delta == 0 && fp_delta == 0) {
/* depends neither on sp nor fp, so it can't be a stack
@@ -3768,7 +3768,7 @@
regs.sp = regs.fp = 0;
regs.ip = ip;
res = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di );
- tl_assert(res.kind == GXR_Addr);
+ vg_assert(res.kind == GXR_Addr);
if (debug)
VG_(printf)(" %5ld .. %5ld (sp) %s\n",
res.word, res.word + ((UWord)mul.ul) - 1, var->name);
@@ -3787,7 +3787,7 @@
regs.sp = regs.fp = 0;
regs.ip = ip;
res = ML_(evaluate_GX)( var->gexpr, var->fbGX, ®s, di );
- tl_assert(res.kind == GXR_Addr);
+ vg_assert(res.kind == GXR_Addr);
if (debug)
VG_(printf)(" %5ld .. %5ld (FP) %s\n",
res.word, res.word + ((UWord)mul.ul) - 1, var->name);
@@ -3939,7 +3939,7 @@
/* The first thing to do is find the DebugInfo that
pertains to 'di_handle'. */
- tl_assert(di_handle > 0);
+ vg_assert(di_handle > 0);
for (di = debugInfo_list; di; di = di->next) {
if (di->handle == di_handle)
break;
@@ -3948,7 +3948,7 @@
/* If this fails, we were unable to find any DebugInfo with the
given handle. This is considered an error on the part of the
caller. */
- tl_assert(di != NULL);
+ vg_assert(di != NULL);
/* we'll put the collected variables in here. */
gvars = VG_(newXA)( ML_(dinfo_zalloc), "di.debuginfo.dggbfd.1",
@@ -3968,13 +3968,13 @@
DiAddrRange* range;
OSet* /* of DiAddrInfo */ scope
= *(OSet**)VG_(indexXA)( di->varinfo, scopeIx );
- tl_assert(scope);
+ vg_assert(scope);
VG_(OSetGen_ResetIter)(scope);
while ( (range = VG_(OSetGen_Next)(scope)) ) {
/* Iterate over each variable in the current address range */
Word nVars, varIx;
- tl_assert(range->vars);
+ vg_assert(range->vars);
nVars = VG_(sizeXA)( range->vars );
for (varIx = 0; varIx < nVars; varIx++) {
@@ -3984,7 +3984,7 @@
GlobalBlock gb;
TyEnt* ty;
DiVariable* var = VG_(indexXA)( range->vars, varIx );
- tl_assert(var->name);
+ vg_assert(var->name);
if (0) VG_(printf)("at depth %ld var %s ", scopeIx, var->name );
/* Now figure out if this variable has a constant address
@@ -4031,8 +4031,8 @@
if (arrays_only && !isVec) continue;
/* Ok, so collect it! */
- tl_assert(var->name);
- tl_assert(di->soname);
+ vg_assert(var->name);
+ vg_assert(di->soname);
if (0) VG_(printf)("XXXX %s %s %d\n", var->name,
ML_(fndn_ix2filename)(di, var->fndn_ix),
var->lineNo);
@@ -4042,8 +4042,8 @@
gb.isVec = isVec;
VG_(strncpy)(&gb.name[0], var->name, sizeof(gb.name)-1);
VG_(strncpy)(&gb.soname[0], di->soname, sizeof(gb.soname)-1);
- tl_assert(gb.name[ sizeof(gb.name)-1 ] == 0);
- tl_assert(gb.soname[ sizeof(gb.soname)-1 ] == 0);
+ vg_assert(gb.name[ sizeof(gb.name)-1 ] == 0);
+ vg_assert(gb.soname[ sizeof(gb.soname)-1 ] == 0);
VG_(addToXA)( gvars, &gb );
diff --git a/coregrind/m_debuginfo/misc.c b/coregrind/m_debuginfo/misc.c
index d4825a4..430d435 100644
--- a/coregrind/m_debuginfo/misc.c
+++ b/coregrind/m_debuginfo/misc.c
@@ -65,7 +65,7 @@
void* ML_(dinfo_memdup) ( const HChar* cc, void* str, SizeT nStr ) {
void* dst = VG_(arena_malloc)( VG_AR_DINFO, cc, nStr );
- tl_assert(dst);
+ vg_assert(dst);
VG_(memcpy)(dst, str, nStr);
return dst;
}
diff --git a/coregrind/m_debuginfo/readdwarf3.c b/coregrind/m_debuginfo/readdwarf3.c
index afc7b8b..995ef58 100644
--- a/coregrind/m_debuginfo/readdwarf3.c
+++ b/coregrind/m_debuginfo/readdwarf3.c
@@ -777,7 +777,7 @@
static Word cmp__XArrays_of_AddrRange ( XArray* rngs1, XArray* rngs2 )
{
Word n1, n2, i;
- tl_assert(rngs1 && rngs2);
+ vg_assert(rngs1 && rngs2);
n1 = VG_(sizeXA)( rngs1 );
n2 = VG_(sizeXA)( rngs2 );
if (n1 < n2) return -1;
@@ -2388,8 +2388,8 @@
UWord keyW, valW;
if (VG_(lookupFM)( rangestree, &keyW, &valW, (UWord)xa )) {
XArray* old = (XArray*)keyW;
- tl_assert(valW == 0);
- tl_assert(old != xa);
+ vg_assert(valW == 0);
+ vg_assert(old != xa);
tv->rngMany = old;
} else {
XArray* cloned = VG_(cloneXA)( "di.readdwarf3.pvD.2", xa );
diff --git a/coregrind/m_debuginfo/storage.c b/coregrind/m_debuginfo/storage.c
index efa04f3..3d8a13f 100644
--- a/coregrind/m_debuginfo/storage.c
+++ b/coregrind/m_debuginfo/storage.c
@@ -1161,7 +1161,7 @@
MaybeULong mul;
const HChar* badness;
- tl_assert(di && di->admin_tyents);
+ vg_assert(di && di->admin_tyents);
if (0) {
VG_(printf)(" ML_(addVar): level %d %#lx-%#lx %s :: ",
@@ -1186,7 +1186,7 @@
vg_assert(gexpr);
ent = ML_(TyEnts__index_by_cuOff)( di->admin_tyents, NULL, typeR);
- tl_assert(ent);
+ vg_assert(ent);
vg_assert(ML_(TyEnt__is_type)(ent));
/* "Comment_Regarding_Text_Range_Checks" (is referred to elsewhere)
diff --git a/coregrind/m_debuginfo/tytypes.c b/coregrind/m_debuginfo/tytypes.c
index d80876c..aece0a5 100644
--- a/coregrind/m_debuginfo/tytypes.c
+++ b/coregrind/m_debuginfo/tytypes.c
@@ -849,7 +849,7 @@
offset -= offMin;
ty = ML_(TyEnts__index_by_cuOff)(tyents, NULL,
field->Te.Field.typeR );
- tl_assert(ty);
+ vg_assert(ty);
if (ty->tag == Te_UNKNOWN) goto done;
/* keep going; look inside the field. */
break;
@@ -899,7 +899,7 @@
case Te_TyQual: {
ty = ML_(TyEnts__index_by_cuOff)(tyents, NULL,
ty->Te.TyQual.typeR);
- tl_assert(ty);
+ vg_assert(ty);
if (ty->tag == Te_UNKNOWN) goto done;
break;
}
@@ -907,7 +907,7 @@
case Te_TyTyDef: {
ty = ML_(TyEnts__index_by_cuOff)(tyents, NULL,
ty->Te.TyTyDef.typeR);
- tl_assert(ty);
+ vg_assert(ty);
if (ty->tag == Te_UNKNOWN) goto done;
break;
}
diff --git a/coregrind/m_errormgr.c b/coregrind/m_errormgr.c
index 02bf0e4..ae04087 100644
--- a/coregrind/m_errormgr.c
+++ b/coregrind/m_errormgr.c
@@ -404,7 +404,7 @@
// Print stack trace elements
UInt n_ips = VG_(get_ExeContext_n_ips)(ec);
- tl_assert(n_ips > 0);
+ vg_assert(n_ips > 0);
if (n_ips > VG_MAX_SUPP_CALLERS)
n_ips = VG_MAX_SUPP_CALLERS;
VG_(apply_StackTrace)(printSuppForIp_nonXML,
@@ -647,7 +647,7 @@
/* DO NOT MAKE unique_counter NON-STATIC */
static UInt unique_counter = 0;
- tl_assert(tid < VG_N_THREADS);
+ vg_assert(tid < VG_N_THREADS);
/* Core-only parts */
err->unique = unique_counter++;
diff --git a/coregrind/m_execontext.c b/coregrind/m_execontext.c
index 8747bdb..2901fd9 100644
--- a/coregrind/m_execontext.c
+++ b/coregrind/m_execontext.c
@@ -211,7 +211,7 @@
return False;
// Must be at least one address in each trace.
- tl_assert(e1->n_ips >= 1 && e2->n_ips >= 1);
+ vg_assert(e1->n_ips >= 1 && e2->n_ips >= 1);
switch (res) {
case Vg_LowRes:
@@ -362,7 +362,7 @@
static UInt ctr = 0;
- tl_assert(n_ips >= 1 && n_ips <= VG_(clo_backtrace_size));
+ vg_assert(n_ips >= 1 && n_ips <= VG_(clo_backtrace_size));
/* Now figure out if we've seen this one before. First hash it so
as to determine the list number. */
diff --git a/coregrind/m_gdbserver/server.c b/coregrind/m_gdbserver/server.c
index 072bd68..7f2e5c9 100644
--- a/coregrind/m_gdbserver/server.c
+++ b/coregrind/m_gdbserver/server.c
@@ -216,7 +216,7 @@
case -2: int_value = 0; break;
case -1: int_value = 0; break;
case 0: int_value = 1; break;
- default: tl_assert (0);
+ default: vg_assert (0);
}
}
@@ -321,7 +321,7 @@
case 1:
hostvisibility = False;
break;
- default: tl_assert (0);
+ default: vg_assert (0);
}
} else {
hostvisibility = True;
@@ -390,7 +390,7 @@
case 0:
VG_(am_show_nsegments) (0, "gdbserver v.info memory aspacemgr");
break;
- default: tl_assert (0);
+ default: vg_assert (0);
}
}
@@ -518,7 +518,7 @@
VG_(clo_sanity_level) = save_clo_sanity_level;
break;
}
- default: tl_assert (0);
+ default: vg_assert (0);
}
break;
diff --git a/coregrind/m_libcprint.c b/coregrind/m_libcprint.c
index 46b488a..8d30b00 100644
--- a/coregrind/m_libcprint.c
+++ b/coregrind/m_libcprint.c
@@ -108,7 +108,7 @@
}
b->buf[b->buf_used++] = c;
b->buf[b->buf_used] = 0;
- tl_assert(b->buf_used < sizeof(b->buf));
+ vg_assert(b->buf_used < sizeof(b->buf));
}
static UInt vprintf_to_buf ( printf_buf_t* b,
diff --git a/coregrind/m_machine.c b/coregrind/m_machine.c
index 42d8ce8..212673f 100644
--- a/coregrind/m_machine.c
+++ b/coregrind/m_machine.c
@@ -152,7 +152,7 @@
case 1: src = (void*)(((Addr)&(tst->arch.vex_shadow1)) + offset); break;
case 2: src = (void*)(((Addr)&(tst->arch.vex_shadow2)) + offset); break;
}
- tl_assert(src != NULL);
+ vg_assert(src != NULL);
VG_(memcpy)( dst, src, size);
}
@@ -176,7 +176,7 @@
case 1: dst = (void*)(((Addr)&(tst->arch.vex_shadow1)) + offset); break;
case 2: dst = (void*)(((Addr)&(tst->arch.vex_shadow2)) + offset); break;
}
- tl_assert(dst != NULL);
+ vg_assert(dst != NULL);
VG_(memcpy)( dst, src, size);
}
diff --git a/coregrind/m_main.c b/coregrind/m_main.c
index 131ac4f..9663474 100644
--- a/coregrind/m_main.c
+++ b/coregrind/m_main.c
@@ -2112,7 +2112,7 @@
//--------------------------------------------------------------
VG_(debugLog)(1, "main", "Load initial debug info\n");
- tl_assert(!addr2dihandle);
+ vg_assert(!addr2dihandle);
addr2dihandle = VG_(newXA)( VG_(malloc), "main.vm.2",
VG_(free), sizeof(Addr_n_ULong) );
@@ -2219,12 +2219,12 @@
{ Addr* seg_starts;
Int n_seg_starts;
- tl_assert(addr2dihandle);
+ vg_assert(addr2dihandle);
/* Mark the main thread as running while we tell the tool about
the client memory so that the tool can associate that memory
with the main thread. */
- tl_assert(VG_(running_tid) == VG_INVALID_THREADID);
+ vg_assert(VG_(running_tid) == VG_INVALID_THREADID);
VG_(running_tid) = tid_main;
seg_starts = VG_(get_segment_starts)( &n_seg_starts );
@@ -2271,7 +2271,7 @@
for (j = 0; j < n; j++) {
Addr_n_ULong* anl = VG_(indexXA)( addr2dihandle, j );
if (anl->a == seg->start) {
- tl_assert(anl->ull > 0); /* check it's a valid handle */
+ vg_assert(anl->ull > 0); /* check it's a valid handle */
break;
}
}
@@ -2327,7 +2327,7 @@
/* Clear the running thread indicator */
VG_(running_tid) = VG_INVALID_THREADID;
- tl_assert(VG_(running_tid) == VG_INVALID_THREADID);
+ vg_assert(VG_(running_tid) == VG_INVALID_THREADID);
/* Darwin only: tell the tools where the client's kernel commpage
is. It would be better to do this by telling aspacemgr about
diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c
index c05cc0c..a6a6705 100644
--- a/coregrind/m_mallocfree.c
+++ b/coregrind/m_mallocfree.c
@@ -1427,13 +1427,13 @@
if (!blockSane(a, b)) {
VG_(printf)("sanity_check_malloc_arena: sb %p, block %ld "
"(bszB %lu): BAD\n", sb, i, b_bszB );
- tl_assert(0);
+ vg_assert(0);
}
thisFree = !is_inuse_block(b);
if (thisFree && lastWasFree) {
VG_(printf)("sanity_check_malloc_arena: sb %p, block %ld "
"(bszB %lu): UNMERGED FREES\n", sb, i, b_bszB );
- tl_assert(0);
+ vg_assert(0);
}
lastWasFree = thisFree;
@@ -1448,35 +1448,35 @@
(Int)(!thisFree),
(Int)bszB_to_pszB(a, b_bszB),
get_cc(b));
- tl_assert(cc);
+ vg_assert(cc);
for (k = 0; k < n_ccs; k++) {
- tl_assert(anCCs[k].cc);
+ vg_assert(anCCs[k].cc);
if (0 == VG_(strcmp)(cc, anCCs[k].cc))
break;
}
- tl_assert(k >= 0 && k <= n_ccs);
+ vg_assert(k >= 0 && k <= n_ccs);
if (k == n_ccs) {
- tl_assert(n_ccs < N_AN_CCS-1);
+ vg_assert(n_ccs < N_AN_CCS-1);
n_ccs++;
anCCs[k].nBytes = 0;
anCCs[k].nBlocks = 0;
anCCs[k].cc = cc;
}
- tl_assert(k >= 0 && k < n_ccs && k < N_AN_CCS);
+ vg_assert(k >= 0 && k < n_ccs && k < N_AN_CCS);
anCCs[k].nBytes += (ULong)bszB_to_pszB(a, b_bszB);
anCCs[k].nBlocks++;
}
if (i > sb->n_payload_bytes) {
VG_(printf)( "sanity_check_malloc_arena: sb %p: last block "
"overshoots end\n", sb);
- tl_assert(0);
+ vg_assert(0);
}
}
if (a->stats__perm_bytes_on_loan > 0) {
- tl_assert(n_ccs < N_AN_CCS-1);
+ vg_assert(n_ccs < N_AN_CCS-1);
anCCs[n_ccs].nBytes = a->stats__perm_bytes_on_loan;
anCCs[n_ccs].nBlocks = a->stats__perm_blocks;
anCCs[n_ccs].cc = "perm_malloc";
diff --git a/coregrind/m_options.c b/coregrind/m_options.c
index b188554..0710c8d 100644
--- a/coregrind/m_options.c
+++ b/coregrind/m_options.c
@@ -147,7 +147,7 @@
HChar* out;
Bool ok = VG_(get_startup_wd)(base_dir, VKI_PATH_MAX);
- tl_assert(ok);
+ vg_assert(ok);
if (VG_STREQ(format, "")) {
// Empty name, bad.
diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c
index 9aee707..5aec0b3 100644
--- a/coregrind/m_redir.c
+++ b/coregrind/m_redir.c
@@ -354,8 +354,8 @@
arr[i++] = pri_name;
pp = sec_names;
while (*pp) { arr[i++] = *pp; pp++; }
- tl_assert(i == n_req);
- tl_assert(arr[n_req] == NULL);
+ vg_assert(i == n_req);
+ vg_assert(arr[n_req] == NULL);
return arr;
}
@@ -1508,13 +1508,13 @@
void* p;
vg_assert(n > 0);
p = VG_(arena_malloc)(VG_AR_DINFO, ec, n);
- tl_assert(p);
+ vg_assert(p);
VG_(memset)(p, 0, n);
return p;
}
static void dinfo_free(void* p) {
- tl_assert(p);
+ vg_assert(p);
return VG_(arena_free)(VG_AR_DINFO, p);
}
diff --git a/coregrind/m_translate.c b/coregrind/m_translate.c
index 0b3d964..32e026c 100644
--- a/coregrind/m_translate.c
+++ b/coregrind/m_translate.c
@@ -344,7 +344,7 @@
\
addStmtToIRSB( bb, IRStmt_Dirty(dcall) ); \
\
- tl_assert(syze > 0); \
+ vg_assert(syze > 0); \
update_SP_aliases(syze); \
\
n_SP_updates_fast++; \
@@ -374,7 +374,7 @@
\
addStmtToIRSB( bb, IRStmt_Dirty(dcall) ); \
\
- tl_assert(syze > 0); \
+ vg_assert(syze > 0); \
update_SP_aliases(-(syze)); \
\
n_SP_updates_fast++; \
@@ -1564,7 +1564,7 @@
# endif
/* ------ Actually do the translation. ------ */
- tl_assert2(VG_(tdict).tool_instrument,
+ vg_assert2(VG_(tdict).tool_instrument,
"you forgot to set VgToolInterface function 'tool_instrument'");
/* Get the CPU info established at startup. */
diff --git a/coregrind/m_wordfm.c b/coregrind/m_wordfm.c
index 2038245..0685c7f 100644
--- a/coregrind/m_wordfm.c
+++ b/coregrind/m_wordfm.c
@@ -130,7 +130,7 @@
root->child[1]->balance = 0;
break;
default:
- tl_assert(0);
+ vg_assert(0);
}
root->balance=0;
}
@@ -190,7 +190,7 @@
case 1: return False;
case 0: return True;
case -1: break;
- default: tl_assert(0);
+ default: vg_assert(0);
}
if ((*rootp)->child[0]->balance < 0) {
avl_swr( rootp );
@@ -211,7 +211,7 @@
return False;
return True;
}
- tl_assert(0);/*NOTREACHED*/
+ vg_assert(0);/*NOTREACHED*/
}
else
if (cmpres < 0) {
@@ -223,7 +223,7 @@
case -1: return False;
case 0: return True;
case 1: break;
- default: tl_assert(0);
+ default: vg_assert(0);
}
if ((*rootp)->child[1]->balance > 0) {
avl_swl( rootp );
@@ -244,7 +244,7 @@
return False;
return True;
}
- tl_assert(0);/*NOTREACHED*/
+ vg_assert(0);/*NOTREACHED*/
}
else {
/* cmpres == 0, a duplicate - replace the val, but don't
@@ -273,7 +273,7 @@
if (cmpres > 0){
/* remove from the left subtree */
AvlNode* left_subtree = (*rootp)->child[0];
- tl_assert(left_subtree);
+ vg_assert(left_subtree);
ch = avl_remove_wrk(&left_subtree, a, kCmp);
(*rootp)->child[0]=left_subtree;
if (ch) {
@@ -281,7 +281,7 @@
case -1: return True;
case 0: return False;
case 1: break;
- default: tl_assert(0);
+ default: vg_assert(0);
}
switch ((*rootp)->child[1]->balance) {
case 0:
@@ -297,7 +297,7 @@
case -1:
break;
default:
- tl_assert(0);
+ vg_assert(0);
}
avl_swr( &((*rootp)->child[1]) );
avl_swl( rootp );
@@ -309,7 +309,7 @@
if (cmpres < 0) {
/* remove from the right subtree */
AvlNode* right_subtree = (*rootp)->child[1];
- tl_assert(right_subtree);
+ vg_assert(right_subtree);
ch = avl_remove_wrk(&right_subtree, a, kCmp);
(*rootp)->child[1] = right_subtree;
if (ch) {
@@ -317,7 +317,7 @@
case 1: return True;
case 0: return False;
case -1: break;
- default: tl_assert(0);
+ default: vg_assert(0);
}
switch ((*rootp)->child[0]->balance) {
case 0:
@@ -333,7 +333,7 @@
case 1:
break;
default:
- tl_assert(0);
+ vg_assert(0);
}
avl_swl( &((*rootp)->child[0]) );
avl_swr( rootp );
@@ -342,8 +342,8 @@
}
}
else {
- tl_assert(cmpres == 0);
- tl_assert((*rootp)==a);
+ vg_assert(cmpres == 0);
+ vg_assert((*rootp)==a);
return avl_removeroot_wrk(rootp, kCmp);
}
return 0;
@@ -462,7 +462,7 @@
static void stackClear(WordFM* fm)
{
Int i;
- tl_assert(fm);
+ vg_assert(fm);
for (i = 0; i < WFM_STKMAX; i++) {
fm->nodeStack[i] = NULL;
fm->numStack[i] = 0;
@@ -473,8 +473,8 @@
// Push onto the iterator stack.
static inline void stackPush(WordFM* fm, AvlNode* n, Int i)
{
- tl_assert(fm->stackTop < WFM_STKMAX);
- tl_assert(1 <= i && i <= 3);
+ vg_assert(fm->stackTop < WFM_STKMAX);
+ vg_assert(1 <= i && i <= 3);
fm->nodeStack[fm->stackTop] = n;
fm-> numStack[fm->stackTop] = i;
fm->stackTop++;
@@ -483,13 +483,13 @@
// Pop from the iterator stack.
static inline Bool stackPop(WordFM* fm, AvlNode** n, Int* i)
{
- tl_assert(fm->stackTop <= WFM_STKMAX);
+ vg_assert(fm->stackTop <= WFM_STKMAX);
if (fm->stackTop > 0) {
fm->stackTop--;
*n = fm->nodeStack[fm->stackTop];
*i = fm-> numStack[fm->stackTop];
- tl_assert(1 <= *i && *i <= 3);
+ vg_assert(1 <= *i && *i <= 3);
fm->nodeStack[fm->stackTop] = NULL;
fm-> numStack[fm->stackTop] = 0;
return True;
@@ -692,7 +692,7 @@
// set up FM for iteration
void VG_(initIterFM) ( WordFM* fm )
{
- tl_assert(fm);
+ vg_assert(fm);
stackClear(fm);
if (fm->root)
stackPush(fm, fm->root, 1);
@@ -709,7 +709,7 @@
Word cmpresS; /* signed */
UWord cmpresU; /* unsigned */
- tl_assert(fm);
+ vg_assert(fm);
stackClear(fm);
if (!fm->root)
@@ -744,20 +744,20 @@
if (stackPop(fm, &n, &i)) {
// If we've pushed something to stack and did not find the exact key,
// we must fix the top element of stack.
- tl_assert(i == 2);
+ vg_assert(i == 2);
stackPush(fm, n, 3);
// the stack looks like {2, 2, ..., 2, 3}
}
}
-// get next key/val pair. Will tl_assert if fm has been modified
+// get next key/val pair. Will vg_assert if fm has been modified
// or looked up in since initIter{,At}FM was called.
Bool VG_(nextIterFM) ( WordFM* fm, /*OUT*/UWord* pKey, /*OUT*/UWord* pVal )
{
Int i = 0;
AvlNode* n = NULL;
- tl_assert(fm);
+ vg_assert(fm);
// This in-order traversal requires each node to be pushed and popped
// three times. These could be avoided by updating nodes in-situ on the
@@ -780,7 +780,7 @@
if (n->child[1]) { n = n->child[1]; goto case_1; }
break;
default:
- tl_assert(0);
+ vg_assert(0);
}
}
@@ -798,7 +798,7 @@
WordFM* nyu;
/* can't clone the fm whilst iterating on it */
- tl_assert(fm->stackTop == 0);
+ vg_assert(fm->stackTop == 0);
nyu = fm->alloc_nofail( fm->cc, sizeof(WordFM) );
@@ -854,8 +854,8 @@
{
UWord key, count;
if (VG_(lookupFM)(bag->fm, &key, &count, w)) {
- tl_assert(key == w);
- tl_assert(count >= 1);
+ vg_assert(key == w);
+ vg_assert(count >= 1);
VG_(addToFM)(bag->fm, w, count+1);
} else {
VG_(addToFM)(bag->fm, w, 1);
@@ -866,8 +866,8 @@
{
UWord key, count;
if (VG_(lookupFM)( bag->fm, &key, &count, w)) {
- tl_assert(key == w);
- tl_assert(count >= 1);
+ vg_assert(key == w);
+ vg_assert(count >= 1);
return count;
} else {
return 0;
@@ -883,7 +883,7 @@
{
/* unchecked pre: nd is non-NULL */
UWord w = nd->val;
- tl_assert(w >= 1);
+ vg_assert(w >= 1);
if (nd->child[0])
w += sizeTotalBag_wrk(nd->child[0]);
if (nd->child[1])
@@ -902,12 +902,12 @@
{
UWord key, count;
if (VG_(lookupFM)(bag->fm, &key, &count, w)) {
- tl_assert(key == w);
- tl_assert(count >= 1);
+ vg_assert(key == w);
+ vg_assert(count >= 1);
if (count > 1) {
VG_(addToFM)(bag->fm, w, count-1);
} else {
- tl_assert(count == 1);
+ vg_assert(count == 1);
VG_(delFromFM)( bag->fm, NULL, NULL, w );
}
return True;
@@ -927,9 +927,9 @@
if (VG_(sizeFM)(bag->fm) != 1)
return False;
nd = bag->fm->root;
- tl_assert(nd);
- tl_assert(!nd->child[0]);
- tl_assert(!nd->child[1]);
+ vg_assert(nd);
+ vg_assert(!nd->child[0]);
+ vg_assert(!nd->child[1]);
return nd->val == 1;
}
@@ -938,8 +938,8 @@
/* Return an arbitrarily chosen element in the bag. We might as
well return the one at the root of the underlying AVL tree. */
AvlNode* nd = bag->fm->root;
- tl_assert(nd); /* if this fails, 'bag' is empty - caller is in error. */
- tl_assert(nd->val >= 1);
+ vg_assert(nd); /* if this fails, 'bag' is empty - caller is in error. */
+ vg_assert(nd->val >= 1);
return nd->key;
}
diff --git a/coregrind/pub_core_tooliface.h b/coregrind/pub_core_tooliface.h
index 5c12903..e9d3631 100644
--- a/coregrind/pub_core_tooliface.h
+++ b/coregrind/pub_core_tooliface.h
@@ -43,7 +43,7 @@
// statement. This lets us say "x = VG_TDICT_CALL(...)" in the required
// places, while still checking the assertion.
#define VG_TDICT_CALL(fn, args...) \
- ( tl_assert2(VG_(tdict).fn, \
+ ( vg_assert2(VG_(tdict).fn, \
"you forgot to set VgToolInterface function '" #fn "'"), \
VG_(tdict).fn(args) )
diff --git a/tests/check_headers_and_includes b/tests/check_headers_and_includes
index f234320..0215d49 100755
--- a/tests/check_headers_and_includes
+++ b/tests/check_headers_and_includes
@@ -10,6 +10,8 @@
# (4) tool *.[ch] files must not include pub_core_...h
# (5) include pub_core/tool_clreq.h instead of valgrind.h except in tools'
# export headers
+# (6) coregrind/ *.[ch] must not use tl_assert
+# (7) include/*.h must not use vg_assert
#-------------------------------------------------------------------
use strict;
@@ -205,6 +207,7 @@
#---------------------------------------------------------------------
sub check_coregrind_export_header {
my ($path_name) = @_;
+ my $file = basename($path_name);
foreach my $inc (get_included_files($path_name)) {
$inc = basename($inc);
@@ -217,6 +220,11 @@
error("File $path_name should include pub_tool_clreq.h instead of $inc\n");
}
}
+# Must not use vg_assert
+ my $assert = `grep vg_assert $file`;
+ if ($assert ne "") {
+ error("File $path_name must not use vg_assert\n");
+ }
}
#---------------------------------------------------------------------
@@ -241,6 +249,11 @@
error("File $path_name should include pub_core_clreq.h instead of $inc\n");
}
}
+# Must not use tl_assert
+ my $assert = `grep tl_assert $file`;
+ if ($assert ne "") {
+ error("File $path_name must not use tl_assert\n");
+ }
}
#---------------------------------------------------------------------
@@ -261,6 +274,11 @@
error("File $path_name should include pub_tool_clreq.h instead of $inc\n");
}
}
+# Must not use vg_assert
+ my $assert = `grep vg_assert $file`;
+ if ($assert ne "") {
+ error("File $path_name must not use vg_assert\n");
+ }
}
sub process_file {