common/omassert.h File Reference

Various assertion macros. More...

Go to the source code of this file.

Defines

#define CompileTimeAssert(COND)
 Assert that a constant expression is non-zero.
#define Assert(COND)   (void)0
#define AssertRel(A, REL, B)   (void)0
#define AssertEq(A, B)   (void)0
#define AssertEqDouble(A, B)   (void)0
#define AssertParanoid(COND)   (void)0
#define AssertRelParanoid(A, REL, B)   (void)0
#define AssertEqParanoid(A, B)   (void)0
#define AssertEqDoubleParanoid(A, B)   (void)0
#define STATIC_ASSERT(COND)
 A "compile-time" assertion.
#define STATIC_ASSERT_UNSIGNED_TYPE(TYPE)   STATIC_ASSERT(static_cast<TYPE>(-1) > 0)
 Assert at compile-time that type TYPE is unsigned.
#define STATIC_ASSERT_TYPE_DOMINATES(T1, T2)
 Assert at compile-time that integer type T1 can hold any value which integer type T2 can.


Detailed Description

Various assertion macros.

Definition in file omassert.h.


Define Documentation

#define Assert ( COND   )     (void)0

Definition at line 132 of file omassert.h.

Referenced by Xapian::Query::abort_construction(), Xapian::Weight::Internal::accumulate_stats(), NetworkTermList::accumulate_stats(), InMemoryTermList::accumulate_stats(), FlintTermList::accumulate_stats(), ChertTermList::accumulate_stats(), BrassTermList::accumulate_stats(), Xapian::TermIterator::Internal::accumulate_stats(), FlintTable::add(), ChertTable::add(), BrassTable::add(), Xapian::QueryParser::add_boolean_prefix(), Xapian::Database::Internal::add_document(), FlintWritableDatabase::add_document_(), ChertWritableDatabase::add_document_(), BrassWritableDatabase::add_document_(), FlintTable::add_item(), ChertTable::add_item(), BrassTable::add_item(), FlintTable::add_item_to_block(), ChertTable::add_item_to_block(), BrassTable::add_item_to_block(), FlintTable::add_kt(), ChertTable::add_kt(), BrassTable::add_kt(), Xapian::QueryParser::add_prefix(), Xapian::Compactor::Internal::add_source(), Xapian::Query::Internal::add_subquery(), Xapian::Query::add_subquery(), Xapian::Query::Internal::add_subquery_nocopy(), add_to_query(), Xapian::QueryParser::add_valuerangeprocessor(), FlintTable::alter(), ChertTable::alter(), BrassTable::alter(), FlintPostlistChunkWriter::append(), Chert::PostlistChunkWriter::append(), Brass::PostlistChunkWriter::append(), NetworkPostList::append_posting(), ValueUpdater::append_to_stream(), Brass::ValueUpdater::append_to_stream(), MSetPostList::at_end(), MergePostList::at_end(), OrTermList::at_end(), NetworkTermList::at_end(), InMemoryTermList::at_end(), InMemoryAllTermsList::at_end(), StringAndFreqTermList::at_end(), ValueCountTermList::at_end(), MapTermList::at_end(), Xapian::ESet::back(), Xapian::MSet::back(), FlintTable::basic_open(), ChertTable::basic_open(), BrassTable::basic_open(), FlintTable::block_to_cursor(), ChertTable::block_to_cursor(), BrassTable::block_to_cursor(), BrassMetadataTermList::BrassMetadataTermList(), Xapian::build_termlist_tree(), FlintTable::cancel(), Xapian::Database::Internal::cancel(), ChertTable::cancel(), BrassTable::cancel(), ValueRangePostList::check(), ValueGePostList::check(), SelectPostList::check(), OrPostList::check(), ExternalPostList::check(), ChertValueList::check(), BrassValueList::check(), Xapian::ValueIterator::check(), OrTermList::check_started(), ChertMetadataTermList::ChertMetadataTermList(), Xapian::Query::Internal::collapse_subqs(), FlintTable::commit(), Xapian::Database::Internal::commit(), ChertTable::commit(), BrassTable::commit(), FlintTable::compact(), ChertTable::compact(), BrassTable::compact(), Xapian::MSet::convert_to_percent(), FlintTable::create_and_open(), ChertTable::create_and_open(), BrassTable::create_and_open(), FlintDatabase::create_and_open_tables(), ChertDatabase::create_and_open_tables(), BrassDatabase::create_and_open_tables(), Xapian::BitReader::decode(), FlintTable::del(), FlintCursor::del(), ChertTable::del(), MutableChertCursor::del(), BrassTable::del(), MutableBrassCursor::del(), Inverter::delete_doclength(), InMemoryDatabase::delete_document(), FlintWritableDatabase::delete_document(), Xapian::Database::Internal::delete_document(), ChertValueManager::delete_document(), ChertWritableDatabase::delete_document(), BrassValueManager::delete_document(), BrassWritableDatabase::delete_document(), FlintTable::delete_item(), ChertTable::delete_item(), BrassTable::delete_item(), FlintTable::delete_kt(), ChertTable::delete_kt(), BrassTable::delete_kt(), QueryOptimiser::do_and_like(), RemoteDocument::do_get_all_values(), RemoteDocument::do_get_data(), ValueStreamDocument::do_get_value(), RemoteDocument::do_get_value(), QueryOptimiser::do_or_like(), QueryOptimiser::do_subquery(), edist_state< CHR >::edist_state(), Xapian::MSet::empty(), Xapian::BitWriter::encode(), Xapian::ESet::end(), Xapian::MSet::end(), Xapian::Query::end_construction(), FlintTable::enter_key(), ChertTable::enter_key(), BrassTable::enter_key(), Xapian::ESet::Internal::expand(), ExternalPostList::ExternalPostList(), Xapian::MSet::fetch(), FlintCursor::find_entry_ge(), ChertCursor::find_entry_ge(), BrassCursor::find_entry_ge(), InMemoryDatabase::finish_add_doc(), Xapian::Query::Internal::flatten_subqs(), FlintMetadataTermList::FlintMetadataTermList(), FlintPostlistChunkWriter::flush(), Chert::PostlistChunkWriter::flush(), Brass::PostlistChunkWriter::flush(), FlintTable::flush_db(), ChertTable::flush_db(), BrassTable::flush_db(), ChertValueManager::get_all_values(), BrassValueManager::get_all_values(), AllTermsList::get_approx_size(), MapTermList::get_approx_size(), Xapian::Unicode::Internal::get_character_info(), FlintPostListTable::get_chunk(), ChertPostListTable::get_chunk(), BrassPostListTable::get_chunk(), Collapser::get_collapse_count(), MSetPostList::get_collapse_key(), MergePostList::get_collapse_key(), RemoteDatabase::get_collection_freq(), InMemoryAllTermsList::get_collection_freq(), FlintDatabase::get_collection_freq(), FlintAllTermsList::get_collection_freq(), ChertDatabase::get_collection_freq(), ChertAllTermsList::get_collection_freq(), BrassDatabase::get_collection_freq(), BrassAllTermsList::get_collection_freq(), Xapian::TermIterator::Internal::get_collection_freq(), Xapian::ESet::get_description(), Xapian::MSet::get_description(), Xapian::MSet::Internal::get_doc_by_index(), ValueRangePostList::get_docid(), OrPostList::get_docid(), MSetPostList::get_docid(), MergePostList::get_docid(), ExternalPostList::get_docid(), AndMaybePostList::get_docid(), MultiValueList::get_docid(), MultiPostList::get_docid(), InMemoryAllDocsPostList::get_docid(), InMemoryPostList::get_docid(), FlintPostList::get_docid(), FlintModifiedPostList::get_docid(), ContiguousAllDocsPostList::get_docid(), ChertValueList::get_docid(), ChertPostList::get_docid(), ChertModifiedPostList::get_docid(), BrassValueList::get_docid(), BrassPostList::get_docid(), Xapian::ValueIterator::get_docid(), EmptyPostList::get_docid(), ValueRangePostList::get_doclength(), OrPostList::get_doclength(), MultiXorPostList::get_doclength(), MultiAndPostList::get_doclength(), MergePostList::get_doclength(), ExternalPostList::get_doclength(), AndMaybePostList::get_doclength(), RemoteDatabase::get_doclength(), MultiPostList::get_doclength(), FlintPostList::get_doclength(), FlintDatabase::get_doclength(), FlintAllDocsPostList::get_doclength(), ContiguousAllDocsPostList::get_doclength(), ChertPostList::get_doclength(), ChertDatabase::get_doclength(), BrassPostList::get_doclength(), BrassDatabase::get_doclength(), Xapian::PostingIterator::get_doclength(), Xapian::Database::get_document_lazily(), FlintTable::get_exact_entry(), ChertTable::get_exact_entry(), BrassTable::get_exact_entry(), Xapian::MSet::get_firstitem(), FlintCursor::get_key(), ChertCursor::get_key(), BrassCursor::get_key(), Xapian::MSet::get_matches_estimated(), Xapian::MSet::get_matches_lower_bound(), Xapian::MSet::get_matches_upper_bound(), Xapian::MSet::get_max_attained(), Xapian::MSet::get_max_possible(), get_max_subqs(), get_min_subqs(), get_most_frequent_items(), MultiMatch::get_mset(), Xapian::Enquire::Internal::get_mset(), InMemoryPositionList::get_position(), FlintPositionList::get_position(), ChertPositionList::get_position(), BrassPositionList::get_position(), Term::get_query(), Xapian::Weight::Internal::get_reltermfreq(), Xapian::Weight::Internal::get_termfreq(), OrTermList::get_termfreq(), RemoteDatabase::get_termfreq(), NetworkTermList::get_termfreq(), InMemoryTermList::get_termfreq(), InMemoryAllTermsList::get_termfreq(), FlintSpellingWordsList::get_termfreq(), FlintDatabase::get_termfreq(), FlintAllTermsList::get_termfreq(), ChertSpellingWordsList::get_termfreq(), ChertDatabase::get_termfreq(), ChertAllTermsList::get_termfreq(), BrassSpellingWordsList::get_termfreq(), BrassDatabase::get_termfreq(), BrassAllTermsList::get_termfreq(), Xapian::TermIterator::get_termfreq(), Xapian::MSet::get_termfreq(), StringAndFreqTermList::get_termfreq(), ValueCountTermList::get_termfreq(), ExternalPostList::get_termfreq_est(), OrPostList::get_termfreq_est_using_stats(), MultiXorPostList::get_termfreq_est_using_stats(), MultiAndPostList::get_termfreq_est_using_stats(), AndNotPostList::get_termfreq_est_using_stats(), LeafPostList::get_termfreq_est_using_stats(), ExternalPostList::get_termfreq_max(), ExternalPostList::get_termfreq_min(), MultiPostList::get_termfreq_min(), VectorTermList::get_termname(), NetworkTermList::get_termname(), InMemoryTermList::get_termname(), InMemoryAllTermsList::get_termname(), FlintSynonymTermList::get_termname(), FlintSpellingWordsList::get_termname(), FlintMetadataTermList::get_termname(), FlintAllTermsList::get_termname(), ChertSynonymTermList::get_termname(), ChertSpellingWordsList::get_termname(), ChertMetadataTermList::get_termname(), ChertAllTermsList::get_termname(), BrassSynonymTermList::get_termname(), BrassSpellingWordsList::get_termname(), BrassMetadataTermList::get_termname(), BrassAllTermsList::get_termname(), StringAndFreqTermList::get_termname(), ValueCountTermList::get_termname(), MapTermList::get_termname(), Xapian::MSet::get_termweight(), Xapian::MSet::get_uncollapsed_matches_estimated(), Xapian::MSet::get_uncollapsed_matches_lower_bound(), Xapian::MSet::get_uncollapsed_matches_upper_bound(), MultiValueList::get_value(), ChertValueList::get_value(), BrassValueList::get_value(), DocumentValueList::get_value(), Xapian::ValueIterator::get_valueno(), DocumentValueList::get_valueno(), VectorTermList::get_wdf(), NetworkTermList::get_wdf(), InMemoryTermList::get_wdf(), FlintPostList::get_wdf(), FlintAllDocsPostList::get_wdf(), ContiguousAllDocsPostList::get_wdf(), ChertPostList::get_wdf(), BrassPostList::get_wdf(), Xapian::TermIterator::get_wdf(), Xapian::PostingIterator::get_wdf(), MapTermList::get_wdf(), ValueRangePostList::get_weight(), OrPostList::get_weight(), MultiXorPostList::get_weight(), MultiAndPostList::get_weight(), MSetPostList::get_weight(), MergePostList::get_weight(), ExternalPostList::get_weight(), AndMaybePostList::get_weight(), MultiPostList::get_weight(), Xapian::ValueWeightPostingSource::get_weight(), EmptyPostList::get_weight(), PerfTestLogger::indexing_log(), Xapian::Query::Internal::Internal(), FlintTable::key_exists(), ChertTable::key_exists(), BrassTable::key_exists(), FlintLock::lock(), InMemoryDatabase::make_posting(), make_start_of_chunk(), InMemoryTermEntry::merge(), InMemoryPosting::merge(), FlintSpellingTable::merge_changes(), FlintPostListTable::merge_changes(), ChertSpellingTable::merge_changes(), ChertPostListTable::merge_changes(), BrassSpellingTable::merge_changes(), BrassPostListTable::merge_changes(), BrassPostListTable::merge_doclen_changes(), ProbQuery::merge_filters(), FlintCompact::merge_postlists(), ChertCompact::merge_postlists(), BrassCompact::merge_postlists(), FlintTable::mid_point(), ChertTable::mid_point(), BrassTable::mid_point(), ChertPostList::move_forward_in_chunk_to_at_least(), BrassPostList::move_forward_in_chunk_to_at_least(), FlintPostList::move_to_chunk_containing(), ChertPostList::move_to_chunk_containing(), BrassPostList::move_to_chunk_containing(), MultiMatch::MultiMatch(), Xapian::Document::Internal::need_values(), ValueRangePostList::next(), ValueGePostList::next(), SelectPostList::next(), OrPostList::next(), MSetPostList::next(), ExternalPostList::next(), VectorTermList::next(), NetworkTermList::next(), MultiPostList::next(), InMemoryPositionList::next(), InMemoryAllDocsPostList::next(), InMemoryTermList::next(), InMemoryPostList::next(), InMemoryAllTermsList::next(), FlintTermList::next(), FlintSynonymTermList::next(), FlintSpellingWordsList::next(), FlintPositionList::next(), FlintMetadataTermList::next(), FlintCursor::next(), FlintAllTermsList::next(), FlintAllDocsPostList::next(), ContiguousAllDocsPostList::next(), ChertTermList::next(), ChertSynonymTermList::next(), ChertSpellingWordsList::next(), ChertPositionList::next(), ChertMetadataTermList::next(), ChertCursor::next(), ChertAllTermsList::next(), BrassTermList::next(), BrassSynonymTermList::next(), BrassSpellingWordsList::next(), BrassPositionList::next(), BrassMetadataTermList::next(), BrassCursor::next(), BrassAllTermsList::next(), StringAndFreqTermList::next(), ValueCountTermList::next(), MapTermList::next(), FlintTable::next_default(), ChertTable::next_default(), BrassTable::next_default(), FlintTable::next_for_sequential(), ChertTable::next_for_sequential(), BrassTable::next_for_sequential(), FlintPostList::next_in_chunk(), ChertPostList::next_in_chunk(), BrassPostList::next_in_chunk(), RemoteDatabase::open_document(), InMemoryDatabase::open_document(), FlintDatabase::open_document(), ChertDatabase::open_document(), BrassDatabase::open_document(), ValueRangePostList::open_position_list(), FlintDatabase::open_position_list(), ChertPostList::open_position_list(), ChertDatabase::open_position_list(), BrassPostList::open_position_list(), BrassDatabase::open_position_list(), InMemoryDatabase::open_post_list(), RemoteDatabase::open_term_list(), InMemoryDatabase::open_term_list(), FlintDatabase::open_term_list(), ChertDatabase::open_term_list(), BrassDatabase::open_term_list(), FlintSpellingTable::open_termlist(), ChertSpellingTable::open_termlist(), BrassSpellingTable::open_termlist(), SortPosName::operator()(), Xapian::ByQueryIndexCmp::operator()(), CJKTokenIterator::operator*(), Xapian::ValueIterator::operator*(), Xapian::TermIterator::operator*(), Xapian::PostingIterator::operator*(), Xapian::PositionIterator::operator*(), CJKTokenIterator::operator++(), Xapian::ValueIterator::operator++(), Xapian::TermIterator::operator++(), Xapian::PostingIterator::operator++(), Xapian::PositionIterator::operator++(), Xapian::ESet::operator[](), Xapian::MSet::operator[](), pack_string(), Parse(), OrTermList::positionlist_begin(), Xapian::TermIterator::positionlist_begin(), Xapian::PostingIterator::positionlist_begin(), OrTermList::positionlist_count(), Xapian::TermIterator::positionlist_count(), Xapian::Database::postlist_begin(), LocalSubMatch::postlist_from_op_leaf_query(), LocalSubMatch::prepare_match(), FlintCursor::prev(), ChertCursor::prev(), BrassCursor::prev(), FlintTable::prev_default(), ChertTable::prev_default(), BrassTable::prev_default(), FlintTable::prev_for_sequential(), ChertTable::prev_for_sequential(), BrassTable::prev_for_sequential(), FlintPostlistChunkWriter::raw_append(), Chert::PostlistChunkWriter::raw_append(), Brass::PostlistChunkWriter::raw_append(), RemoteConnection::read_at_least(), Xapian::BitReader::read_bits(), FlintTable::read_block(), ChertTable::read_block(), BrassTable::read_block(), ValueRangePostList::read_position_list(), ChertPostList::read_position_list(), BrassPostList::read_position_list(), FlintTable::read_root(), ChertTable::read_root(), BrassTable::read_root(), read_start_of_chunk(), FlintCursor::read_tag(), ChertCursor::read_tag(), BrassCursor::read_tag(), FlintAllTermsList::read_termfreq_and_collfreq(), ChertAllTermsList::read_termfreq_and_collfreq(), BrassAllTermsList::read_termfreq_and_collfreq(), ValueRangePostList::recalc_maxweight(), RemoteServer::RemoteServer(), InMemoryDatabase::replace_document(), FlintWritableDatabase::replace_document(), Xapian::Database::Internal::replace_document(), ChertWritableDatabase::replace_document(), BrassWritableDatabase::replace_document(), Xapian::SnowballStemImplementation::replace_s(), PerfTestLogger::search_end(), Xapian::Query::Internal::serialise(), serialise_document(), serialise_double(), Inverter::set_doclength(), FlintTable::set_full_compaction(), ChertTable::set_full_compaction(), BrassTable::set_full_compaction(), FlintPositionListTable::set_positionlist(), ChertPositionListTable::set_positionlist(), BrassPositionListTable::set_positionlist(), FlintTermListTable::set_termlist(), ChertTermListTable::set_termlist(), BrassTermListTable::set_termlist(), LeafPostList::set_termweight(), Xapian::Query::Internal::simplify_matchnothing(), Xapian::Query::Internal::simplify_query(), Xapian::MSet::size(), ValueRangePostList::skip_to(), ValueGePostList::skip_to(), SelectPostList::skip_to(), OrPostList::skip_to(), ExternalPostList::skip_to(), VectorTermList::skip_to(), MultiPostList::skip_to(), InMemoryAllDocsPostList::skip_to(), InMemoryPostList::skip_to(), InMemoryAllTermsList::skip_to(), FlintSynonymTermList::skip_to(), FlintSpellingWordsList::skip_to(), FlintPostList::skip_to(), FlintMetadataTermList::skip_to(), FlintAllTermsList::skip_to(), ContiguousAllDocsPostList::skip_to(), ChertSynonymTermList::skip_to(), ChertSpellingWordsList::skip_to(), ChertPostList::skip_to(), ChertMetadataTermList::skip_to(), ChertAllTermsList::skip_to(), BrassSynonymTermList::skip_to(), BrassSpellingWordsList::skip_to(), BrassPostList::skip_to(), BrassMetadataTermList::skip_to(), BrassAllTermsList::skip_to(), Xapian::ValueIterator::skip_to(), Xapian::TermIterator::skip_to(), Xapian::PostingIterator::skip_to(), Xapian::PositionIterator::skip_to(), Xapian::SnowballStemImplementation::slice_check(), Xapian::sortable_serialise(), Xapian::sortable_unserialise(), split_rset_by_db(), Xapian::Query::start_construction(), RemoteDatabase::term_exists(), InMemoryDatabase::term_exists(), FlintDatabase::term_exists(), ChertDatabase::term_exists(), BrassDatabase::term_exists(), Xapian::Database::termlist_begin(), Xapian::Document::Internal::termlist_count(), unpack_bool(), unpack_string_preserving_sort(), unpack_uint(), unpack_uint_last(), unpack_uint_preserving_sort(), Xapian::Query::Internal::unserialise(), ValueUpdater::update(), Brass::ValueUpdater::update(), ExternalPostList::update_after_advance(), FlintWritableDatabase::update_mod_plist(), ChertWritableDatabase::update_mod_plist(), Xapian::Query::Internal::validate_query(), Xapian::Document::Internal::values_count(), FlintTable::write_block(), ChertTable::write_block(), BrassTable::write_block(), FlintTable::write_changed_blocks(), ChertTable::write_changed_blocks(), BrassTable::write_changed_blocks(), write_start_of_chunk(), yy_find_reduce_action(), yy_find_shift_action(), yy_reduce(), and zeroed_new().

#define AssertEq ( A,
 )     (void)0

#define AssertEqDouble ( A,
 )     (void)0

Definition at line 135 of file omassert.h.

#define AssertEqDoubleParanoid ( A,
 )     (void)0

Definition at line 142 of file omassert.h.

Referenced by MultiMatch::getorrecalc_maxweight().

#define AssertEqParanoid ( A,
 )     (void)0

#define AssertParanoid ( COND   )     (void)0

#define AssertRel ( A,
REL,
 )     (void)0

#define AssertRelParanoid ( A,
REL,
 )     (void)0

#define CompileTimeAssert ( COND   ) 

Value:

do {\
        typedef int xapian_compile_time_check_[(COND) ? 1 : -1];\
    } while (0)
Assert that a constant expression is non-zero.

If the assertion fails, compilation fails with an error. There's no run-time overhead for a compile-time assertion, so we always enable them.

This macro must be used within a function (this is because we can only portably generate a "unique" name using __LINE__, but then if this macro is used in header files, multiple headers might be included from the same source file and have CompileTimeAssert() at the same line number.

Definition at line 40 of file omassert.h.

Referenced by FlintTable::add(), ChertTable::add(), BrassTable::add(), ChertVersion::read_and_check(), and BrassVersion::read_and_check().

#define STATIC_ASSERT ( COND   ) 

Value:

do { \
        char xapian_static_assert_failed[(COND) ? 1 : -1]; \
        (void)xapian_static_assert_failed; \
    } while (0)
A "compile-time" assertion.

STATIC_ASSERT must be used inside a function (not at the top level, or in a class definition).

COND must be a compile-time constant expression.

If COND is false, the compiler will try to compile an array with negative length, which is invalid (we don't use 0 as the length, since GCC allows zero length arrays as an extension). We name the array "xapian_static_assert_failed" since this won't clash with any sanely named variable, and it's likely to appear in the compiler error message and so indicate to the developer what went wrong.

Definition at line 159 of file omassert.h.

Referenced by DEFINE_TESTCASE(), F_unpack_uint(), F_unpack_uint_last(), pack_uint_preserving_sort(), test_static_assert1(), and unpack_uint_preserving_sort().

#define STATIC_ASSERT_TYPE_DOMINATES ( T1,
T2   ) 

Value:

STATIC_ASSERT(static_cast<T1>(-1) > 0 ? \
        (static_cast<T2>(-1) > 0 && sizeof(T1) >= sizeof(T2)) : \
        (sizeof(T1) >= sizeof(T2) + (static_cast<T2>(-1) > 0)))
Assert at compile-time that integer type T1 can hold any value which integer type T2 can.

NB Doesn't currently work reliably for type bool (which is typically incorrectly treated as equivalent to unsigned char or unsigned int).

If T1 is unsigned, T2 must be unsigned and have no more bits.

If T1 is signed, then T2 must have no more bits (if also signed) or fewer bits (if unsigned).

Definition at line 180 of file omassert.h.

Referenced by FlintRecordTable::get_doccount(), and test_static_assert1().

#define STATIC_ASSERT_UNSIGNED_TYPE ( TYPE   )     STATIC_ASSERT(static_cast<TYPE>(-1) > 0)


Documentation for Xapian (version 1.2.13).
Generated on 9 Jan 2013 by Doxygen 1.5.9.