aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/modchannels.cpp3
-rw-r--r--src/server.cpp6
-rw-r--r--src/unittest/test_address.cpp2
-rw-r--r--src/unittest/test_eventmanager.cpp4
-rw-r--r--src/unittest/test_server_shutdown_state.cpp4
-rw-r--r--src/util/metricsbackend.cpp3
7 files changed, 10 insertions, 18 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 7f207244c..57baf20bd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -718,7 +718,6 @@ if(MSVC)
endif()
else()
# GCC or compatible compilers such as Clang
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(WARN_ALL)
set(RELEASE_WARNING_FLAGS "-Wall")
else()
@@ -751,6 +750,7 @@ else()
if(MINGW)
set(OTHER_FLAGS "${OTHER_FLAGS} -mthreads -fexceptions")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWIN32_LEAN_AND_MEAN")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mwindows")
endif()
# Use a safe subset of flags to speed up math calculations:
@@ -787,10 +787,6 @@ else()
if(USE_GPROF)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")
endif()
-
- if(MINGW)
- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mwindows")
- endif()
endif()
diff --git a/src/modchannels.cpp b/src/modchannels.cpp
index 301dcb092..9626e8e0c 100644
--- a/src/modchannels.cpp
+++ b/src/modchannels.cpp
@@ -88,8 +88,7 @@ bool ModChannelMgr::canWriteOnChannel(const std::string &channel) const
void ModChannelMgr::registerChannel(const std::string &channel)
{
- m_registered_channels[channel] =
- std::unique_ptr<ModChannel>(new ModChannel(channel));
+ m_registered_channels[channel] = std::make_unique<ModChannel>(channel);
}
bool ModChannelMgr::setChannelState(const std::string &channel, ModChannelState state)
diff --git a/src/server.cpp b/src/server.cpp
index 685d8bb25..d9205c895 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -254,7 +254,7 @@ Server::Server(
#if USE_PROMETHEUS
m_metrics_backend = std::unique_ptr<MetricsBackend>(createPrometheusMetricsBackend());
#else
- m_metrics_backend = std::unique_ptr<MetricsBackend>(new MetricsBackend());
+ m_metrics_backend = std::make_unique<MetricsBackend>();
#endif
m_uptime_counter = m_metrics_backend->addCounter("minetest_core_server_uptime", "Server uptime (in seconds)");
@@ -406,7 +406,7 @@ void Server::init()
m_mod_storage_database = openModStorageDatabase(m_path_world);
m_mod_storage_database->beginSave();
- m_modmgr = std::unique_ptr<ServerModManager>(new ServerModManager(m_path_world));
+ m_modmgr = std::make_unique<ServerModManager>(m_path_world);
std::vector<ModSpec> unsatisfied_mods = m_modmgr->getUnsatisfiedMods();
// complain about mods with unsatisfied dependencies
if (!m_modmgr->isConsistent()) {
@@ -426,7 +426,7 @@ void Server::init()
m_script = new ServerScripting(this);
// Must be created before mod loading because we have some inventory creation
- m_inventory_mgr = std::unique_ptr<ServerInventoryManager>(new ServerInventoryManager());
+ m_inventory_mgr = std::make_unique<ServerInventoryManager>();
m_script->loadMod(getBuiltinLuaPath() + DIR_DELIM "init.lua", BUILTIN_MOD_NAME);
diff --git a/src/unittest/test_address.cpp b/src/unittest/test_address.cpp
index 35d4effb6..f46135577 100644
--- a/src/unittest/test_address.cpp
+++ b/src/unittest/test_address.cpp
@@ -56,7 +56,7 @@ void TestAddress::testIsLocalhost()
UASSERT(!Address(172, 45, 37, 68, 0).isLocalhost());
// v6
- std::unique_ptr<IPv6AddressBytes> ipv6Bytes(new IPv6AddressBytes());
+ auto ipv6Bytes = std::make_unique<IPv6AddressBytes>();
std::vector<u8> ipv6RawAddr = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
memcpy(ipv6Bytes->bytes, &ipv6RawAddr[0], 16);
UASSERT(Address(ipv6Bytes.get(), 0).isLocalhost())
diff --git a/src/unittest/test_eventmanager.cpp b/src/unittest/test_eventmanager.cpp
index bb0e59336..fec57f9fe 100644
--- a/src/unittest/test_eventmanager.cpp
+++ b/src/unittest/test_eventmanager.cpp
@@ -82,7 +82,7 @@ void TestEventManager::testDeregister()
void TestEventManager::testRealEvent()
{
EventManager ev;
- std::unique_ptr<EventManagerTest> emt(new EventManagerTest());
+ auto emt = std::make_unique<EventManagerTest>();
ev.reg(MtEvent::PLAYER_REGAIN_GROUND, EventManagerTest::eventTest, emt.get());
// Put event & verify event value
@@ -93,7 +93,7 @@ void TestEventManager::testRealEvent()
void TestEventManager::testRealEventAfterDereg()
{
EventManager ev;
- std::unique_ptr<EventManagerTest> emt(new EventManagerTest());
+ auto emt = std::make_unique<EventManagerTest>();
ev.reg(MtEvent::PLAYER_REGAIN_GROUND, EventManagerTest::eventTest, emt.get());
// Put event & verify event value
diff --git a/src/unittest/test_server_shutdown_state.cpp b/src/unittest/test_server_shutdown_state.cpp
index fbb76ff6a..50305e725 100644
--- a/src/unittest/test_server_shutdown_state.cpp
+++ b/src/unittest/test_server_shutdown_state.cpp
@@ -26,12 +26,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
class FakeServer : public Server
{
public:
- // clang-format off
FakeServer() : Server("fakeworld", SubgameSpec("fakespec", "fakespec"), true,
Address(), true, nullptr)
{
}
- // clang-format on
private:
void SendChatMessage(session_t peer_id, const ChatMessage &message)
@@ -95,7 +93,7 @@ void TestServerShutdownState::testTrigger()
void TestServerShutdownState::testTick()
{
- std::unique_ptr<FakeServer> fakeServer(new FakeServer());
+ auto fakeServer = std::make_unique<FakeServer>();
Server::ShutdownState ss;
ss.trigger(28.0f, "testtrigger", true);
ss.tick(0.0f, fakeServer.get());
diff --git a/src/util/metricsbackend.cpp b/src/util/metricsbackend.cpp
index 4454557a3..c3b7def62 100644
--- a/src/util/metricsbackend.cpp
+++ b/src/util/metricsbackend.cpp
@@ -99,8 +99,7 @@ class PrometheusMetricsBackend : public MetricsBackend
{
public:
PrometheusMetricsBackend(const std::string &addr) :
- MetricsBackend(), m_exposer(std::unique_ptr<prometheus::Exposer>(
- new prometheus::Exposer(addr))),
+ MetricsBackend(), m_exposer(std::make_unique<prometheus::Exposer>(addr)),
m_registry(std::make_shared<prometheus::Registry>())
{
m_exposer->RegisterCollectable(m_registry);