From: <asf...@us...> - 2011-02-26 16:03:42
|
Revision: 52474 http://firebird.svn.sourceforge.net/firebird/?rev=52474&view=rev Author: asfernandes Date: 2011-02-26 16:03:36 +0000 (Sat, 26 Feb 2011) Log Message: ----------- Fix definition and usages of fb_assert. Modified Paths: -------------- firebird/trunk/src/alice/alice.h firebird/trunk/src/common/cvt.cpp firebird/trunk/src/common/gdsassert.h firebird/trunk/src/dsql/BoolNodes.cpp firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/jrd/btr.cpp firebird/trunk/src/jrd/cch.cpp firebird/trunk/src/jrd/fun.epp firebird/trunk/src/jrd/lck.cpp firebird/trunk/src/jrd/pag.cpp firebird/trunk/src/qli/eval.cpp firebird/trunk/src/qli/lex.cpp Modified: firebird/trunk/src/alice/alice.h =================================================================== --- firebird/trunk/src/alice/alice.h 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/alice/alice.h 2011-02-26 16:03:36 UTC (rev 52474) @@ -180,7 +180,7 @@ static inline AliceGlobals* getSpecific() { ThreadData* tData = ThreadData::getSpecific(); - fb_assert (tData->getType() == ThreadData::tddALICE) + fb_assert(tData->getType() == ThreadData::tddALICE); return (AliceGlobals*) tData; } static inline void putSpecific(AliceGlobals* tdgbl) Modified: firebird/trunk/src/common/cvt.cpp =================================================================== --- firebird/trunk/src/common/cvt.cpp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/common/cvt.cpp 2011-02-26 16:03:36 UTC (rev 52474) @@ -1562,7 +1562,7 @@ // multibyte character sets which use a zero // byte to represent end-of-string - fb_assert(to->dsc_length > 0) + fb_assert(to->dsc_length > 0); length = MIN(length, ULONG(to->dsc_length - 1)); cb->validateData(toCharset, length, q); toLength = length; Modified: firebird/trunk/src/common/gdsassert.h =================================================================== --- firebird/trunk/src/common/gdsassert.h 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/common/gdsassert.h 2011-02-26 16:03:36 UTC (rev 52474) @@ -38,10 +38,30 @@ #define FB_ASSERT_FAILURE_STRING "Assertion (%s) failure: %s %"LINEFORMAT"\n" #if !defined(fb_assert) -#define fb_assert_continue(ex) {if (!(ex)) {if (isatty(2)) fprintf(stderr, FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__);\ - else gds__log(FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__);}} -#define fb_assert(ex) {if (!(ex)) {if (isatty(2)) fprintf(stderr, FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__);\ - else gds__log(FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__); abort();}} +#define fb_assert_continue(ex) \ + do \ + { \ + if (!(ex)) \ + { \ + if (isatty(2)) \ + fprintf(stderr, FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__); \ + else \ + gds__log(FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__); \ + } \ + } while (false) + +#define fb_assert(ex) \ + do \ + { \ + if (!(ex)) \ + { \ + if (isatty(2)) \ + fprintf(stderr, FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__); \ + else \ + gds__log(FB_ASSERT_FAILURE_STRING, #ex, __FILE__, __LINE__); \ + abort(); \ + } \ + } while (false) #endif #else // DEV_BUILD Modified: firebird/trunk/src/dsql/BoolNodes.cpp =================================================================== --- firebird/trunk/src/dsql/BoolNodes.cpp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/dsql/BoolNodes.cpp 2011-02-26 16:03:36 UTC (rev 52474) @@ -171,7 +171,7 @@ return false; const BinaryBoolNode* o = other->as<BinaryBoolNode>(); - fb_assert(o) + fb_assert(o); return blrOp == o->blrOp; } @@ -563,7 +563,7 @@ return false; const ComparativeBoolNode* o = other->as<ComparativeBoolNode>(); - fb_assert(o) + fb_assert(o); return dsqlFlag == o->dsqlFlag && blrOp == o->blrOp; } Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2011-02-26 16:03:36 UTC (rev 52474) @@ -1429,7 +1429,7 @@ return false; const ArithmeticNode* o = other->as<ArithmeticNode>(); - fb_assert(o) + fb_assert(o); return dialect1 == o->dialect1 && blrOp == o->blrOp; } @@ -2724,7 +2724,7 @@ return false; const CastNode* o = other->as<CastNode>(); - fb_assert(o) + fb_assert(o); return dsqlField == o->dsqlField; } @@ -4355,7 +4355,7 @@ return false; const ExtractNode* o = other->as<ExtractNode>(); - fb_assert(o) + fb_assert(o); return blrSubOp == o->blrSubOp; } @@ -4919,7 +4919,7 @@ return false; const FieldNode* o = other->as<FieldNode>(); - fb_assert(o) + fb_assert(o); if (dsqlField != o->dsqlField || dsqlContext != o->dsqlContext) return false; @@ -5387,7 +5387,7 @@ return false; const GenIdNode* o = other->as<GenIdNode>(); - fb_assert(o) + fb_assert(o); return dialect1 == o->dialect1 && name == o->name; } @@ -6007,7 +6007,7 @@ return false; const LiteralNode* o = other->as<LiteralNode>(); - fb_assert(o) + fb_assert(o); if (litDesc.dsc_dtype != o->litDesc.dsc_dtype || litDesc.dsc_length != o->litDesc.dsc_length || litDesc.dsc_scale != o->litDesc.dsc_scale) @@ -7594,7 +7594,7 @@ return false; const RecordKeyNode* o = other->as<RecordKeyNode>(); - fb_assert(o) + fb_assert(o); return blrOp == o->blrOp; } @@ -8089,7 +8089,7 @@ return false; const StrCaseNode* o = other->as<StrCaseNode>(); - fb_assert(o) + fb_assert(o); return blrOp == o->blrOp; } @@ -8292,7 +8292,7 @@ return false; const StrLenNode* o = other->as<StrLenNode>(); - fb_assert(o) + fb_assert(o); return blrSubOp == o->blrSubOp; } @@ -9807,7 +9807,7 @@ return false; const TrimNode* o = other->as<TrimNode>(); - fb_assert(o) + fb_assert(o); return where == o->where; } Modified: firebird/trunk/src/jrd/btr.cpp =================================================================== --- firebird/trunk/src/jrd/btr.cpp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/jrd/btr.cpp 2011-02-26 16:03:36 UTC (rev 52474) @@ -1548,7 +1548,7 @@ fb_assert(idx != NULL); fb_assert(key != NULL); - fb_assert(tdbb->getDatabase()->dbb_ods_version >= ODS_VERSION12) + fb_assert(tdbb->getDatabase()->dbb_ods_version >= ODS_VERSION12); key->key_flags = key_all_nulls; Modified: firebird/trunk/src/jrd/cch.cpp =================================================================== --- firebird/trunk/src/jrd/cch.cpp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/jrd/cch.cpp 2011-02-26 16:03:36 UTC (rev 52474) @@ -2084,7 +2084,7 @@ window->win_bdb = NULL; - fb_assert(bdb->bdb_use_count ? true : !(bdb->bdb_flags & BDB_marked)) + fb_assert(bdb->bdb_use_count ? true : !(bdb->bdb_flags & BDB_marked)); } @@ -3740,7 +3740,7 @@ bdb->bdb_page = page; - fb_assert((bdb->bdb_flags & (BDB_dirty | BDB_marked)) == 0) + fb_assert((bdb->bdb_flags & (BDB_dirty | BDB_marked)) == 0); bdb->bdb_flags = BDB_read_pending; bdb->bdb_scan_count = 0; Modified: firebird/trunk/src/jrd/fun.epp =================================================================== --- firebird/trunk/src/jrd/fun.epp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/jrd/fun.epp 2011-02-26 16:03:36 UTC (rev 52474) @@ -841,7 +841,7 @@ blb* blob = BLB_get_array(tdbb, tdbb->getRequest()->req_transaction, (bid*)value->dsc_address, array_desc); - fb_assert (array_desc->iad_total_length >= 0) // check before upcasting to size_t + fb_assert(array_desc->iad_total_length >= 0); // check before upcasting to size_t UCHAR* data = FB_NEW(*getDefaultMemoryPool()) UCHAR[static_cast<size_t>(array_desc->iad_total_length)]; BLB_get_data(tdbb, blob, data, array_desc->iad_total_length); const USHORT dimensions = array_desc->iad_dimensions; Modified: firebird/trunk/src/jrd/lck.cpp =================================================================== --- firebird/trunk/src/jrd/lck.cpp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/jrd/lck.cpp 2011-02-26 16:03:36 UTC (rev 52474) @@ -1286,7 +1286,7 @@ Arg::StatusVector statusVector; internal_downgrade(tdbb, statusVector, match); - fb_assert(statusVector.isEmpty()) + fb_assert(statusVector.isEmpty()); } Modified: firebird/trunk/src/jrd/pag.cpp =================================================================== --- firebird/trunk/src/jrd/pag.cpp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/jrd/pag.cpp 2011-02-26 16:03:36 UTC (rev 52474) @@ -2047,7 +2047,7 @@ * extend file(s) * **************************************/ - fb_assert(dbb == tdbb->getDatabase()) + fb_assert(dbb == tdbb->getDatabase()); const int MAX_EXTEND_BYTES = dbb->dbb_config->getDatabaseGrowthIncrement(); Modified: firebird/trunk/src/qli/eval.cpp =================================================================== --- firebird/trunk/src/qli/eval.cpp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/qli/eval.cpp 2011-02-26 16:03:36 UTC (rev 52474) @@ -623,7 +623,7 @@ TEXT* p = avary->vary_string; length1 = MIN(length1, desc->dsc_length - 2); length2 = MAX(MIN(length2, desc->dsc_length - 2 - length1), 0); - fb_assert(static_cast<ULONG>(length1) + length2 <= MAX_USHORT - 2) + fb_assert(static_cast<ULONG>(length1) + length2 <= MAX_USHORT - 2); if (length1) { Modified: firebird/trunk/src/qli/lex.cpp =================================================================== --- firebird/trunk/src/qli/lex.cpp 2011-02-26 16:02:37 UTC (rev 52473) +++ firebird/trunk/src/qli/lex.cpp 2011-02-26 16:03:36 UTC (rev 52474) @@ -1138,7 +1138,7 @@ **************************************/ // CVC: Too naive implementation: what if the pointer is at the beginning? - fb_assert(QLI_line) + fb_assert(QLI_line); --QLI_line->line_ptr; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |