Skip to content

Commit b5d12cf

Browse files
committed
Constexpr in Nodes.h
1 parent 6ac0ad3 commit b5d12cf

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

src/dsql/Nodes.h

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ class ValueExprNode;
5252

5353

5454
// Must be less then MAX_SSHORT. Not used for static arrays.
55-
const unsigned MAX_CONJUNCTS = 32000;
55+
inline constexpr unsigned MAX_CONJUNCTS = 32000;
5656

5757
// New: MAX_STREAMS should be a multiple of BITS_PER_LONG (32 and hard to believe it will change)
5858

59-
const StreamType INVALID_STREAM = ~StreamType(0);
60-
const StreamType MAX_STREAMS = 4096;
59+
inline constexpr StreamType INVALID_STREAM = ~StreamType(0);
60+
inline constexpr StreamType MAX_STREAMS = 4096;
6161

62-
const StreamType STREAM_MAP_LENGTH = MAX_STREAMS + 2;
62+
inline constexpr StreamType STREAM_MAP_LENGTH = MAX_STREAMS + 2;
6363

6464
// New formula is simply MAX_STREAMS / BITS_PER_LONG
65-
const int OPT_STREAM_BITS = MAX_STREAMS / BITS_PER_LONG; // 128 with 4096 streams
65+
inline constexpr int OPT_STREAM_BITS = MAX_STREAMS / BITS_PER_LONG; // 128 with 4096 streams
6666

6767
typedef Firebird::HalfStaticArray<StreamType, OPT_STATIC_STREAMS> StreamList;
6868
typedef Firebird::SortedArray<StreamType> SortedStreamList;
@@ -538,19 +538,19 @@ class ExprNode : public DmlNode
538538
};
539539

540540
// Generic flags.
541-
static const USHORT FLAG_INVARIANT = 0x01; // Node is recognized as being invariant.
542-
static const USHORT FLAG_PATTERN_MATCHER_CACHE = 0x02;
541+
static constexpr USHORT FLAG_INVARIANT = 0x01; // Node is recognized as being invariant.
542+
static constexpr USHORT FLAG_PATTERN_MATCHER_CACHE = 0x02;
543543

544544
// Boolean flags.
545-
static const USHORT FLAG_DEOPTIMIZE = 0x04; // Boolean which requires deoptimization.
546-
static const USHORT FLAG_RESIDUAL = 0x08; // Boolean which must remain residual.
547-
static const USHORT FLAG_ANSI_NOT = 0x10; // ANY/ALL predicate is prefixed with a NOT one.
545+
static constexpr USHORT FLAG_DEOPTIMIZE = 0x04; // Boolean which requires deoptimization.
546+
static constexpr USHORT FLAG_RESIDUAL = 0x08; // Boolean which must remain residual.
547+
static constexpr USHORT FLAG_ANSI_NOT = 0x10; // ANY/ALL predicate is prefixed with a NOT one.
548548

549549
// Value flags.
550-
static const USHORT FLAG_DOUBLE = 0x20;
551-
static const USHORT FLAG_DATE = 0x40;
552-
static const USHORT FLAG_DECFLOAT = 0x80;
553-
static const USHORT FLAG_INT128 = 0x100;
550+
static constexpr USHORT FLAG_DOUBLE = 0x20;
551+
static constexpr USHORT FLAG_DATE = 0x40;
552+
static constexpr USHORT FLAG_DECFLOAT = 0x80;
553+
static constexpr USHORT FLAG_INT128 = 0x100;
554554

555555
explicit ExprNode(Type aType, MemoryPool& pool)
556556
: DmlNode(pool),
@@ -934,13 +934,13 @@ class AggNode : public TypedNode<ValueExprNode, ExprNode::TYPE_AGGREGATE>
934934
public:
935935
// Capabilities
936936
// works in a window frame
937-
static const unsigned CAP_SUPPORTS_WINDOW_FRAME = 0x01;
937+
static constexpr unsigned CAP_SUPPORTS_WINDOW_FRAME = 0x01;
938938
// respects window frame boundaries
939-
static const unsigned CAP_RESPECTS_WINDOW_FRAME = 0x02 | CAP_SUPPORTS_WINDOW_FRAME;
939+
static constexpr unsigned CAP_RESPECTS_WINDOW_FRAME = 0x02 | CAP_SUPPORTS_WINDOW_FRAME;
940940
// wants aggPass/aggExecute calls in a window
941-
static const unsigned CAP_WANTS_AGG_CALLS = 0x04;
941+
static constexpr unsigned CAP_WANTS_AGG_CALLS = 0x04;
942942
// wants winPass call in a window
943-
static const unsigned CAP_WANTS_WIN_PASS_CALL = 0x08;
943+
static constexpr unsigned CAP_WANTS_WIN_PASS_CALL = 0x08;
944944

945945
protected:
946946
struct AggInfo
@@ -1143,16 +1143,16 @@ class WinFuncNode : public AggNode
11431143
class RecordSourceNode : public ExprNode
11441144
{
11451145
public:
1146-
static const USHORT DFLAG_SINGLETON = 0x01;
1147-
static const USHORT DFLAG_VALUE = 0x02;
1148-
static const USHORT DFLAG_RECURSIVE = 0x04; // recursive member of recursive CTE
1149-
static const USHORT DFLAG_DERIVED = 0x08;
1150-
static const USHORT DFLAG_DT_IGNORE_COLUMN_CHECK = 0x10;
1151-
static const USHORT DFLAG_DT_CTE_USED = 0x20;
1152-
static const USHORT DFLAG_CURSOR = 0x40;
1153-
static const USHORT DFLAG_LATERAL = 0x80;
1154-
static const USHORT DFLAG_PLAN_ITEM = 0x100;
1155-
static const USHORT DFLAG_BODY_WRAPPER = 0x200;
1146+
static constexpr USHORT DFLAG_SINGLETON = 0x01;
1147+
static constexpr USHORT DFLAG_VALUE = 0x02;
1148+
static constexpr USHORT DFLAG_RECURSIVE = 0x04; // recursive member of recursive CTE
1149+
static constexpr USHORT DFLAG_DERIVED = 0x08;
1150+
static constexpr USHORT DFLAG_DT_IGNORE_COLUMN_CHECK = 0x10;
1151+
static constexpr USHORT DFLAG_DT_CTE_USED = 0x20;
1152+
static constexpr USHORT DFLAG_CURSOR = 0x40;
1153+
static constexpr USHORT DFLAG_LATERAL = 0x80;
1154+
static constexpr USHORT DFLAG_PLAN_ITEM = 0x100;
1155+
static constexpr USHORT DFLAG_BODY_WRAPPER = 0x200;
11561156

11571157
RecordSourceNode(Type aType, MemoryPool& pool)
11581158
: ExprNode(aType, pool),
@@ -1380,7 +1380,7 @@ class ValueListNode : public TypedNode<ListExprNode, ExprNode::TYPE_VALUE_LIST>
13801380
NestValueArray items;
13811381

13821382
private:
1383-
static const unsigned INITIAL_CAPACITY = 4;
1383+
static constexpr unsigned INITIAL_CAPACITY = 4;
13841384
};
13851385

13861386
// Container for a list of record source expressions.
@@ -1500,11 +1500,11 @@ class StmtNode : public DmlNode
15001500
};
15011501

15021502
// Marks used by EraseNode, ModifyNode, StoreNode and ForNode
1503-
static const unsigned MARK_POSITIONED = 0x01; // Erase|Modify node is positioned at explicit cursor
1504-
static const unsigned MARK_MERGE = 0x02; // node is part of MERGE statement
1505-
static const unsigned MARK_FOR_UPDATE = 0x04; // implicit cursor used in UPDATE\DELETE\MERGE statement
1506-
static const unsigned MARK_AVOID_COUNTERS = 0x08; // do not touch record counters
1507-
static const unsigned MARK_BULK_INSERT = 0x10; // StoreNode is used for bulk operation
1503+
static constexpr unsigned MARK_POSITIONED = 0x01; // Erase|Modify node is positioned at explicit cursor
1504+
static constexpr unsigned MARK_MERGE = 0x02; // node is part of MERGE statement
1505+
static constexpr unsigned MARK_FOR_UPDATE = 0x04; // implicit cursor used in UPDATE\DELETE\MERGE statement
1506+
static constexpr unsigned MARK_AVOID_COUNTERS = 0x08; // do not touch record counters
1507+
static constexpr unsigned MARK_BULK_INSERT = 0x10; // StoreNode is used for bulk operation
15081508

15091509
struct ExeState
15101510
{

0 commit comments

Comments
 (0)