Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Use the "&" operator with function names.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 9 Jan 2019 08:51:55 +0000 (09:51 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 9 Jan 2019 10:21:23 +0000 (11:21 +0100)
src/xbt/backtrace.cpp
tools/sg_unit_extractor.pl

index 2be0a6c..7af4ee6 100644 (file)
@@ -46,16 +46,13 @@ std::unique_ptr<char, void(*)(void*)> demangle(const char* name)
 {
 #ifdef __GXX_ABI_VERSION
   int status;
 {
 #ifdef __GXX_ABI_VERSION
   int status;
-  auto res = std::unique_ptr<char, void(*)(void*)>(
-    abi::__cxa_demangle(name, nullptr, nullptr, &status),
-    std::free
-  );
+  auto res = std::unique_ptr<char, void (*)(void*)>(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:
   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<char, void(*)(void*)>(xbt_strdup(name), std::free);
+  return std::unique_ptr<char, void (*)(void*)>(xbt_strdup(name), &std::free);
 }
 
 class BacktraceImpl {
 }
 
 class BacktraceImpl {
index c1ee119..638ba49 100755 (executable)
@@ -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";
        }
 
            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);
            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 .= "      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";
        } @tests;
 
        $newmain .= "    /* SGU: END FILE */\n\n";