From 7845434270524d4c777a6711d2e17ac89eeeeb89 Mon Sep 17 00:00:00 2001 From: Michael Lutz Date: Mon, 14 Dec 2020 00:14:37 +0100 Subject: Codechange: Don't use cpp_offsetof in the save/load code. Many of the member variables that are used in save/load are inside types that are not standard layout types. Using pointer arithmetics to determine addresses of members inside types that are not standard layout is generally undefined behaviour. If we'd use C++17, it is conditionally supported, which means each compiler may or may not support it. And even then using it for individual array elements is syntactically not supported the the standard offsetof function. Unfortunately, the trickery employed for saving linkgraph settings causes quite some clutter in the settings ini files. --- src/table/company_settings.ini | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/table/company_settings.ini') diff --git a/src/table/company_settings.ini b/src/table/company_settings.ini index 8f9bee3bf..1be7ccbc2 100644 --- a/src/table/company_settings.ini +++ b/src/table/company_settings.ini @@ -16,8 +16,8 @@ static const SettingDesc _company_settings[] = { [post-amble] }; [templates] -SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat), -SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat), +SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra), +SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra), SDT_END = SDT_END() [defaults] @@ -32,6 +32,7 @@ load = nullptr from = SL_MIN_VERSION to = SL_MAX_VERSION cat = SC_ADVANCED +extra = 0 -- cgit v1.2.3-54-g00ecf