diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2018-03-07 11:03:13 +1030 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2018-03-08 00:40:55 +1030 |
commit | 14a8c8de981933fdb362597d7cf989249846ee9f (patch) | |
tree | ecefc4ed53a4e1693a89c771990fedaefc437000 /tools | |
parent | 4e5f521a62251659ebd432e0a336f2735f8a1dd0 (diff) | |
download | phosphor-logging-14a8c8de981933fdb362597d7cf989249846ee9f.tar.gz phosphor-logging-14a8c8de981933fdb362597d7cf989249846ee9f.zip |
templates: Allow use of -fsanitize=undefined
Push down the str member to avoid linker errors about the lack of
storage for str when using -fsanitize=undefined.
Change-Id: I1a6b1ba9632aa6e4294573a6be3252d5230992b9
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/phosphor-logging/templates/elog-gen-template.mako.hpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/phosphor-logging/templates/elog-gen-template.mako.hpp b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp index 670f8f5..23d8c08 100644 --- a/tools/phosphor-logging/templates/elog-gen-template.mako.hpp +++ b/tools/phosphor-logging/templates/elog-gen-template.mako.hpp @@ -69,10 +69,14 @@ namespace _${classname} % for b in meta_list: struct ${b} { - static constexpr auto str = "${meta_data[b]['str']}"; + /* + * We can't use -fsanitize=undefined if we declare a + * 'static constexpr auto str' member, so don't. Instead, open-code the + * mako template lookups. + */ static constexpr auto str_short = "${meta_data[b]['str_short']}"; - using type = std::tuple<std::decay_t<decltype(str)>,${meta_data[b]['type']}>; - explicit constexpr ${b}(${meta_data[b]['type']} a) : _entry(entry(str, a)) {}; + using type = std::tuple<std::decay_t<decltype("${meta_data[b]['str']}")>,${meta_data[b]['type']}>; + explicit constexpr ${b}(${meta_data[b]['type']} a) : _entry(entry("${meta_data[b]['str']}", a)) {}; type _entry; }; % endfor |