Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sonar is picky, so let's be verbose
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 2 Mar 2017 20:35:59 +0000 (21:35 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 2 Mar 2017 20:47:58 +0000 (21:47 +0100)
include/simgrid/s4u/file.hpp
src/surf/xml/surfxml_sax_cb.cpp
src/xbt/cunit.cpp

index ecb52c9..1c552d1 100644 (file)
@@ -13,7 +13,6 @@
 namespace simgrid {
 namespace s4u {
 
-class Actor;
 class Storage;
 
 /** @brief A simulated file
index 1fd0a66..6aef8bb 100644 (file)
@@ -707,10 +707,18 @@ void STag_surfxml_link___ctn(){
   }
   xbt_free(link_name); // no-op if it's already nullptr
 
-  surf_parse_assert(link!=nullptr,"No such link: '%s'%s", A_surfxml_link___ctn_id,
-      A_surfxml_link___ctn_direction==A_surfxml_link___ctn_direction_UP?" (upward)":
-          ( A_surfxml_link___ctn_direction==A_surfxml_link___ctn_direction_DOWN?" (downward)":
-              ""));
+  const char* dirname = "";
+  switch (A_surfxml_link___ctn_direction) {
+    case A_surfxml_link___ctn_direction_UP:
+      dirname = " (upward)";
+      break;
+    case A_surfxml_link___ctn_direction_DOWN:
+      dirname = " (downward)";
+      break;
+    default:
+      dirname = "";
+  }
+  surf_parse_assert(link != nullptr, "No such link: '%s'%s", A_surfxml_link___ctn_id, dirname);
   parsed_link_list.push_back(link);
 }
 
index d98ac9d..bac2505 100644 (file)
@@ -322,8 +322,21 @@ static int xbt_test_suite_run(xbt_test_suite_t suite, int verbosity)
         xbt_dynar_foreach(unit->tests, it_test, test) {
           file = (test->file != nullptr ? test->file : unit->file);
           line = (test->line != 0 ? test->line : unit->line);
-          fprintf(stderr, "      %s: %s [%s:%d]\n", (test->ignored ? " SKIP" : (test->expected_failure
-                  ? (test-> failed ? "EFAIL" : "EPASS") : (test->failed ? " FAIL" : " PASS"))),test->title, file, line);
+          const char* resname;
+          if (test->ignored)
+            resname = " SKIP";
+          else if (test->expected_failure) {
+            if (test->failed)
+              resname = "EFAIL";
+            else
+              resname = "EPASS";
+          } else {
+            if (test->failed)
+              resname = " FAIL";
+            else
+              resname = " PASS";
+          }
+          fprintf(stderr, "      %s: %s [%s:%d]\n", resname, test->title, file, line);
 
           if ((test->expected_failure && !test->failed) || (!test->expected_failure && test->failed)) {
             xbt_dynar_foreach(test->logs, it_log, log) {