From 27baa178d250d6e59ec03d3a611acd56501bf7cb Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 20 Apr 2020 10:13:04 +0200 Subject: [PATCH 1/2] fix new clang warning and add helper function --- libsrc/core/utils.hpp | 4 ++++ libsrc/occ/occpkg.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libsrc/core/utils.hpp b/libsrc/core/utils.hpp index 65db4fff..8dd5c531 100644 --- a/libsrc/core/utils.hpp +++ b/libsrc/core/utils.hpp @@ -23,6 +23,10 @@ namespace ngcore NGCORE_API std::string Demangle(const char* typeinfo); + template + NGCORE_API std::string GetName(const T& obj) + { return Demangle(typeid(obj).name()); } + #if defined(__GNUC__) inline bool likely (bool x) { return bool(__builtin_expect(long(x), 1L)); } inline bool unlikely (bool x) { return bool(__builtin_expect(long(x), 0L)); } diff --git a/libsrc/occ/occpkg.cpp b/libsrc/occ/occpkg.cpp index a4f019a7..62d0fe0b 100644 --- a/libsrc/occ/occpkg.cpp +++ b/libsrc/occ/occpkg.cpp @@ -519,7 +519,8 @@ namespace netgen stringstream str; occgeometry->GetTopologyTree (str); - char* cstr = (char*)str.str().c_str(); + auto txt = str.str(); + char* cstr = (char*) txt.c_str(); (*testout) << cstr << endl; From 9af476c353bc5d41901e88fee2866ec84fbcf825 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 20 Apr 2020 10:26:17 +0200 Subject: [PATCH 2/2] template shouldn't have NGCORE_API --- libsrc/core/utils.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/core/utils.hpp b/libsrc/core/utils.hpp index 8dd5c531..81b0073f 100644 --- a/libsrc/core/utils.hpp +++ b/libsrc/core/utils.hpp @@ -24,7 +24,7 @@ namespace ngcore NGCORE_API std::string Demangle(const char* typeinfo); template - NGCORE_API std::string GetName(const T& obj) + std::string GetName(const T& obj) { return Demangle(typeid(obj).name()); } #if defined(__GNUC__)