forked from Mirrorlandia_minetest/minetest
Replace the old STATIC_ASSERT macro with static_assert
This commit is contained in:
parent
8b108ed5f2
commit
9c348d057e
@ -158,8 +158,8 @@ EmergeManager::EmergeManager(Server *server, MetricsBackend *mb)
|
||||
|
||||
enable_mapgen_debug_info = g_settings->getBool("enable_mapgen_debug_info");
|
||||
|
||||
STATIC_ASSERT(ARRLEN(emergeActionStrs) == ARRLEN(m_completed_emerge_counter),
|
||||
enum_size_mismatches);
|
||||
static_assert(ARRLEN(emergeActionStrs) == ARRLEN(m_completed_emerge_counter),
|
||||
"enum size mismatches");
|
||||
for (u32 i = 0; i < ARRLEN(m_completed_emerge_counter); i++) {
|
||||
std::string help_str("Number of completed emerges with status ");
|
||||
help_str.append(emergeActionStrs[i]);
|
||||
|
@ -111,8 +111,8 @@ static unsigned int g_level_to_android[] = {
|
||||
};
|
||||
|
||||
void AndroidLogOutput::logRaw(LogLevel lev, const std::string &line) {
|
||||
STATIC_ASSERT(ARRLEN(g_level_to_android) == LL_MAX,
|
||||
mismatch_between_android_and_internal_loglevels);
|
||||
static_assert(ARRLEN(g_level_to_android) == LL_MAX,
|
||||
"mismatch between android and internal loglevels");
|
||||
__android_log_print(g_level_to_android[lev],
|
||||
PROJECT_NAME_C, "%s", line.c_str());
|
||||
}
|
||||
@ -226,8 +226,8 @@ const std::string Logger::getLevelLabel(LogLevel lev)
|
||||
"TRACE",
|
||||
};
|
||||
assert(lev < LL_MAX && lev >= 0);
|
||||
STATIC_ASSERT(ARRLEN(names) == LL_MAX,
|
||||
mismatch_between_loglevel_names_and_enum);
|
||||
static_assert(ARRLEN(names) == LL_MAX,
|
||||
"mismatch between loglevel names and enum");
|
||||
return names[lev];
|
||||
}
|
||||
|
||||
|
@ -99,9 +99,9 @@ static MapgenDesc g_reg_mapgens[] = {
|
||||
{"v6", true},
|
||||
};
|
||||
|
||||
STATIC_ASSERT(
|
||||
static_assert(
|
||||
ARRLEN(g_reg_mapgens) == MAPGEN_INVALID,
|
||||
registered_mapgens_is_wrong_size);
|
||||
"g_reg_mapgens is wrong size");
|
||||
|
||||
////
|
||||
//// Mapgen
|
||||
|
@ -42,18 +42,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
C(C &&other) = default; \
|
||||
C &operator=(C &&) = default;
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define UNUSED_ATTRIBUTE __attribute__ ((unused))
|
||||
#else
|
||||
#define UNUSED_ATTRIBUTE
|
||||
#endif
|
||||
|
||||
// Fail compilation if condition expr is not met.
|
||||
// Note that 'msg' must follow the format of a valid identifier, e.g.
|
||||
// STATIC_ASSERT(sizeof(foobar_t) == 40), foobar_t_is_wrong_size);
|
||||
#define STATIC_ASSERT(expr, msg) \
|
||||
UNUSED_ATTRIBUTE typedef char msg[!!(expr) * 2 - 1]
|
||||
|
||||
// Macros to facilitate writing position vectors to a stream
|
||||
// Usage:
|
||||
// v3s16 pos(1,2,3);
|
||||
|
Loading…
Reference in New Issue
Block a user