diff options
author | Adriana Kobylak <anoo@us.ibm.com> | 2017-02-28 12:10:44 -0600 |
---|---|---|
committer | Adriana Kobylak <anoo@us.ibm.com> | 2017-03-15 11:37:06 -0500 |
commit | d722b3aa03c55f9a9737fb47a68e66ad803f53cc (patch) | |
tree | a2b88ab4e540baf101a6b0a22dba12f31a167896 /tools/phosphor-logging | |
parent | a3db07742c870b5e974c8f8c8ae724ca2298b015 (diff) | |
download | phosphor-logging-d722b3aa03c55f9a9737fb47a68e66ad803f53cc.tar.gz phosphor-logging-d722b3aa03c55f9a9737fb47a68e66ad803f53cc.zip |
Make generated code to be const and extern
Set generated maps to be const so that they don't get
accidentally overwritten.
Use .find() to access these generated data sets as the [] operator
is not const.
Declare the generated maps as extern so that there's
no need to include the generated .cpp file.
Change-Id: I4efdcace099bec738e1fa9b67decbedd515d3dfa
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
Diffstat (limited to 'tools/phosphor-logging')
-rw-r--r-- | tools/phosphor-logging/templates/elog-lookup-template.mako.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp b/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp index 5e9e1ba..efa5278 100644 --- a/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp +++ b/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp @@ -4,6 +4,7 @@ // See elog-gen.py for more details #include <map> #include <vector> +#include <log_manager.hpp> #include <phosphor-logging/log.hpp> namespace phosphor @@ -12,7 +13,7 @@ namespace phosphor namespace logging { -std::map<std::string,std::vector<std::string>> g_errMetaMap = { +const std::map<std::string,std::vector<std::string>> g_errMetaMap = { % for name in errors: <% meta_list = [] @@ -33,7 +34,7 @@ std::map<std::string,std::vector<std::string>> g_errMetaMap = { % endfor }; -std::map<std::string,level> g_errLevelMap = { +const std::map<std::string,level> g_errLevelMap = { % for a in errors: {"${a}",level::${error_lvl[a]}}, % endfor |