8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-02-02 09:20:39 +01:00

Fix some clang release-build warnings.

This commit is contained in:
Adriano dos Santos Fernandes 2019-08-09 23:04:41 -03:00
parent 893d0c0ef2
commit 14d41d409e
14 changed files with 45 additions and 30 deletions

View File

@ -122,12 +122,12 @@ ThreadId Thread::start(ThreadEntryPoint* routine, void* arg, int priority_arg, H
int state;
#if defined (LINUX) || defined (FREEBSD)
if (state = pthread_create(&thread, NULL, THREAD_ENTRYPOINT, THREAD_ARG))
if ((state = pthread_create(&thread, NULL, THREAD_ENTRYPOINT, THREAD_ARG)))
Firebird::system_call_failed::raise("pthread_create", state);
if (!p_handle)
{
if (state = pthread_detach(thread))
if ((state = pthread_detach(thread)))
Firebird::system_call_failed::raise("pthread_detach", state);
}
#else

View File

@ -37,7 +37,7 @@ bool BlobWrapper::open(IAttachment* db, ITransaction* trans, ISC_QUAD& blobid,
if (m_direction != dir_none)
return false;
if (bpb_len > 0 && !bpb || blobIsNull(blobid))
if ((bpb_len > 0 && !bpb) || blobIsNull(blobid))
return false;
m_blob = db->openBlob(m_status, trans, &blobid, bpb_len, bpb);

View File

@ -162,7 +162,7 @@ int NoThrowTimeStamp::yday(const struct tm* times) throw()
if (month < 2)
return day;
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
--day;
else
day -= 2;

View File

@ -48,7 +48,7 @@ bool UserBlob::open(FB_API_HANDLE& db, FB_API_HANDLE& trans, ISC_QUAD& blobid,
if (m_direction != dir_none)
return false;
if (bpb_len > 0 && !bpb || blobIsNull(blobid))
if ((bpb_len > 0 && !bpb) || blobIsNull(blobid))
return false;
if (!isc_open_blob2(m_status, &db, &trans, &m_blob, &blobid, bpb_len, bpb))

View File

@ -211,16 +211,16 @@ private:
int code;
#if defined(LINUX) && !defined(USE_VALGRIND) && defined(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP)
pthread_rwlockattr_t attr;
if (code = pthread_rwlockattr_init(&attr))
if ((code = pthread_rwlockattr_init(&attr)))
system_call_failed::raise("pthread_rwlockattr_init", code);
// Do not worry if target misses support for this option
pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP);
if (code = pthread_rwlock_init(&lock, NULL))
if ((code = pthread_rwlock_init(&lock, NULL)))
system_call_failed::raise("pthread_rwlock_init", code);
if (code = pthread_rwlockattr_destroy(&attr))
if ((code = pthread_rwlockattr_destroy(&attr)))
system_call_failed::raise("pthread_rwlockattr_destroy", code);
#else
if (code = pthread_rwlock_init(&lock, NULL))
if ((code = pthread_rwlock_init(&lock, NULL)))
system_call_failed::raise("pthread_rwlock_init", code);
#endif
}

View File

@ -3020,7 +3020,7 @@ static gpre_rse* par_select( gpre_req* request, gpre_rse* union_rse)
resolve_fields(rse_skip, select);
select->rse_sqlskip = rse_skip;
if (select->rse_into = into_list)
if ((select->rse_into = into_list))
select->rse_flags |= RSE_singleton;
if (union_rse && s_list->nod_count != union_rse->rse_fields->nod_count)
@ -3686,10 +3686,12 @@ static gpre_fld* resolve(gpre_nod* node,
if (rs_stream)
{
for (SSHORT i = 0; i < rs_stream->rse_count; i++)
if (field = resolve(node, rs_stream->rse_context[i], found_context, slice_action))
{
if ((field = resolve(node, rs_stream->rse_context[i], found_context, slice_action)))
{
return field;
}
}
return NULL;
}
@ -3819,7 +3821,7 @@ static gpre_ctx* resolve_asterisk( const tok* q_token, gpre_rse* selection)
gpre_rse* rs_stream = context->ctx_stream;
if (rs_stream)
{
if (context = resolve_asterisk(q_token, rs_stream))
if ((context = resolve_asterisk(q_token, rs_stream)))
return context;
continue;
}

View File

@ -3835,6 +3835,7 @@ static act* act_open_blob( act_t act_op, gpre_sym* symbol)
{
blob->blb_const_from_type = PAR_blob_subtype(request->req_database);
if (gpreGlob.token_global.tok_keyword == KW_CHAR)
{
if (blob->blb_const_from_type == isc_blob_text)
{
blob->blb_from_charset = par_char_set();
@ -3845,25 +3846,34 @@ static act* act_open_blob( act_t act_op, gpre_sym* symbol)
}
else
PAR_error("Only text BLOBS can specify CHARACTER SET");
}
else if (blob->blb_const_from_type == isc_blob_text)
{
if (act_op == ACT_blob_create)
blob->blb_from_charset = CS_dynamic;
else
blob->blb_from_charset = field->fld_charset_id;
}
}
else
{
blob->blb_const_from_type = field->fld_sub_type;
if (blob->blb_const_from_type == isc_blob_text)
{
if (act_op == ACT_blob_create)
blob->blb_from_charset = CS_dynamic;
else
blob->blb_from_charset = field->fld_charset_id;
}
}
if (!MSC_match(KW_TO))
CPR_s_error("TO");
blob->blb_const_to_type = PAR_blob_subtype(request->req_database);
if (gpreGlob.token_global.tok_keyword == KW_CHAR)
{
if (blob->blb_const_to_type == isc_blob_text)
{
blob->blb_to_charset = par_char_set();
@ -3874,11 +3884,14 @@ static act* act_open_blob( act_t act_op, gpre_sym* symbol)
}
else
PAR_error("Only text BLOBS can specify CHARACTER SET");
}
else if (blob->blb_const_to_type == isc_blob_text)
{
if (act_op == ACT_blob_create)
blob->blb_to_charset = field->fld_charset_id;
else
blob->blb_to_charset = CS_dynamic;
}
}
else
{
@ -4037,7 +4050,7 @@ static act* act_procedure()
do {
ref* reference = (ref*) SQE_variable(request, false, NULL, NULL);
*ref_ptr = reference;
if (reference->ref_field = field)
if ((reference->ref_field = field))
field = field->fld_next;
ref_ptr = &reference->ref_next;
outputs++;

View File

@ -649,8 +649,8 @@ private:
inline bool Attachment::locksmith(thread_db* tdbb, SystemPrivilege sp) const
{
return att_user && att_user->locksmith(tdbb, sp) ||
att_ss_user && att_ss_user->locksmith(tdbb, sp);
return (att_user && att_user->locksmith(tdbb, sp)) ||
(att_ss_user && att_ss_user->locksmith(tdbb, sp));
}
inline jrd_tra* Attachment::getSysTransaction()

View File

@ -730,7 +730,7 @@ void BTR_evaluate(thread_db* tdbb, const IndexRetrieval* retrieval, RecordBitmap
node.readNode(pointer, true);
if ((lower.key_length == node.prefix + node.length) ||
(lower.key_length <= node.prefix + node.length) && partLower)
((lower.key_length <= node.prefix + node.length) && partLower))
{
const UCHAR* p = node.data, *q = lower.key_data + node.prefix;
const UCHAR* const end = lower.key_data + lower.key_length;
@ -3106,8 +3106,8 @@ static contents delete_node(thread_db* tdbb, WIN* window, UCHAR* pointer)
newJumpNode.length = 0;
}
if (newJumpNode.prefix + newJumpNode.length != newPrefix ||
jumpPrev && (newJumpNode.prefix > jumpPrev->prefix + jumpPrev->length))
if ((newJumpNode.prefix + newJumpNode.length != newPrefix) ||
(jumpPrev && (newJumpNode.prefix > jumpPrev->prefix + jumpPrev->length)))
{
UCHAR* prevPtr = page->btr_jump_size + page->btr_nodes;
if (jumpPrev)

View File

@ -1130,8 +1130,8 @@ void CCH_flush(thread_db* tdbb, USHORT flush_flag, TraNumber tra_number)
const Jrd::Attachment* att = tdbb->getAttachment();
const bool dontFlush = (dbb->dbb_flags & DBB_creating) ||
(dbb->dbb_ast_flags & DBB_shutdown_single) &&
att && (att->att_flags & (ATT_creator | ATT_system));
((dbb->dbb_ast_flags & DBB_shutdown_single) &&
att && (att->att_flags & (ATT_creator | ATT_system)));
if (!(main_file->fil_flags & FIL_force_write) && (max_num || max_time) && !dontFlush)
{

View File

@ -42,7 +42,7 @@
ISC_STATUS __isc_error_code; \
if (!Config::getBugcheckAbort()) \
{ \
if (sig = sigsetjmp(sigenv, 1)) \
if ((sig = sigsetjmp(sigenv, 1))) \
ISC_exception_post(sig, err, __isc_error_code); \
Firebird::syncSignalsSet(&sigenv); \
}

View File

@ -1996,7 +1996,7 @@ static bool select_multi(rem_port* main_port, UCHAR* buffer, SSHORT bufsize, SSH
SOCLOSE(main_port->port_handle);
}
}
else if (port = select_accept(main_port))
else if ((port = select_accept(main_port)))
{
if (!REMOTE_inflate(port, packet_receive, buffer, bufsize, length))
{

View File

@ -664,7 +664,7 @@ ISC_STATUS API_ROUTINE isc_embed_dsql_release(ISC_STATUS* user_status, const SCH
// and remove this statement from the local list
dsql_stmt* p;
for (dsql_stmt** stmt_ptr = &statements; p = *stmt_ptr; stmt_ptr = &p->stmt_next)
for (dsql_stmt** stmt_ptr = &statements; (p = *stmt_ptr); stmt_ptr = &p->stmt_next)
{
if (p == statement)
{
@ -1002,7 +1002,7 @@ static void cleanup_database(FB_API_HANDLE* db_handle, void* /*dummy*/)
dsql_stmt** stmt_ptr = &statements;
dsql_stmt* p;
while (p = *stmt_ptr)
while ((p = *stmt_ptr))
{
if (p->stmt_db_handle == *db_handle)
{
@ -1023,7 +1023,7 @@ static void cleanup_database(FB_API_HANDLE* db_handle, void* /*dummy*/)
dsql_dbb* dbb;
for (dsql_dbb** dbb_ptr = &databases; dbb = *dbb_ptr; dbb_ptr = &dbb->dbb_next)
for (dsql_dbb** dbb_ptr = &databases; (dbb = *dbb_ptr); dbb_ptr = &dbb->dbb_next)
{
if (dbb->dbb_handle == *db_handle)
{
@ -1171,7 +1171,7 @@ static dsql_name* insert_name(const TEXT* symbol_name, dsql_name** list_ptr, dsq
name->name_length = l;
memcpy(name->name_symbol, symbol_name, l);
if (name->name_next = *list_ptr)
if ((name->name_next = *list_ptr))
name->name_next->name_prev = name;
*list_ptr = name;
name->name_prev = NULL;

View File

@ -1447,7 +1447,7 @@ void API_ROUTINE_VARARG isc_expand_dpb(SCHAR** dpb, SSHORT* dpb_size, ...)
va_start(args, dpb_size);
while (type = va_arg(args, int))
while ((type = va_arg(args, int)))
{
switch (type)
{
@ -1518,7 +1518,7 @@ void API_ROUTINE_VARARG isc_expand_dpb(SCHAR** dpb, SSHORT* dpb_size, ...)
va_start(args, dpb_size);
while (type = va_arg(args, int))
while ((type = va_arg(args, int)))
{
switch (type)
{
@ -2975,7 +2975,7 @@ static void isc_expand_dpb_internal(const UCHAR** dpb, SSHORT* dpb_size, ...)
va_start(args, dpb_size);
while (type = va_arg(args, int))
while ((type = va_arg(args, int)))
{
switch (type)
{
@ -3044,7 +3044,7 @@ static void isc_expand_dpb_internal(const UCHAR** dpb, SSHORT* dpb_size, ...)
va_start(args, dpb_size);
while (type = va_arg(args, int))
while ((type = va_arg(args, int)))
{
switch (type)
{