Skip to content

Commit d0b11e9

Browse files
authored
Merge pull request #8514 from hzeller/feature-20251001-inline-const2
Use `inline constexpr` uniformly for constants in headers.
2 parents fe6ef31 + c6a3a7d commit d0b11e9

File tree

8 files changed

+31
-30
lines changed

8 files changed

+31
-30
lines changed

src/dpl/src/util/symmetry.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
namespace dpl {
77

8-
const unsigned Symmetry_UNKNOWN = 0x00000000;
9-
const unsigned Symmetry_X = 0x00000001;
10-
const unsigned Symmetry_Y = 0x00000002;
11-
const unsigned Symmetry_ROT90 = 0x00000004;
8+
inline constexpr unsigned Symmetry_UNKNOWN = 0x00000000;
9+
inline constexpr unsigned Symmetry_X = 0x00000001;
10+
inline constexpr unsigned Symmetry_Y = 0x00000002;
11+
inline constexpr unsigned Symmetry_ROT90 = 0x00000004;
1212

1313
} // namespace dpl

src/dst/src/LoadBalancer.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ namespace dst {
2424

2525
namespace ip = asio::ip;
2626

27-
const int kWorkersDiscoveryPeriod = 15; // time in seconds between retrying to
28-
// find new workers on the network
27+
// time in seconds between retrying to find new workers on the network
28+
inline constexpr int kWorkersDiscoveryPeriod = 15;
29+
2930
class Distributed;
3031
class LoadBalancer
3132
{

src/odb/include/odb/db.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "odb/isotropy.h"
3232
#include "odb/odb.h"
3333

34-
constexpr int ADS_MAX_CORNER = 10;
34+
inline constexpr int ADS_MAX_CORNER = 10;
3535

3636
namespace utl {
3737
class Logger;

src/odb/include/odb/dbTypes.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,15 +1289,15 @@ class dbSourceType
12891289
};
12901290

12911291
// TODO: shouldn't these come from <climits> ?
1292-
static inline constexpr uint64_t MAX_UINT64 = 0xffffffffffffffffLL;
1293-
static inline constexpr uint64_t MIN_UINT64 = 0;
1294-
static inline constexpr uint MAX_UINT = 0xffffffff;
1295-
static inline constexpr uint MIN_UINT = 0;
1296-
1297-
static inline constexpr int64_t MAX_INT64 = 0x7fffffffffffffffLL;
1298-
static inline constexpr int64_t MIN_INT64 = 0x8000000000000000LL;
1299-
static inline constexpr int MAX_INT = 0x7fffffff;
1300-
static inline constexpr int MIN_INT = 0x80000000;
1292+
inline constexpr uint64_t MAX_UINT64 = 0xffffffffffffffffLL;
1293+
inline constexpr uint64_t MIN_UINT64 = 0;
1294+
inline constexpr uint MAX_UINT = 0xffffffff;
1295+
inline constexpr uint MIN_UINT = 0;
1296+
1297+
inline constexpr int64_t MAX_INT64 = 0x7fffffffffffffffLL;
1298+
inline constexpr int64_t MIN_INT64 = 0x8000000000000000LL;
1299+
inline constexpr int MAX_INT = 0x7fffffff;
1300+
inline constexpr int MIN_INT = 0x80000000;
13011301

13021302
///
13031303
/// Defines the type of shapes.

src/odb/include/odb/gdsUtil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ enum class DataType : uint8_t
136136
};
137137

138138
/** dataType sizes in number of bytes */
139-
static const size_t dataTypeSize[(int) DataType::INVALID_DT]
139+
inline constexpr size_t dataTypeSize[(int) DataType::INVALID_DT]
140140
= {1, 1, 2, 4, 4, 8, 1};
141141

142142
/**

src/odb/include/odb/isotropy.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -274,20 +274,20 @@ std::ostream& operator<<(std::ostream& os, const Direction2D& dir);
274274
std::ostream& operator<<(std::ostream& os, const Direction3D& dir);
275275

276276
// Convenience objects that will be commonly used.
277-
constexpr Orientation2D horizontal{Orientation2D::Horizontal};
278-
constexpr Orientation2D vertical{Orientation2D::Vertical};
279-
constexpr Orientation3D proximal{Orientation3D::Proximal};
277+
inline constexpr Orientation2D horizontal{Orientation2D::Horizontal};
278+
inline constexpr Orientation2D vertical{Orientation2D::Vertical};
279+
inline constexpr Orientation3D proximal{Orientation3D::Proximal};
280280

281-
constexpr Direction1D low{Direction1D::Low};
282-
constexpr Direction1D high{Direction1D::High};
281+
inline constexpr Direction1D low{Direction1D::Low};
282+
inline constexpr Direction1D high{Direction1D::High};
283283

284-
constexpr Direction2D west{Direction2D::West};
285-
constexpr Direction2D east{Direction2D::East};
286-
constexpr Direction2D south{Direction2D::South};
287-
constexpr Direction2D north{Direction2D::North};
284+
inline constexpr Direction2D west{Direction2D::West};
285+
inline constexpr Direction2D east{Direction2D::East};
286+
inline constexpr Direction2D south{Direction2D::South};
287+
inline constexpr Direction2D north{Direction2D::North};
288288

289-
constexpr Direction3D down{Direction3D::Down};
290-
constexpr Direction3D up{Direction3D::Up};
289+
inline constexpr Direction3D down{Direction3D::Down};
290+
inline constexpr Direction3D up{Direction3D::Up};
291291

292292
using utl::format_as;
293293

src/odb/src/lef/clef/lefrReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
#include "lefiTypedefs.h"
3939

40-
constexpr int MAX_LEF_MSGS = 4701;
40+
inline constexpr int MAX_LEF_MSGS = 4701;
4141

4242
/* The reader initialization. Must be called before lefrRead(). */
4343
EXTERN int lefrInit();

src/odb/src/lef/lef/lefrReader.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#include "lefiUser.hpp"
3939
#include "lefiUtil.hpp"
4040

41-
constexpr int MAX_LEF_MSGS = 4701;
41+
inline constexpr int MAX_LEF_MSGS = 4701;
4242

4343
BEGIN_LEF_PARSER_NAMESPACE
4444

0 commit comments

Comments
 (0)