Skip to content

Commit 308b3d0

Browse files
committed
Fix -Wswitch warning in SyncObject
+ constexpr, and use [[maybe_unused]] instead of (void)
1 parent e3431d3 commit 308b3d0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/common/classes/SyncObject.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838

3939
namespace Firebird {
4040

41-
static const int WRITER_INCR = 0x00010000L;
42-
static const int READERS_MASK = 0x0000FFFFL;
41+
static constexpr int WRITER_INCR = 0x00010000L;
42+
static constexpr int READERS_MASK = 0x0000FFFFL;
4343

4444
bool SyncObject::lock(Sync* sync, SyncType type, const char* from, int timeOut)
4545
{
@@ -282,7 +282,7 @@ bool SyncObject::wait(SyncType type, ThreadSync* thread, Sync* sync, int timeOut
282282
thread->lockPending = sync;
283283
mutex.leave();
284284

285-
bool wakeup = false;
285+
[[maybe_unused]] bool wakeup = false;
286286
while (timeOut && !thread->lockGranted)
287287
{
288288
const int wait = timeOut > 10000 ? 10000 : timeOut;
@@ -296,7 +296,6 @@ bool SyncObject::wait(SyncType type, ThreadSync* thread, Sync* sync, int timeOut
296296
if (thread->lockGranted)
297297
return true;
298298

299-
(void) wakeup;
300299
//if (!wakeup)
301300
// stalled(thread);
302301

@@ -424,6 +423,9 @@ void SyncObject::validate(SyncType lockType) const
424423
case SYNC_EXCLUSIVE:
425424
fb_assert(lockState == -1);
426425
break;
426+
case SYNC_INVALID:
427+
// ignore
428+
break;
427429
}
428430
}
429431

0 commit comments

Comments
 (0)