本文整理汇总了C++中Cond::sanity_check方法的典型用法代码示例。如果您正苦于以下问题:C++ Cond::sanity_check方法的具体用法?C++ Cond::sanity_check怎么用?C++ Cond::sanity_check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cond
的用法示例。
在下文中一共展示了Cond::sanity_check方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
void Parser::IncludedFile::WalkThrough::enter_conditional_chain(CondChain *cc)
{
CListEntry *i, *j;
#if SANITY_CHECK
unsigned sum = 0;
unsigned has_else = 0;
#endif
if(method == MED_BF && on_conditional_chain_callback)
on_conditional_chain_callback(context, cc);
for(i = cc->chain.next; i != &cc->chain; i = j) {
j = i->next;
Cond *c = container_of(i, Cond, link);
#if SANITY_CHECK
sum += c->value;
has_else += (c->type == Cond::CT_ELSE);
#endif
c->sanity_check();
enter_conditional(c);
}
#if SANITY_CHECK
char emsg[256] = {0x1} ;
if(sum > 1)
snprintf(emsg, sizeof(emsg), "Has %u true conditionals", sum);
if(has_else && sum != 1)
snprintf(emsg, sizeof(emsg), "A chain with else has %u true conditionals", sum);
if(emsg[0] != '\x1')
dump_and_exit(cc, emsg);
#endif
if(method == MED_DF && on_conditional_chain_callback)
on_conditional_chain_callback(context, cc);
}