summaryrefslogtreecommitdiff
path: root/src/table/settings.h.preamble
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-06-21 18:46:27 +0200
committerPatric Stout <github@truebrain.nl>2021-06-26 20:28:34 +0200
commit98e653dacc98d308e440503c9cf9bba01933d1b4 (patch)
treee90907756d28cfc68d9200d094e790984ca0606a /src/table/settings.h.preamble
parentf35e6c1c7fdaefc9153a54c089dbaa6e2549e6b1 (diff)
downloadopenttd-98e653dacc98d308e440503c9cf9bba01933d1b4.tar.xz
Fix #9386: compilers failing to compile with LTO by using variants instead of new + unique_ptr
With std::variant all memory can be figured out at compile time, so the compiler needs to keep track of fewer elements. It also saves out a unique_ptr and its memory management, over a slight impact for resolving a setting.
Diffstat (limited to 'src/table/settings.h.preamble')
-rw-r--r--src/table/settings.h.preamble2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/table/settings.h.preamble b/src/table/settings.h.preamble
index c9b47626c..5fd1a9bac 100644
--- a/src/table/settings.h.preamble
+++ b/src/table/settings.h.preamble
@@ -54,7 +54,7 @@ static size_t ConvertLandscape(const char *value);
* on the appropriate macro.
*/
-#define NSD(type, ...) std::unique_ptr<const SettingDesc>(new type##SettingDesc(__VA_ARGS__))
+#define NSD(type, ...) SettingVariant { std::in_place_type<type##SettingDesc>, __VA_ARGS__ }
/* Macros for various objects to go in the configuration file.
* This section is for global variables */