From bc259c183b5a43c6f899d648b4c350bf09dc7eac Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 9 Jan 2019 09:51:55 +0100 Subject: [PATCH] [sonar] Use the "&" operator with function names. --- src/xbt/backtrace.cpp | 7 ++----- tools/sg_unit_extractor.pl | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/xbt/backtrace.cpp b/src/xbt/backtrace.cpp index 2be0a6c165..7af4ee60e3 100644 --- a/src/xbt/backtrace.cpp +++ b/src/xbt/backtrace.cpp @@ -46,16 +46,13 @@ std::unique_ptr demangle(const char* name) { #ifdef __GXX_ABI_VERSION int status; - auto res = std::unique_ptr( - abi::__cxa_demangle(name, nullptr, nullptr, &status), - std::free - ); + auto res = std::unique_ptr(abi::__cxa_demangle(name, nullptr, nullptr, &status), &std::free); if (res != nullptr) return res; // We did not manage to resolve this. Probably because this is not a mangled symbol: #endif // Return the symbol: - return std::unique_ptr(xbt_strdup(name), std::free); + return std::unique_ptr(xbt_strdup(name), &std::free); } class BacktraceImpl { diff --git a/tools/sg_unit_extractor.pl b/tools/sg_unit_extractor.pl index c1ee1196f9..638ba49b5e 100755 --- a/tools/sg_unit_extractor.pl +++ b/tools/sg_unit_extractor.pl @@ -80,7 +80,7 @@ sub process_one($) { die "$progname: Parse error: This line seem to be a test suite declaration, but failed to parse it\n$_\n"; } - if (m/XBT_TEST_UNIT\(\w*"([^"]*)"\w*,([^,]*),(.*?)\)/) { #"{ + if (m/XBT_TEST_UNIT\(\w*"([^"]*)"\w*, *([^,]*), *(.*?)\)/) { #"{ die "$progname: multiply defined unit in file $infile: $1\n" if (defined($tests{$1})); my @t=($1,$2,$3); @@ -268,7 +268,7 @@ EOF $newmain .= " suite = xbt_test_suite_by_name(\"$suite_name\",$suite_title);\n"; map { my ($name,$func,$title) = @{$_}; - $newmain .= " xbt_test_suite_push(suite, \"$name\", $func, $title);\n"; + $newmain .= " xbt_test_suite_push(suite, \"$name\", &$func, $title);\n"; } @tests; $newmain .= " /* SGU: END FILE */\n\n"; -- 2.20.1