@@ -131,7 +131,7 @@ static char* fb_prefix_msg = NULL;
131131#define FB_IMPL_MSG (facility, number, symbol, sqlCode, sqlClass, sqlSubClass, text ) \
132132 {ENCODE_ISC_MSG (number, FB_IMPL_MSG_FACILITY_##facility), text},
133133
134- static const struct {
134+ static constexpr struct {
135135 SLONG code_number;
136136 const SCHAR *code_text;
137137} messages[] = {
@@ -150,7 +150,7 @@ static const struct {
150150#define FB_IMPL_MSG (facility, number, symbol, sqlCode, sqlClass, sqlSubClass, text ) \
151151 {ENCODE_ISC_MSG (number, FB_IMPL_MSG_FACILITY_##facility), sqlClass sqlSubClass},
152152
153- static const struct {
153+ static constexpr struct {
154154 SLONG gds_code;
155155 const char * sql_state;
156156} sql_states[] = {
@@ -169,7 +169,7 @@ static const struct {
169169#define FB_IMPL_MSG (facility, number, symbol, sqlCode, sqlClass, sqlSubClass, text ) \
170170 {ENCODE_ISC_MSG (number, FB_IMPL_MSG_FACILITY_##facility), sqlCode},
171171
172- static const struct {
172+ static constexpr struct {
173173 SLONG gds_code;
174174 SSHORT sql_code;
175175} sql_codes[] = {
@@ -181,7 +181,7 @@ static const struct {
181181#undef FB_IMPL_MSG_SYMBOL
182182#undef FB_IMPL_MSG
183183
184- const SLONG GENERIC_SQLCODE = -999 ;
184+ constexpr SLONG GENERIC_SQLCODE = -999 ;
185185
186186#include " fb_types.h"
187187#include " ../common/utils_proto.h"
@@ -244,7 +244,7 @@ static void sanitize(Firebird::string& locale);
244244// New functions that try to be safe.
245245static SLONG safe_interpret (char * const s, const FB_SIZE_T bufsize,
246246 const ISC_STATUS** const vector, bool legacy = false );
247- static void safe_strncpy (char * target, const char * source, size_t bs);
247+ static void safe_strncpy (char * target, const char * source, size_t bs) noexcept ;
248248
249249// Useful only in Windows. The hardcoded definition for the English-only version
250250// is too crude.
@@ -293,42 +293,42 @@ static SLONG gds_pid = 0;
293293
294294// BLR Pretty print stuff
295295
296- const int op_line = 1 ;
297- const int op_verb = 2 ;
298- const int op_byte = 3 ;
299- const int op_word = 4 ;
300- const int op_pad = 5 ;
301- const int op_dtype = 6 ;
302- const int op_message = 7 ;
303- const int op_literal = 8 ;
304- const int op_begin = 9 ;
305- const int op_map = 10 ;
306- const int op_args = 11 ;
307- const int op_union = 12 ;
308- const int op_indent = 13 ;
309- const int op_join = 14 ;
310- const int op_parameters = 15 ;
311- const int op_error_handler = 16 ;
312- const int op_set_error = 17 ;
313- const int op_literals = 18 ;
314- const int op_exec_into = 21 ;
315- const int op_cursor_stmt = 22 ;
316- const int op_byte_opt_verb = 23 ;
317- const int op_exec_stmt = 24 ;
318- const int op_derived_expr = 25 ;
319- const int op_partition_args = 26 ;
320- const int op_subproc_decl = 27 ;
321- const int op_subfunc_decl = 28 ;
322- const int op_window_win = 29 ;
323- const int op_erase = 30 ; // special due to optional blr_marks after blr_erase
324- const int op_dcl_local_table = 31 ;
325- const int op_outer_map = 32 ;
326- const int op_invoke_function = 33 ;
327- const int op_invsel_procedure = 34 ;
328- const int op_table_value_fun = 35 ;
329- const int op_for_range = 36 ;
330-
331- static const UCHAR
296+ constexpr int op_line = 1 ;
297+ constexpr int op_verb = 2 ;
298+ constexpr int op_byte = 3 ;
299+ constexpr int op_word = 4 ;
300+ constexpr int op_pad = 5 ;
301+ constexpr int op_dtype = 6 ;
302+ constexpr int op_message = 7 ;
303+ constexpr int op_literal = 8 ;
304+ constexpr int op_begin = 9 ;
305+ constexpr int op_map = 10 ;
306+ constexpr int op_args = 11 ;
307+ constexpr int op_union = 12 ;
308+ constexpr int op_indent = 13 ;
309+ constexpr int op_join = 14 ;
310+ constexpr int op_parameters = 15 ;
311+ constexpr int op_error_handler = 16 ;
312+ constexpr int op_set_error = 17 ;
313+ constexpr int op_literals = 18 ;
314+ constexpr int op_exec_into = 21 ;
315+ constexpr int op_cursor_stmt = 22 ;
316+ constexpr int op_byte_opt_verb = 23 ;
317+ constexpr int op_exec_stmt = 24 ;
318+ constexpr int op_derived_expr = 25 ;
319+ constexpr int op_partition_args = 26 ;
320+ constexpr int op_subproc_decl = 27 ;
321+ constexpr int op_subfunc_decl = 28 ;
322+ constexpr int op_window_win = 29 ;
323+ constexpr int op_erase = 30 ; // special due to optional blr_marks after blr_erase
324+ constexpr int op_dcl_local_table = 31 ;
325+ constexpr int op_outer_map = 32 ;
326+ constexpr int op_invoke_function = 33 ;
327+ constexpr int op_invsel_procedure = 34 ;
328+ constexpr int op_table_value_fun = 35 ;
329+ constexpr int op_for_range = 36 ;
330+
331+ static constexpr UCHAR
332332 // generic print formats
333333 zero[] = { op_line, 0 },
334334 one[] = { op_line, op_verb, 0 },
@@ -438,9 +438,9 @@ static const UCHAR
438438
439439#include " ../jrd/blp.h"
440440
441- const char * const FB_LOCK_ENV = " FIREBIRD_LOCK" ;
442- const char * const FB_MSG_ENV = " FIREBIRD_MSG" ;
443- const char * const FB_TMP_ENV = " FIREBIRD_TMP" ;
441+ constexpr const char * FB_LOCK_ENV = " FIREBIRD_LOCK" ;
442+ constexpr const char * FB_MSG_ENV = " FIREBIRD_MSG" ;
443+ constexpr const char * FB_TMP_ENV = " FIREBIRD_TMP" ;
444444
445445#ifdef WIN_NT
446446#define EXPAND_PATH (relative, absolute ) _fullpath(absolute, relative, MAXPATHLEN)
@@ -1057,7 +1057,7 @@ static SLONG safe_interpret(char* const s, const FB_SIZE_T bufsize,
10571057// ***********************
10581058// Done exclusively because in legacy mode, safe_interpret cannot fill the
10591059// string up to the end by calling strncpy.
1060- static void safe_strncpy (char * target, const char * source, size_t bs)
1060+ static void safe_strncpy (char * target, const char * source, size_t bs) noexcept
10611061{
10621062 if (!bs)
10631063 return ;
@@ -1093,8 +1093,8 @@ void API_ROUTINE gds__interprete_a(SCHAR* s, SSHORT* length, ISC_STATUS* vector,
10931093}
10941094
10951095
1096- const int SECS_PER_HOUR = 60 * 60 ;
1097- const int SECS_PER_DAY = SECS_PER_HOUR * 24 ;
1096+ constexpr int SECS_PER_HOUR = 60 * 60 ;
1097+ constexpr int SECS_PER_DAY = SECS_PER_HOUR * 24 ;
10981098
10991099#ifdef WIN_NT
11001100
@@ -2657,7 +2657,7 @@ void API_ROUTINE gds__unregister_cleanup(FPTR_VOID_PTR routine, void *arg)
26572657 Firebird::MutexLockGuard guard (cleanup_handlers_mutex, " gds__unregister_cleanup" );
26582658
26592659 clean_t * clean;
2660- for (clean_t ** clean_ptr = &cleanup_handlers; clean = *clean_ptr; clean_ptr = &clean->clean_next )
2660+ for (clean_t ** clean_ptr = &cleanup_handlers; ( clean = *clean_ptr) ; clean_ptr = &clean->clean_next )
26612661 {
26622662 if (clean->clean_routine == routine && clean->clean_arg == arg)
26632663 {
0 commit comments