@@ -53,53 +53,53 @@ typedef SINT64 LOCK_DATA_T;
5353
5454// Maximum lock series for gathering statistics and querying data
5555
56- const int LCK_MAX_SERIES = 7 ;
56+ inline constexpr int LCK_MAX_SERIES = 7 ;
5757
5858// Lock query data aggregates
5959
60- const int LCK_MIN = 1 ;
61- const int LCK_MAX = 2 ;
62- const int LCK_CNT = 3 ;
63- const int LCK_SUM = 4 ;
64- const int LCK_AVG = 5 ;
65- const int LCK_ANY = 6 ;
60+ inline constexpr int LCK_MIN = 1 ;
61+ inline constexpr int LCK_MAX = 2 ;
62+ inline constexpr int LCK_CNT = 3 ;
63+ inline constexpr int LCK_SUM = 4 ;
64+ inline constexpr int LCK_AVG = 5 ;
65+ inline constexpr int LCK_ANY = 6 ;
6666
6767// Lock states
6868// in LCK_convert the type of level is USHORT instead of UCHAR
69- const UCHAR LCK_none = 0 ;
70- const UCHAR LCK_null = 1 ;
71- const UCHAR LCK_SR = 2 ; // Shared Read
72- const UCHAR LCK_PR = 3 ; // Protected Read
73- const UCHAR LCK_SW = 4 ; // Shared Write
74- const UCHAR LCK_PW = 5 ; // Protected Write
75- const UCHAR LCK_EX = 6 ; // Exclusive
76- const UCHAR LCK_max = 7 ;
69+ inline constexpr UCHAR LCK_none = 0 ;
70+ inline constexpr UCHAR LCK_null = 1 ;
71+ inline constexpr UCHAR LCK_SR = 2 ; // Shared Read
72+ inline constexpr UCHAR LCK_PR = 3 ; // Protected Read
73+ inline constexpr UCHAR LCK_SW = 4 ; // Shared Write
74+ inline constexpr UCHAR LCK_PW = 5 ; // Protected Write
75+ inline constexpr UCHAR LCK_EX = 6 ; // Exclusive
76+ inline constexpr UCHAR LCK_max = 7 ;
7777
7878enum locklevel_t {LCK_read = LCK_PR, LCK_write = LCK_EX};
7979
80- const SSHORT LCK_WAIT = 1 ;
81- const SSHORT LCK_NO_WAIT = 0 ;
80+ inline constexpr SSHORT LCK_WAIT = 1 ;
81+ inline constexpr SSHORT LCK_NO_WAIT = 0 ;
8282
8383// Lock block types
8484
85- const UCHAR type_null = 0 ;
86- const UCHAR type_lhb = 1 ;
87- const UCHAR type_lrq = 2 ;
88- const UCHAR type_lbl = 3 ;
89- const UCHAR type_his = 4 ;
90- const UCHAR type_shb = 5 ;
91- const UCHAR type_own = 6 ;
92- const UCHAR type_lpr = 7 ;
85+ inline constexpr UCHAR type_null = 0 ;
86+ inline constexpr UCHAR type_lhb = 1 ;
87+ inline constexpr UCHAR type_lrq = 2 ;
88+ inline constexpr UCHAR type_lbl = 3 ;
89+ inline constexpr UCHAR type_his = 4 ;
90+ inline constexpr UCHAR type_shb = 5 ;
91+ inline constexpr UCHAR type_own = 6 ;
92+ inline constexpr UCHAR type_lpr = 7 ;
9393
9494// Version number of the lock table.
9595// Must be increased every time the shmem layout is changed.
96- const USHORT BASE_LHB_VERSION = 19 ;
97- const USHORT PLATFORM_LHB_VERSION = 128 ; // 64-bit target
96+ inline constexpr USHORT BASE_LHB_VERSION = 19 ;
97+ inline constexpr USHORT PLATFORM_LHB_VERSION = 128 ; // 64-bit target
9898
9999#if SIZEOF_VOID_P == 8
100- const USHORT LHB_VERSION = PLATFORM_LHB_VERSION | BASE_LHB_VERSION;
100+ inline constexpr USHORT LHB_VERSION = PLATFORM_LHB_VERSION | BASE_LHB_VERSION;
101101#else
102- const USHORT LHB_VERSION = BASE_LHB_VERSION;
102+ inline constexpr USHORT LHB_VERSION = BASE_LHB_VERSION;
103103#endif
104104
105105
@@ -197,15 +197,15 @@ struct lrq
197197};
198198
199199// lrq_flags
200- const USHORT LRQ_blocking = 1 ; // Request is blocking
201- const USHORT LRQ_pending = 2 ; // Request is pending
202- const USHORT LRQ_rejected = 4 ; // Request is rejected
203- const USHORT LRQ_deadlock = 8 ; // Request has been seen by the deadlock-walk
204- const USHORT LRQ_repost = 16 ; // Request block used for repost
205- const USHORT LRQ_scanned = 32 ; // Request already scanned for deadlock
206- const USHORT LRQ_blocking_seen = 64 ; // Blocking notification received by owner
207- const USHORT LRQ_just_granted = 128 ; // Request is just granted and blocked owners still have not sent blocking AST
208- const USHORT LRQ_wait_timeout = 256 ; // Request is being waited on with a timeout
200+ inline constexpr USHORT LRQ_blocking = 1 ; // Request is blocking
201+ inline constexpr USHORT LRQ_pending = 2 ; // Request is pending
202+ inline constexpr USHORT LRQ_rejected = 4 ; // Request is rejected
203+ inline constexpr USHORT LRQ_deadlock = 8 ; // Request has been seen by the deadlock-walk
204+ inline constexpr USHORT LRQ_repost = 16 ; // Request block used for repost
205+ inline constexpr USHORT LRQ_scanned = 32 ; // Request already scanned for deadlock
206+ inline constexpr USHORT LRQ_blocking_seen = 64 ; // Blocking notification received by owner
207+ inline constexpr USHORT LRQ_just_granted = 128 ; // Request is just granted and blocked owners still have not sent blocking AST
208+ inline constexpr USHORT LRQ_wait_timeout = 256 ; // Request is being waited on with a timeout
209209
210210// Process block
211211
@@ -242,9 +242,9 @@ struct own
242242};
243243
244244// Flags in own_flags
245- const USHORT OWN_scanned = 1 ; // Owner has been deadlock scanned
246- const USHORT OWN_wakeup = 2 ; // Owner has been awoken
247- const USHORT OWN_signaled = 4 ; // Signal is thought to be delivered
245+ inline constexpr USHORT OWN_scanned = 1 ; // Owner has been deadlock scanned
246+ inline constexpr USHORT OWN_wakeup = 2 ; // Owner has been awoken
247+ inline constexpr USHORT OWN_signaled = 4 ; // Signal is thought to be delivered
248248
249249// Lock manager history block
250250
@@ -260,26 +260,26 @@ struct his
260260
261261// his_operation definitions
262262// should be UCHAR according to his_operation but is USHORT in lock.cpp:post_operation
263- const UCHAR his_enq = 1 ;
264- const UCHAR his_deq = 2 ;
265- const UCHAR his_convert = 3 ;
266- const UCHAR his_signal = 4 ;
267- const UCHAR his_post_ast = 5 ;
268- const UCHAR his_wait = 6 ;
269- const UCHAR his_del_process = 7 ;
270- const UCHAR his_del_lock = 8 ;
271- const UCHAR his_del_request = 9 ;
272- const UCHAR his_deny = 10 ;
273- const UCHAR his_grant = 11 ;
274- const UCHAR his_leave_ast = 12 ;
275- const UCHAR his_scan = 13 ;
276- const UCHAR his_dead = 14 ;
277- const UCHAR his_enter = 15 ;
278- const UCHAR his_bug = 16 ;
279- const UCHAR his_active = 17 ;
280- const UCHAR his_cleanup = 18 ;
281- const UCHAR his_del_owner = 19 ;
282- const UCHAR his_MAX = his_del_owner;
263+ inline constexpr UCHAR his_enq = 1 ;
264+ inline constexpr UCHAR his_deq = 2 ;
265+ inline constexpr UCHAR his_convert = 3 ;
266+ inline constexpr UCHAR his_signal = 4 ;
267+ inline constexpr UCHAR his_post_ast = 5 ;
268+ inline constexpr UCHAR his_wait = 6 ;
269+ inline constexpr UCHAR his_del_process = 7 ;
270+ inline constexpr UCHAR his_del_lock = 8 ;
271+ inline constexpr UCHAR his_del_request = 9 ;
272+ inline constexpr UCHAR his_deny = 10 ;
273+ inline constexpr UCHAR his_grant = 11 ;
274+ inline constexpr UCHAR his_leave_ast = 12 ;
275+ inline constexpr UCHAR his_scan = 13 ;
276+ inline constexpr UCHAR his_dead = 14 ;
277+ inline constexpr UCHAR his_enter = 15 ;
278+ inline constexpr UCHAR his_bug = 16 ;
279+ inline constexpr UCHAR his_active = 17 ;
280+ inline constexpr UCHAR his_cleanup = 18 ;
281+ inline constexpr UCHAR his_del_owner = 19 ;
282+ inline constexpr UCHAR his_MAX = his_del_owner;
283283
284284namespace Firebird {
285285 class AtomicCounter ;
0 commit comments