Skip to content

Commit a2fc59e

Browse files
committed
constexpr in sdl
1 parent 9038ba7 commit a2fc59e

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

src/common/sdl.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#include "../common/sdl_proto.h"
3131
#include "../common/StatusArg.h"
3232

33-
const int COMPILE_SIZE = 256;
33+
constexpr int COMPILE_SIZE = 256;
3434

3535
using namespace Jrd;
3636
using namespace Firebird;
@@ -66,7 +66,7 @@ static ISC_STATUS error(CheckStatusWrapper* status_vector, const Arg::StatusVect
6666
static bool execute(sdl_arg*);
6767
static const UCHAR* get_range(const UCHAR*, array_range*, SLONG*, SLONG*);
6868

69-
inline SSHORT get_word(const UCHAR*& ptr)
69+
inline SSHORT get_word(const UCHAR*& ptr) noexcept
7070
{
7171
/**************************************
7272
*
@@ -89,18 +89,18 @@ static const UCHAR* sdl_desc(const UCHAR*, DSC*);
8989
static IPTR* stuff(IPTR, sdl_arg*);
9090

9191

92-
const int op_literal = 1;
93-
const int op_variable = 2;
94-
const int op_add = 3;
95-
const int op_subtract = 4;
96-
const int op_multiply = 5;
97-
const int op_divide = 6;
98-
const int op_iterate = 7;
99-
const int op_goto = 8;
100-
const int op_element = 9;
101-
const int op_loop = 10;
102-
const int op_exit = 11;
103-
const int op_scalar = 12;
92+
constexpr int op_literal = 1;
93+
constexpr int op_variable = 2;
94+
constexpr int op_add = 3;
95+
constexpr int op_subtract = 4;
96+
constexpr int op_multiply = 5;
97+
constexpr int op_divide = 6;
98+
constexpr int op_iterate = 7;
99+
constexpr int op_goto = 8;
100+
constexpr int op_element = 9;
101+
constexpr int op_loop = 10;
102+
constexpr int op_exit = 11;
103+
constexpr int op_scalar = 12;
104104

105105
/*
106106
The structure for a loop is:
@@ -157,7 +157,7 @@ SLONG SDL_compute_subscript(CheckStatusWrapper* status_vector,
157157

158158

159159
ISC_STATUS SDL_info(CheckStatusWrapper* status_vector,
160-
const UCHAR* sdl, sdl_info* info, SLONG* vector)
160+
const UCHAR* sdl, sdl_info* info, const SLONG* vector)
161161
{
162162
/**************************************
163163
*
@@ -407,12 +407,15 @@ static const UCHAR* compile(const UCHAR* sdl, sdl_arg* arg)
407407

408408
case isc_sdl_add:
409409
sdl_operator = op_add;
410+
[[fallthrough]];
410411
case isc_sdl_subtract:
411412
if (!sdl_operator)
412413
sdl_operator = op_subtract;
414+
[[fallthrough]];
413415
case isc_sdl_multiply:
414416
if (!sdl_operator)
415417
sdl_operator = op_multiply;
418+
[[fallthrough]];
416419
case isc_sdl_divide:
417420
if (!sdl_operator)
418421
sdl_operator = op_divide;

src/common/sdl_proto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct sdl_info;
3232
struct array_alice;
3333

3434
SLONG SDL_compute_subscript(Firebird::CheckStatusWrapper*, const Ods::InternalArrayDesc*, USHORT, const SLONG*);
35-
ISC_STATUS SDL_info(Firebird::CheckStatusWrapper*, const UCHAR*, sdl_info*, SLONG*);
35+
ISC_STATUS SDL_info(Firebird::CheckStatusWrapper*, const UCHAR*, sdl_info*, const SLONG*);
3636
int SDL_walk(Firebird::CheckStatusWrapper*, const UCHAR*, UCHAR*, Ods::InternalArrayDesc*, SLONG*,
3737
SDL_walk_callback, array_slice*);
3838

0 commit comments

Comments
 (0)