Skip to content

Commit 362d7b8

Browse files
committed
constexpr in common.h and msg.h
+ remove some commented out definitions handled elsewhere
1 parent 3966046 commit 362d7b8

File tree

2 files changed

+12
-29
lines changed

2 files changed

+12
-29
lines changed

src/common/common.h

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,6 @@
9494
#define FB_CC CcIcc
9595
#endif
9696

97-
// SLONG is a 32-bit integer on 64-bit platforms
98-
//#if SIZEOF_LONG == 4
99-
//#define SLONGFORMAT "ld"
100-
//#define ULONGFORMAT "lu"
101-
//#define XLONGFORMAT "lX"
102-
//#define xLONGFORMAT "lx"
103-
//#endif
104-
10597
// format for size_t
10698
#ifndef SIZEFORMAT
10799
#define SIZEFORMAT "zi"
@@ -230,11 +222,6 @@
230222
//format for __LINE__
231223
#define LINEFORMAT "d"
232224

233-
//#define SLONGFORMAT "ld"
234-
//#define ULONGFORMAT "lu"
235-
//#define XLONGFORMAT "lX"
236-
//#define xLONGFORMAT "lx"
237-
238225
#define FB_CC CcGcc
239226

240227
#define UNIX
@@ -541,10 +528,6 @@ extern "C" int remove(const char* path);
541528
#endif
542529

543530
#define SYS_ERR Arg::Windows
544-
//#define SLONGFORMAT "ld"
545-
//#define ULONGFORMAT "lu"
546-
//#define XLONGFORMAT "lX"
547-
//#define xLONGFORMAT "lx"
548531

549532
//format for __LINE__
550533
#define LINEFORMAT "d"
@@ -955,11 +938,11 @@ void GDS_breakpoint(int);
955938

956939
// Used in quad operations
957940
#ifndef WORDS_BIGENDIAN
958-
const int LOW_WORD = 0;
959-
const int HIGH_WORD = 1;
941+
inline constexpr int LOW_WORD = 0;
942+
inline constexpr int HIGH_WORD = 1;
960943
#else
961-
const int LOW_WORD = 1;
962-
const int HIGH_WORD = 0;
944+
inline constexpr int LOW_WORD = 1;
945+
inline constexpr int HIGH_WORD = 0;
963946
#endif
964947

965948
#ifndef HAVE_WORKING_VFORK
@@ -976,7 +959,7 @@ const int HIGH_WORD = 0;
976959
#endif
977960

978961

979-
inline const TEXT FB_SHORT_MONTHS[][4] =
962+
inline constexpr TEXT FB_SHORT_MONTHS[][4] =
980963
{
981964
"Jan", "Feb", "Mar",
982965
"Apr", "May", "Jun",
@@ -985,7 +968,7 @@ inline const TEXT FB_SHORT_MONTHS[][4] =
985968
"\0"
986969
};
987970

988-
inline const TEXT* const FB_LONG_MONTHS_UPPER[] =
971+
inline constexpr const TEXT* FB_LONG_MONTHS_UPPER[] =
989972
{
990973
"JANUARY",
991974
"FEBRUARY",
@@ -1003,7 +986,7 @@ inline const TEXT* const FB_LONG_MONTHS_UPPER[] =
1003986
};
1004987

1005988
// Starts with SUNDAY cuz tm.tm_wday starts with it
1006-
inline const TEXT FB_SHORT_DAYS[][4] =
989+
inline constexpr TEXT FB_SHORT_DAYS[][4] =
1007990
{
1008991
"Sun",
1009992
"Mon",
@@ -1016,7 +999,7 @@ inline const TEXT FB_SHORT_DAYS[][4] =
1016999
};
10171000

10181001
// Starts with SUNDAY cuz tm.tm_wday starts with it
1019-
inline const TEXT* const FB_LONG_DAYS_UPPER[] =
1002+
inline constexpr const TEXT* FB_LONG_DAYS_UPPER[] =
10201003
{
10211004
"SUNDAY",
10221005
"MONDAY",
@@ -1028,7 +1011,7 @@ inline const TEXT* const FB_LONG_DAYS_UPPER[] =
10281011
"\0"
10291012
};
10301013

1031-
const FB_SIZE_T FB_MAX_SIZEOF = ~FB_SIZE_T(0); // Assume FB_SIZE_T is unsigned
1014+
inline constexpr FB_SIZE_T FB_MAX_SIZEOF = ~FB_SIZE_T(0); // Assume FB_SIZE_T is unsigned
10321015

10331016
inline constexpr FB_SIZE_T fb_strlen(const char* str)
10341017
{

src/yvalve/msg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
#define JRD_MSG_H
2727

2828
#define MSG_NUMBER(facility, code) ((SLONG) facility * 10000 + code)
29-
const USHORT MSG_BUCKET = 1024;
30-
const UCHAR MSG_MAJOR_VERSION = 1;
29+
inline constexpr USHORT MSG_BUCKET = 1024;
30+
inline constexpr UCHAR MSG_MAJOR_VERSION = 1;
3131
// trick to silence the compiler when FB_MSG_MINOR_VERSION is 0
3232
#define FB_MSG_MINOR_VERSION 1
33-
const UCHAR MSG_MINOR_VERSION = FB_MSG_MINOR_VERSION;
33+
inline constexpr UCHAR MSG_MINOR_VERSION = FB_MSG_MINOR_VERSION;
3434

3535
// Message file header block
3636

0 commit comments

Comments
 (0)