From 84a682bf1753cab467680afdff6e0afbbe0c3481 Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Mon, 18 Mar 2019 20:10:31 +0300 Subject: [PATCH] Fixed some gcc8 warnings - WiP --- builds/posix/prefix.linux | 2 +- builds/posix/prefix.linux_amd64 | 2 +- configure.ac | 2 -- src/common/IntlUtil.cpp | 6 +++--- src/common/classes/Synchronize.cpp | 6 +++--- src/include/cross/android.arm64 | 3 --- src/include/cross/android.arme | 3 --- src/include/cross/android.x86 | 3 --- src/include/cross/android.x86_64 | 3 --- src/intl/ld.cpp | 4 ++-- src/jrd/RecordSourceNodes.cpp | 8 ++++---- src/jrd/jrd.cpp | 2 +- src/jrd/tra.cpp | 5 +---- src/jrd/vio.cpp | 18 ++---------------- src/qli/proc.epp | 3 ++- src/yvalve/perf.h | 4 +--- 16 files changed, 21 insertions(+), 53 deletions(-) diff --git a/builds/posix/prefix.linux b/builds/posix/prefix.linux index e9f3f8adc4..d73e09aa04 100644 --- a/builds/posix/prefix.linux +++ b/builds/posix/prefix.linux @@ -20,7 +20,7 @@ COMMON_FLAGS=-ggdb -DFB_SEND_FLAGS=MSG_NOSIGNAL -DLINUX -pipe -MMD -fPIC -fmessage-length=0 OPTIMIZE_FLAGS=-O3 -march=i586 -mtune=i686 -fno-omit-frame-pointer -WARN_FLAGS=-Wall -Wno-switch -Wno-parentheses -Wno-unknown-pragmas -Wno-unused-variable -Wno-narrowing +WARN_FLAGS=-Wall -Wno-switch -Wno-parentheses -Wno-unknown-pragmas -Wno-unused-variable -Wno-narrowing -Wno-class-memaccess PROD_FLAGS=$(COMMON_FLAGS) $(OPTIMIZE_FLAGS) #DEV_FLAGS=-DUSE_VALGRIND -p $(COMMON_FLAGS) $(WARN_FLAGS) diff --git a/builds/posix/prefix.linux_amd64 b/builds/posix/prefix.linux_amd64 index 616d7bafcc..170b6fa350 100644 --- a/builds/posix/prefix.linux_amd64 +++ b/builds/posix/prefix.linux_amd64 @@ -20,7 +20,7 @@ COMMON_FLAGS=-ggdb -DFB_SEND_FLAGS=MSG_NOSIGNAL -DLINUX -DAMD64 -pipe -MMD -fPIC -fmessage-length=0 OPTIMIZE_FLAGS=-O3 -fno-omit-frame-pointer -WARN_FLAGS=-Wall -Wno-switch -Wno-parentheses -Wno-unknown-pragmas -Wno-unused-variable -Wno-invalid-offsetof -Wno-narrowing -Wno-unused-local-typedefs +WARN_FLAGS=-Wall -Wno-switch -Wno-parentheses -Wno-unknown-pragmas -Wno-unused-variable -Wno-invalid-offsetof -Wno-narrowing -Wno-unused-local-typedefs -Wno-class-memaccess PROD_FLAGS=$(COMMON_FLAGS) $(OPTIMIZE_FLAGS) #DEV_FLAGS=-DUSE_VALGRIND $(COMMON_FLAGS) $(WARN_FLAGS) -fmax-errors=8 diff --git a/configure.ac b/configure.ac index 25f774a3c1..00d1070344 100644 --- a/configure.ac +++ b/configure.ac @@ -751,7 +751,6 @@ AC_CHECK_HEADERS(errno.h) AC_CHECK_HEADERS(fcntl.h) AC_CHECK_HEADERS(grp.h) AC_CHECK_HEADERS(pwd.h) -AC_CHECK_HEADERS(libio.h) AC_CHECK_HEADERS(locale.h) AC_CHECK_HEADERS(math.h) AC_CHECK_HEADERS(pthread.h) @@ -794,7 +793,6 @@ AC_CHECK_HEADERS(float.h) AC_CHECK_HEADERS(poll.h) AC_CHECK_HEADERS(langinfo.h) AC_CHECK_HEADERS(iconv.h) -AC_CHECK_HEADERS(libio.h) AC_CHECK_HEADERS(linux/falloc.h) AC_CHECK_HEADERS(utime.h) diff --git a/src/common/IntlUtil.cpp b/src/common/IntlUtil.cpp index ed6d379399..8100717b4a 100644 --- a/src/common/IntlUtil.cpp +++ b/src/common/IntlUtil.cpp @@ -794,7 +794,7 @@ static USHORT unicodeStrToKey(texttype* tt, USHORT srcLen, const UCHAR* src, return impl->collation->stringToKey(utf16Len, (USHORT*)utf16Str.begin(), dstLen, dst, keyType); } - catch (BadAlloc) + catch (const BadAlloc&) { fb_assert(false); return INTL_BAD_KEY_LENGTH; @@ -859,7 +859,7 @@ static SSHORT unicodeCompare(texttype* tt, ULONG len1, const UCHAR* str1, return impl->collation->compare(utf16Len1, (USHORT*)utf16Str1.begin(), utf16Len2, (USHORT*)utf16Str2.begin(), errorFlag); } - catch (BadAlloc) + catch (const BadAlloc&) { fb_assert(false); return 0; @@ -902,7 +902,7 @@ static ULONG unicodeCanonical(texttype* tt, ULONG srcLen, const UCHAR* src, ULON utf16Len, Firebird::Aligner(utf16Str.begin(), utf16Len), dstLen, Firebird::OutAligner(dst, dstLen), NULL); } - catch (BadAlloc) + catch (const BadAlloc&) { fb_assert(false); return INTL_BAD_KEY_LENGTH; diff --git a/src/common/classes/Synchronize.cpp b/src/common/classes/Synchronize.cpp index 51f3222df4..d8ecc54499 100644 --- a/src/common/classes/Synchronize.cpp +++ b/src/common/classes/Synchronize.cpp @@ -60,7 +60,7 @@ Synchronize::Synchronize() #ifdef WIN_NT evnt = CreateEvent(NULL, false, false, NULL); #else - int ret = pthread_mutex_init(&mutex, NULL); + pthread_mutex_init(&mutex, NULL); pthread_cond_init(&condition, NULL); #endif } @@ -70,8 +70,8 @@ Synchronize::~Synchronize() #ifdef WIN_NT CloseHandle(evnt); #else - int ret = pthread_mutex_destroy(&mutex); - ret = pthread_cond_destroy(&condition); + pthread_mutex_destroy(&mutex); + pthread_cond_destroy(&condition); #endif } diff --git a/src/include/cross/android.arm64 b/src/include/cross/android.arm64 index eca28eb111..c7e0776102 100644 --- a/src/include/cross/android.arm64 +++ b/src/include/cross/android.arm64 @@ -221,9 +221,6 @@ /* Define to 1 if you have the `atomic_ops' library (-latomic_ops). */ /* #undef HAVE_LIBATOMIC_OPS */ -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIBIO_H */ - /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 diff --git a/src/include/cross/android.arme b/src/include/cross/android.arme index c4e18d3fa6..685dcda713 100644 --- a/src/include/cross/android.arme +++ b/src/include/cross/android.arme @@ -227,9 +227,6 @@ /* Define to 1 if you have the `atomic_ops' library (-latomic_ops). */ /* #undef HAVE_LIBATOMIC_OPS */ -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIBIO_H */ - /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 diff --git a/src/include/cross/android.x86 b/src/include/cross/android.x86 index 63b67f8dd4..f2bac3d616 100644 --- a/src/include/cross/android.x86 +++ b/src/include/cross/android.x86 @@ -221,9 +221,6 @@ /* Define to 1 if you have the `atomic_ops' library (-latomic_ops). */ /* #undef HAVE_LIBATOMIC_OPS */ -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIBIO_H */ - /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 diff --git a/src/include/cross/android.x86_64 b/src/include/cross/android.x86_64 index f39fb96bfc..99f1cef9f8 100644 --- a/src/include/cross/android.x86_64 +++ b/src/include/cross/android.x86_64 @@ -221,9 +221,6 @@ /* Define to 1 if you have the `atomic_ops' library (-latomic_ops). */ /* #undef HAVE_LIBATOMIC_OPS */ -/* Define to 1 if you have the header file. */ -/* #undef HAVE_LIBIO_H */ - /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 diff --git a/src/intl/ld.cpp b/src/intl/ld.cpp index cf2e90fbcd..1056921ee3 100644 --- a/src/intl/ld.cpp +++ b/src/intl/ld.cpp @@ -483,7 +483,7 @@ INTL_BOOL FB_DLL_EXPORT LD_lookup_charset(charset* cs, const ASCII* name, const return CSICU_charset_init(cs, name); } - catch (Firebird::BadAlloc) + catch (const Firebird::BadAlloc&) { fb_assert(false); return false; @@ -549,7 +549,7 @@ INTL_BOOL FB_DLL_EXPORT LD_lookup_texttype(texttype* tt, const ASCII* texttype_n tt, texttype_name, charset_name, attributes, specific_attributes, specific_attributes_length, configInfo); } - catch (Firebird::BadAlloc) + catch (const Firebird::BadAlloc&) { fb_assert(false); return false; diff --git a/src/jrd/RecordSourceNodes.cpp b/src/jrd/RecordSourceNodes.cpp index 257b9567c6..de981c8c38 100644 --- a/src/jrd/RecordSourceNodes.cpp +++ b/src/jrd/RecordSourceNodes.cpp @@ -3317,8 +3317,8 @@ bool RseNode::computable(CompilerScratch* csb, StreamType stream, if (rse_first && !rse_first->computable(csb, stream, allowOnlyCurrentStream)) return false; - if (rse_skip && !rse_skip->computable(csb, stream, allowOnlyCurrentStream)) - return false; + if (rse_skip && !rse_skip->computable(csb, stream, allowOnlyCurrentStream)) + return false; const NestConst* const end = rse_relations.end(); NestConst* ptr; @@ -3353,8 +3353,8 @@ void RseNode::findDependentFromStreams(const OptimizerRetrieval* optRet, if (rse_first) rse_first->findDependentFromStreams(optRet, streamList); - if (rse_skip) - rse_skip->findDependentFromStreams(optRet, streamList); + if (rse_skip) + rse_skip->findDependentFromStreams(optRet, streamList); if (rse_boolean) rse_boolean->findDependentFromStreams(optRet, streamList); diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index 512f4d4d42..16b993b073 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -2704,7 +2704,7 @@ JAttachment* JProvider::createDatabase(CheckStatusWrapper* user_status, const ch // try to create with overwrite = false pageSpace->file = PIO_create(tdbb, expanded_name, false, false); } - catch (status_exception) + catch (const status_exception&) { if (options.dpb_overwrite) { diff --git a/src/jrd/tra.cpp b/src/jrd/tra.cpp index 9e5ea727cf..dfc75b6243 100644 --- a/src/jrd/tra.cpp +++ b/src/jrd/tra.cpp @@ -3316,14 +3316,13 @@ static void transaction_start(thread_db* tdbb, jrd_tra* trans) // the transaction inventory page was initialized to zero, it // transaction is automatically marked active. - TraNumber oldest, number, active, oldest_active, oldest_snapshot; + TraNumber oldest, number, active, oldest_active; #ifdef SUPERSERVER_V2 number = bump_transaction_id(tdbb, &window); oldest = dbb->dbb_oldest_transaction; active = MAX(dbb->dbb_oldest_active, dbb->dbb_oldest_transaction); oldest_active = dbb->dbb_oldest_active; - oldest_snapshot = dbb->dbb_oldest_snapshot; #else // SUPERSERVER_V2 if (dbb->readOnly()) @@ -3331,7 +3330,6 @@ static void transaction_start(thread_db* tdbb, jrd_tra* trans) number = dbb->generateTransactionId(); oldest = dbb->dbb_oldest_transaction; oldest_active = dbb->dbb_oldest_active; - oldest_snapshot = dbb->dbb_oldest_snapshot; } else { @@ -3342,7 +3340,6 @@ static void transaction_start(thread_db* tdbb, jrd_tra* trans) number = Ods::getNT(header); oldest = Ods::getOIT(header); oldest_active = Ods::getOAT(header); - oldest_snapshot = Ods::getOST(header); } // oldest (OIT) > oldest_active (OAT) if OIT was advanced by sweep diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp index 22c42a39d3..a9a5a54332 100644 --- a/src/jrd/vio.cpp +++ b/src/jrd/vio.cpp @@ -719,7 +719,7 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, rpb->rpb_f_page, rpb->rpb_f_line); #endif - CommitNumber current_snapshot_number, prev_snapshot_number = 0; + CommitNumber current_snapshot_number; bool int_gc_done = (attachment->att_flags & ATT_no_cleanup); int state = TRA_snapshot_state(tdbb, transaction, rpb->rpb_transaction_nr, ¤t_snapshot_number); @@ -800,7 +800,7 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, // Worry about intermediate GC if necessary if (!int_gc_done && - (//(prev_snapshot_number && prev_snapshot_number == current_snapshot_number) || + ( ((tdbb->tdbb_flags & TDBB_sweeper) && state == tra_committed && rpb->rpb_b_page != 0 && rpb->rpb_transaction_nr >= oldest_snapshot))) { @@ -820,8 +820,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, } } - prev_snapshot_number = current_snapshot_number; - if (state == tra_committed) state = check_precommitted(transaction, rpb); @@ -887,7 +885,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, if (!DPM_get(tdbb, rpb, LCK_read)) return false; - prev_snapshot_number = 0; state = TRA_snapshot_state(tdbb, transaction, rpb->rpb_transaction_nr, ¤t_snapshot_number); continue; } @@ -940,7 +937,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, { if (!DPM_get(tdbb, rpb, LCK_read)) return false; - prev_snapshot_number = 0; break; } @@ -953,7 +949,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, if (!DPM_get(tdbb, rpb, LCK_read)) return false; - prev_snapshot_number = 0; break; } @@ -976,7 +971,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, { if (!DPM_get(tdbb, rpb, LCK_read)) return false; - prev_snapshot_number = 0; } ++backversions; @@ -989,8 +983,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, if (!DPM_get(tdbb, rpb, LCK_read)) return false; - prev_snapshot_number = 0; - } // scope break; @@ -1048,7 +1040,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, { if (!DPM_get(tdbb, rpb, LCK_read)) return false; - prev_snapshot_number = 0; } ++backversions; @@ -1073,7 +1064,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, // Things have changed, start all over again. if (!DPM_get(tdbb, rpb, LCK_read)) return false; // entire record disappeared - prev_snapshot_number = 0; break; // start from the primary version again } } @@ -1086,7 +1076,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, // Things have changed, start all over again. if (!DPM_get(tdbb, rpb, LCK_read)) return false; // entire record disappeared - prev_snapshot_number = 0; break; // start from the primary version again } @@ -1095,7 +1084,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, CCH_RELEASE(tdbb, &rpb->getWindow(tdbb)); if (!DPM_get(tdbb, rpb, LCK_read)) return false; - prev_snapshot_number = 0; break; } @@ -1115,7 +1103,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, { if (!DPM_get(tdbb, rpb, LCK_read)) return false; - prev_snapshot_number = 0; } ++backversions; @@ -1241,7 +1228,6 @@ bool VIO_chase_record_version(thread_db* tdbb, record_param* rpb, // Go back to be primary record version and chase versions all over again. if (!DPM_get(tdbb, rpb, LCK_read)) return false; - prev_snapshot_number = 0; } // switch (state) state = TRA_snapshot_state(tdbb, transaction, rpb->rpb_transaction_nr, ¤t_snapshot_number); diff --git a/src/qli/proc.epp b/src/qli/proc.epp index cd9ea59f96..908def746f 100644 --- a/src/qli/proc.epp +++ b/src/qli/proc.epp @@ -489,7 +489,8 @@ int PRO_rename_procedure( qli_dbb* database, const TEXT* old_name, const TEXT* n USHORT count = 0; FOR(REQUEST_HANDLE request) X IN DB.QLI$PROCEDURES WITH - X.QLI$PROCEDURE_NAME EQ old_name count++; + X.QLI$PROCEDURE_NAME EQ old_name + count++; MODIFY X USING isc_vtof(new_name, X.QLI$PROCEDURE_NAME, sizeof(X.QLI$PROCEDURE_NAME)); END_MODIFY diff --git a/src/yvalve/perf.h b/src/yvalve/perf.h index d40085cec9..6f9685094d 100644 --- a/src/yvalve/perf.h +++ b/src/yvalve/perf.h @@ -31,9 +31,7 @@ #ifndef JRD_PERF_H #define JRD_PERF_H -#ifdef HAVE_LIBIO_H -#include -#endif +#include #ifdef HAVE_TIMES #include