order static and constexpr consistently

This commit is contained in:
arvidn 2020-02-01 10:18:48 +01:00 committed by Arvid Norberg
parent acbd1c3d4c
commit bf22f56d74
9 changed files with 20 additions and 12 deletions

View File

@ -497,6 +497,10 @@ def parse_class(lno, lines, filename):
continue
if looks_like_variable(line):
if 'constexpr static' in line:
print('ERROR: found "constexpr static", use "static constexpr" instead for consistency!\n%s:%d\n%s'
% (filename, lno, line))
sys.exit(1)
if verbose:
print('var %s' % line)
if not is_visible(context):
@ -840,6 +844,10 @@ for filename in files:
continue
if looks_like_constant(line):
if 'constexpr static' in line:
print('ERROR: found "constexpr static", use "static constexpr" instead for consistency!\n%s:%d\n%s'
% (filename, lno, line))
sys.exit(1)
current_constant, lno = parse_constant(lno - 1, lines, filename)
if current_constant is not None and is_visible(context):
if 'TODO: ' in context:

View File

@ -46,7 +46,7 @@ namespace libtorrent { namespace aux {
// if the cookie is set to this value, it doesn't refer to anything in the
// cache (and the buffer is mutable)
constexpr static std::int32_t none = 0x7fffffff;
static constexpr std::int32_t none = 0x7fffffff;
storage_index_t storage{0};
std::int32_t cookie = none;

View File

@ -64,7 +64,7 @@ struct TORRENT_EXTRA_EXPORT bw_request
// from the most limiting one
int assign_bandwidth();
constexpr static int max_bandwidth_channels = 10;
static constexpr int max_bandwidth_channels = 10;
// we don't actually support more than 10 channels per peer
aux::array<bandwidth_channel*, max_bandwidth_channels> channel{};
};

View File

@ -46,7 +46,7 @@ namespace libtorrent { namespace dht {
{ std::copy(b, b + len, bytes.begin()); }
bool operator==(public_key const& rhs) const
{ return bytes == rhs.bytes; }
constexpr static int len = 32;
static constexpr int len = 32;
std::array<char, len> bytes;
};
@ -57,7 +57,7 @@ namespace libtorrent { namespace dht {
{ std::copy(b, b + len, bytes.begin()); }
bool operator==(secret_key const& rhs) const
{ return bytes == rhs.bytes; }
constexpr static int len = 64;
static constexpr int len = 64;
std::array<char, len> bytes;
};
@ -68,7 +68,7 @@ namespace libtorrent { namespace dht {
{ std::copy(b, b + len, bytes.begin()); }
bool operator==(signature const& rhs) const
{ return bytes == rhs.bytes; }
constexpr static int len = 64;
static constexpr int len = 64;
std::array<char, len> bytes;
};

View File

@ -210,8 +210,8 @@ namespace libtorrent {
else if (allocate <= m_mtu_ceiling_slab.allocate_size) { return m_mtu_ceiling_slab.alloc(); }
return create_packet(allocate);
}
constexpr static int mtu_floor_size = TORRENT_INET_MIN_MTU - TORRENT_IPV4_HEADER - TORRENT_UDP_HEADER;
constexpr static int mtu_ceiling_size = TORRENT_ETHERNET_MTU - TORRENT_IPV4_HEADER - TORRENT_UDP_HEADER;
static constexpr int mtu_floor_size = TORRENT_INET_MIN_MTU - TORRENT_IPV4_HEADER - TORRENT_UDP_HEADER;
static constexpr int mtu_ceiling_size = TORRENT_ETHERNET_MTU - TORRENT_IPV4_HEADER - TORRENT_UDP_HEADER;
packet_slab m_syn_slab;
packet_slab m_mtu_floor_slab;
packet_slab m_mtu_ceiling_slab;

View File

@ -40,7 +40,7 @@ namespace libtorrent {
struct piece_block_progress
{
constexpr static piece_index_t invalid_index{-1};
static constexpr piece_index_t invalid_index{-1};
// the piece and block index
// determines exactly which

View File

@ -1058,8 +1058,8 @@ namespace libtorrent {
#endif
// protocols used by add_port_mapping()
constexpr static portmap_protocol udp = portmap_protocol::udp;
constexpr static portmap_protocol tcp = portmap_protocol::tcp;
static constexpr portmap_protocol udp = portmap_protocol::udp;
static constexpr portmap_protocol tcp = portmap_protocol::tcp;
// add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,
// whichever is enabled. A mapping is created for each listen socket

View File

@ -73,7 +73,7 @@ namespace aux {
{
static_assert(N % 32 == 0, "N must be a multiple of 32");
static constexpr std::ptrdiff_t number_size = N / 32;
constexpr static int bits_in_byte = 8;
static constexpr int bits_in_byte = 8;
public:
using difference_type = std::ptrdiff_t;

View File

@ -624,7 +624,7 @@ namespace libtorrent {
// --------------------------------------------
// PEER MANAGEMENT
constexpr static web_seed_flag_t ephemeral = 0_bit;
static constexpr web_seed_flag_t ephemeral = 0_bit;
// add_web_seed won't add duplicates. If we have already added an entry
// with this URL, we'll get back the existing entry