From: Frederic Suter Date: Thu, 26 Mar 2020 13:20:04 +0000 (+0100) Subject: please sonar X-Git-Tag: v3.26~699 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f2795eb46b32db7cd2de790dda6e92a7b1244db1 please sonar --- diff --git a/examples/c/app-bittorrent/bittorrent-peer.c b/examples/c/app-bittorrent/bittorrent-peer.c index 14543f342f..82698bf9a7 100644 --- a/examples/c/app-bittorrent/bittorrent-peer.c +++ b/examples/c/app-bittorrent/bittorrent-peer.c @@ -138,7 +138,7 @@ int get_peers_from_tracker(const_peer_t peer) sg_comm_t comm_received = sg_mailbox_get_async(peer->mailbox, &message); res = sg_comm_wait_for(comm_received, GET_PEERS_TIMEOUT); if (res == SG_OK) { - const tracker_answer_t ta = (const tracker_answer_t)message; + const_tracker_answer_t ta = (const_tracker_answer_t)message; // Add the peers the tracker gave us to our peer list. unsigned i; int peer_id; diff --git a/examples/c/app-bittorrent/tracker.h b/examples/c/app-bittorrent/tracker.h index 663f9ed91e..5714ea0587 100644 --- a/examples/c/app-bittorrent/tracker.h +++ b/examples/c/app-bittorrent/tracker.h @@ -22,6 +22,7 @@ typedef struct s_tracker_answer { xbt_dynar_t peers; // the peer list the peer has asked for. } s_tracker_answer_t; typedef s_tracker_answer_t* tracker_answer_t; +typedef const s_tracker_answer_t* const_tracker_answer_t; tracker_query_t tracker_query_new(int peer_id, sg_mailbox_t return_mailbox); tracker_answer_t tracker_answer_new(int interval); diff --git a/examples/c/dht-pastry/dht-pastry.c b/examples/c/dht-pastry/dht-pastry.c index f26900a84d..b0784eccb2 100644 --- a/examples/c/dht-pastry/dht-pastry.c +++ b/examples/c/dht-pastry/dht-pastry.c @@ -250,7 +250,6 @@ static void handle_message(node_t node, pastry_message_t message) err = sg_comm_wait_for(comm, timeout); if (err == SG_ERROR_TIMEOUT) { XBT_DEBUG("Timeout expired when sending back the current node state to the joining node to %d", node->id); - message_free(message); } break; /* Join reply from all the node touched by the join */ diff --git a/examples/c/io-file-system/io-file-system.c b/examples/c/io-file-system/io-file-system.c index 6d2399fb10..c860102f2b 100644 --- a/examples/c/io-file-system/io-file-system.c +++ b/examples/c/io-file-system/io-file-system.c @@ -17,7 +17,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(io_file_system, "Messages specific for this io example"); -static void show_info(unsigned int disk_count, sg_disk_t* disks) +static void show_info(unsigned int disk_count, const sg_disk_t* disks) { XBT_INFO("Storage info on %s:", sg_host_self_get_name()); diff --git a/examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp b/examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp index 9df987210f..6822f38147 100644 --- a/examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp +++ b/examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness.cpp @@ -47,7 +47,7 @@ static void garbage_stack(void) static void coordinator() { int CS_used = 0; - Message* m = nullptr; + const Message* m = nullptr; std::queue requests; simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name("coordinator"); @@ -101,7 +101,7 @@ static void client(int id) XBT_INFO("Propositions changed : r=1, cs=0"); } - Message* grant = static_cast(my_mailbox->get()); + const Message* grant = static_cast(my_mailbox->get()); if ((id == 1) && (grant->kind == Message::Kind::GRANT)) { cs = 1; diff --git a/examples/s4u/mc-bugged1/s4u-mc-bugged1.cpp b/examples/s4u/mc-bugged1/s4u-mc-bugged1.cpp index 802403d2e0..74ca56f576 100644 --- a/examples/s4u/mc-bugged1/s4u-mc-bugged1.cpp +++ b/examples/s4u/mc-bugged1/s4u-mc-bugged1.cpp @@ -11,7 +11,7 @@ #include #include -#define N 3 +constexpr int N = 3; XBT_LOG_NEW_DEFAULT_CATEGORY(example, "this example"); diff --git a/examples/s4u/mc-bugged2/s4u-mc-bugged2.cpp b/examples/s4u/mc-bugged2/s4u-mc-bugged2.cpp index 6a89f02619..66c085e8b3 100644 --- a/examples/s4u/mc-bugged2/s4u-mc-bugged2.cpp +++ b/examples/s4u/mc-bugged2/s4u-mc-bugged2.cpp @@ -10,7 +10,6 @@ #include #include -#define N 3 XBT_LOG_NEW_DEFAULT_CATEGORY(example, "this example"); diff --git a/src/instr/instr_platform.cpp b/src/instr/instr_platform.cpp index b3c60e79f1..595b8eb219 100644 --- a/src/instr/instr_platform.cpp +++ b/src/instr/instr_platform.cpp @@ -360,7 +360,7 @@ void define_callbacks() kernel::routing::NetPoint::on_creation.connect(on_netpoint_creation); } s4u::NetZone::on_creation.connect(on_netzone_creation); - s4u::Engine::on_time_advance.connect([](double time_delta) { TRACE_paje_dump_buffer(false); }); + s4u::Engine::on_time_advance.connect([](double /*time_delta*/) { TRACE_paje_dump_buffer(false); }); kernel::resource::CpuAction::on_state_change.connect(on_action_state_change); s4u::Link::on_communication_state_change.connect(on_action_state_change);