Definition of type `enum e_smx_simcall_t` (one value per existing simcall)
- popping_generated.cpp:
Definitions of `simcall_names[]` (debug name of each simcall), and
- SIMIX_simcall_enter() that deals with the simcall from within the kernel
+ ActorImpl::simcall_handle() that deals with the simcall from within the kernel
The simcall.in file list all the simcalls in sections. A line starting by "##"
define a new section which will be replace by a "ifdef" in the generated code.
/** Interval between each update of the choked peers */
constexpr int UPDATE_CHOKED_INTERVAL = 30;
-/** Message sizes
- * Sizes based on report by A. Legout et al, Understanding BitTorrent: An Experimental Perspective
- * http://hal.inria.fr/inria-00000156/en
- */
-constexpr unsigned MESSAGE_HANDSHAKE_SIZE = 68;
-constexpr unsigned MESSAGE_CHOKE_SIZE = 5;
-constexpr unsigned MESSAGE_UNCHOKE_SIZE = 5;
-constexpr unsigned MESSAGE_INTERESTED_SIZE = 5;
-constexpr unsigned MESSAGE_NOTINTERESTED_SIZE = 5;
-constexpr unsigned MESSAGE_HAVE_SIZE = 9;
-constexpr unsigned MESSAGE_BITFIELD_SIZE = 5;
-constexpr unsigned MESSAGE_REQUEST_SIZE = 17;
-constexpr unsigned MESSAGE_PIECE_SIZE = 13;
-constexpr unsigned MESSAGE_CANCEL_SIZE = 17;
-
/** Types of messages exchanged between two peers. */
-enum e_message_type {
- MESSAGE_HANDSHAKE,
- MESSAGE_CHOKE,
- MESSAGE_UNCHOKE,
- MESSAGE_INTERESTED,
- MESSAGE_NOTINTERESTED,
- MESSAGE_HAVE,
- MESSAGE_BITFIELD,
- MESSAGE_REQUEST,
- MESSAGE_PIECE,
- MESSAGE_CANCEL
-};
+enum class MessageType { HANDSHAKE, CHOKE, UNCHOKE, INTERESTED, NOTINTERESTED, HAVE, BITFIELD, REQUEST, PIECE, CANCEL };
class Message {
public:
- e_message_type type;
+ MessageType type;
int peer_id;
simgrid::s4u::Mailbox* return_mailbox;
unsigned int bitfield = 0U;
int piece = 0;
int block_index = 0;
int block_length = 0;
- Message(e_message_type type, int peer_id, simgrid::s4u::Mailbox* return_mailbox)
+ Message(MessageType type, int peer_id, simgrid::s4u::Mailbox* return_mailbox)
: type(type), peer_id(peer_id), return_mailbox(return_mailbox){};
- Message(e_message_type type, int peer_id, unsigned int bitfield, simgrid::s4u::Mailbox* return_mailbox)
+ Message(MessageType type, int peer_id, unsigned int bitfield, simgrid::s4u::Mailbox* return_mailbox)
: type(type), peer_id(peer_id), return_mailbox(return_mailbox), bitfield(bitfield){};
- Message(e_message_type type, int peer_id, simgrid::s4u::Mailbox* return_mailbox, int piece, int block_index,
+ Message(MessageType type, int peer_id, simgrid::s4u::Mailbox* return_mailbox, int piece, int block_index,
int block_length)
: type(type)
, peer_id(peer_id)
, piece(piece)
, block_index(block_index)
, block_length(block_length){};
- Message(e_message_type type, int peer_id, simgrid::s4u::Mailbox* return_mailbox, int piece)
+ Message(MessageType type, int peer_id, simgrid::s4u::Mailbox* return_mailbox, int piece)
: type(type), peer_id(peer_id), return_mailbox(return_mailbox), piece(piece){};
};
constexpr double SLEEP_DURATION = 1.0;
#define BITS_TO_BYTES(x) (((x) / 8 + (x) % 8) ? 1 : 0)
-constexpr std::array<const char*, 10> message_type_names{
- {"HANDSHAKE", "CHOKE", "UNCHOKE", "INTERESTED", "NOTINTERESTED", "HAVE", "BITFIELD", "REQUEST", "PIECE", "CANCEL"}};
+/** Message sizes
+ * Sizes based on report by A. Legout et al, Understanding BitTorrent: An Experimental Perspective
+ * http://hal.inria.fr/inria-00000156/en
+ */
+constexpr unsigned message_size(MessageType type)
+{
+ constexpr std::array<unsigned, 10> sizes{{/* HANDSHAKE */ 68,
+ /* CHOKE */ 5,
+ /* UNCHOKE */ 5,
+ /* INTERESTED */ 5,
+ /* NOTINTERESTED */ 5,
+ /* HAVE */ 9,
+ /* BITFIELD */ 5,
+ /* REQUEST */ 17,
+ /* PIECE */ 13,
+ /* CANCEL */ 17}};
+ return sizes[static_cast<int>(type)];
+}
+
+constexpr const char* message_name(MessageType type)
+{
+ constexpr std::array<const char*, 10> names{{"HANDSHAKE", "CHOKE", "UNCHOKE", "INTERESTED", "NOTINTERESTED", "HAVE",
+ "BITFIELD", "REQUEST", "PIECE", "CANCEL"}};
+ return names[static_cast<int>(type)];
+}
Peer::Peer(std::vector<std::string> args)
{
{
for (auto const& kv : connected_peers) {
const Connection& remote_peer = kv.second;
- auto* handshake = new Message(MESSAGE_HANDSHAKE, id, mailbox_);
- remote_peer.mailbox_->put_init(handshake, MESSAGE_HANDSHAKE_SIZE)->detach();
+ auto* handshake = new Message(MessageType::HANDSHAKE, id, mailbox_);
+ remote_peer.mailbox_->put_init(handshake, message_size(MessageType::HANDSHAKE))->detach();
XBT_DEBUG("Sending a HANDSHAKE to %d", remote_peer.id);
}
}
-void Peer::sendMessage(simgrid::s4u::Mailbox* mailbox, e_message_type type, uint64_t size)
+void Peer::sendMessage(simgrid::s4u::Mailbox* mailbox, MessageType type, uint64_t size)
{
- XBT_DEBUG("Sending %s to %s", message_type_names.at(type), mailbox->get_cname());
+ XBT_DEBUG("Sending %s to %s", message_name(type), mailbox->get_cname());
mailbox->put_init(new Message(type, id, bitfield_, mailbox_), size)->detach();
}
{
XBT_DEBUG("Sending a BITFIELD to %s", mailbox->get_cname());
mailbox
- ->put_init(new Message(MESSAGE_BITFIELD, id, bitfield_, mailbox_),
- MESSAGE_BITFIELD_SIZE + BITS_TO_BYTES(FILE_PIECES))
+ ->put_init(new Message(MessageType::BITFIELD, id, bitfield_, mailbox_),
+ message_size(MessageType::BITFIELD) + BITS_TO_BYTES(FILE_PIECES))
->detach();
}
{
xbt_assert(not hasNotPiece(piece), "Tried to send a unavailable piece.");
XBT_DEBUG("Sending the PIECE %u (%d,%d) to %s", piece, block_index, block_length, mailbox->get_cname());
- mailbox->put_init(new Message(MESSAGE_PIECE, id, mailbox_, piece, block_index, block_length), BLOCK_SIZE)->detach();
+ mailbox->put_init(new Message(MessageType::PIECE, id, mailbox_, piece, block_index, block_length), BLOCK_SIZE)
+ ->detach();
}
void Peer::sendHaveToAllPeers(unsigned int piece)
XBT_DEBUG("Sending HAVE message to all my peers");
for (auto const& kv : connected_peers) {
const Connection& remote_peer = kv.second;
- remote_peer.mailbox_->put_init(new Message(MESSAGE_HAVE, id, mailbox_, piece), MESSAGE_HAVE_SIZE)->detach();
+ remote_peer.mailbox_->put_init(new Message(MessageType::HAVE, id, mailbox_, piece), message_size(MessageType::HAVE))
+ ->detach();
}
}
XBT_DEBUG("Sending a REQUEST to %s for piece %u (%d,%d)", remote_peer->mailbox_->get_cname(), piece, block_index,
block_length);
remote_peer->mailbox_
- ->put_init(new Message(MESSAGE_REQUEST, id, mailbox_, piece, block_index, block_length), MESSAGE_REQUEST_SIZE)
+ ->put_init(new Message(MessageType::REQUEST, id, mailbox_, piece, block_index, block_length),
+ message_size(MessageType::REQUEST))
->detach();
}
}
void Peer::handleMessage()
{
- XBT_DEBUG("Received a %s message from %s", message_type_names.at(message->type),
- message->return_mailbox->get_cname());
+ XBT_DEBUG("Received a %s message from %s", message_name(message->type), message->return_mailbox->get_cname());
auto known_peer = connected_peers.find(message->peer_id);
Connection* remote_peer = (known_peer == connected_peers.end()) ? nullptr : &known_peer->second;
- xbt_assert(remote_peer != nullptr || message->type == MESSAGE_HANDSHAKE,
+ xbt_assert(remote_peer != nullptr || message->type == MessageType::HANDSHAKE,
"The impossible did happened: A not-in-our-list peer sent us a message.");
switch (message->type) {
- case MESSAGE_HANDSHAKE:
+ case MessageType::HANDSHAKE:
// Check if the peer is in our connection list.
if (remote_peer == nullptr) {
XBT_DEBUG("This peer %d was unknown, answer to its handshake", message->peer_id);
connected_peers.emplace(message->peer_id, Connection(message->peer_id));
- sendMessage(message->return_mailbox, MESSAGE_HANDSHAKE, MESSAGE_HANDSHAKE_SIZE);
+ sendMessage(message->return_mailbox, MessageType::HANDSHAKE, message_size(MessageType::HANDSHAKE));
}
// Send our bitfield to the peer
sendBitfield(message->return_mailbox);
break;
- case MESSAGE_BITFIELD:
+ case MessageType::BITFIELD:
// Update the pieces list
updatePiecesCountFromBitfield(message->bitfield);
// Store the bitfield
xbt_assert(not remote_peer->am_interested, "Should not be interested at first");
if (isInterestedBy(remote_peer)) {
remote_peer->am_interested = true;
- sendMessage(message->return_mailbox, MESSAGE_INTERESTED, MESSAGE_INTERESTED_SIZE);
+ sendMessage(message->return_mailbox, MessageType::INTERESTED, message_size(MessageType::INTERESTED));
}
break;
- case MESSAGE_INTERESTED:
+ case MessageType::INTERESTED:
// Update the interested state of the peer.
remote_peer->interested = true;
updateActivePeersSet(remote_peer);
break;
- case MESSAGE_NOTINTERESTED:
+ case MessageType::NOTINTERESTED:
remote_peer->interested = false;
updateActivePeersSet(remote_peer);
break;
- case MESSAGE_UNCHOKE:
+ case MessageType::UNCHOKE:
xbt_assert(remote_peer->choked_download);
remote_peer->choked_download = false;
// Send requests to the peer, since it has unchoked us
if (remote_peer->am_interested)
requestNewPieceTo(remote_peer);
break;
- case MESSAGE_CHOKE:
+ case MessageType::CHOKE:
xbt_assert(not remote_peer->choked_download);
remote_peer->choked_download = true;
if (remote_peer->current_piece != -1)
removeCurrentPiece(remote_peer, remote_peer->current_piece);
break;
- case MESSAGE_HAVE:
+ case MessageType::HAVE:
XBT_DEBUG("\t for piece %d", message->piece);
xbt_assert((message->piece >= 0 && static_cast<unsigned int>(message->piece) < FILE_PIECES),
"Wrong HAVE message received");
// If the piece is in our pieces, we tell the peer that we are interested.
if (not remote_peer->am_interested && hasNotPiece(message->piece)) {
remote_peer->am_interested = true;
- sendMessage(message->return_mailbox, MESSAGE_INTERESTED, MESSAGE_INTERESTED_SIZE);
+ sendMessage(message->return_mailbox, MessageType::INTERESTED, message_size(MessageType::INTERESTED));
if (not remote_peer->choked_download)
requestNewPieceTo(remote_peer);
}
break;
- case MESSAGE_REQUEST:
+ case MessageType::REQUEST:
xbt_assert(remote_peer->interested);
xbt_assert((message->piece >= 0 && static_cast<unsigned int>(message->piece) < FILE_PIECES),
"Wrong HAVE message received");
XBT_DEBUG("\t for piece %d but he is choked.", message->peer_id);
}
break;
- case MESSAGE_PIECE:
+ case MessageType::PIECE:
XBT_DEBUG(" \t for piece %d (%d,%d)", message->piece, message->block_index,
message->block_index + message->block_length);
xbt_assert(not remote_peer->choked_download);
requestNewPieceTo(remote_peer);
}
break;
- case MESSAGE_CANCEL:
+ case MessageType::CANCEL:
break;
default:
THROW_IMPOSSIBLE;
choked_peer->choked_upload = true;
updateActivePeersSet(choked_peer);
XBT_DEBUG("(%d) Sending a CHOKE to %d", id, choked_peer->id);
- sendMessage(choked_peer->mailbox_, MESSAGE_CHOKE, MESSAGE_CHOKE_SIZE);
+ sendMessage(choked_peer->mailbox_, MessageType::CHOKE, message_size(MessageType::CHOKE));
}
if (chosen_peer != nullptr) {
xbt_assert((chosen_peer->choked_upload), "Tries to unchoked an unchoked peer");
chosen_peer->last_unchoke = simgrid::s4u::Engine::get_clock();
XBT_DEBUG("(%d) Sending a UNCHOKE to %d", id, chosen_peer->id);
updateActivePeersSet(chosen_peer);
- sendMessage(chosen_peer->mailbox_, MESSAGE_UNCHOKE, MESSAGE_UNCHOKE_SIZE);
+ sendMessage(chosen_peer->mailbox_, MessageType::UNCHOKE, message_size(MessageType::UNCHOKE));
}
}
}
if (not interested) { // no more piece to download from connection
remote_peer.am_interested = false;
- sendMessage(remote_peer.mailbox_, MESSAGE_NOTINTERESTED, MESSAGE_NOTINTERESTED_SIZE);
+ sendMessage(remote_peer.mailbox_, MessageType::NOTINTERESTED, message_size(MessageType::NOTINTERESTED));
}
}
}
void requestNewPieceTo(Connection* remote_peer);
bool getPeersFromTracker();
- void sendMessage(simgrid::s4u::Mailbox* mailbox, e_message_type type, uint64_t size);
+ void sendMessage(simgrid::s4u::Mailbox* mailbox, MessageType type, uint64_t size);
void sendBitfield(simgrid::s4u::Mailbox* mailbox);
void sendPiece(simgrid::s4u::Mailbox* mailbox, unsigned int piece, int block_index, int block_length);
void sendHandshakeToAllPeers();
void Node::notifyAndQuit()
{
// send the PREDECESSOR_LEAVING to our successor
- auto* pred_msg = new ChordMessage(PREDECESSOR_LEAVING);
+ auto* pred_msg = new ChordMessage(MessageType::PREDECESSOR_LEAVING);
pred_msg->request_id = pred_id_;
pred_msg->answer_to = mailbox_;
if (pred_id_ != -1 && pred_id_ != id_) {
// send the SUCCESSOR_LEAVING to our predecessor (only if I have one that is not me)
- auto* succ_msg = new ChordMessage(SUCCESSOR_LEAVING);
+ auto* succ_msg = new ChordMessage(MessageType::SUCCESSOR_LEAVING);
succ_msg->request_id = fingers_[0];
succ_msg->answer_to = mailbox_;
XBT_DEBUG("Sending a 'SUCCESSOR_LEAVING' to my predecessor %d", pred_id_);
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(pred_id_));
simgrid::s4u::Mailbox* return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_is_alive");
- auto* message = new ChordMessage(PREDECESSOR_ALIVE);
+ auto* message = new ChordMessage(MessageType::PREDECESSOR_ALIVE);
message->request_id = pred_id_;
message->answer_to = return_mailbox;
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(ask_to));
simgrid::s4u::Mailbox* return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_pred");
- auto* message = new ChordMessage(GET_PREDECESSOR);
+ auto* message = new ChordMessage(MessageType::GET_PREDECESSOR);
message->request_id = id_;
message->answer_to = return_mailbox;
simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(ask_to));
simgrid::s4u::Mailbox* return_mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(id_) + "_succ");
- auto* message = new ChordMessage(FIND_SUCCESSOR);
+ auto* message = new ChordMessage(MessageType::FIND_SUCCESSOR);
message->request_id = id_;
message->answer_to = return_mailbox;
/* Notifies a remote node that its predecessor may have changed. */
void Node::remoteNotify(int notify_id, int predecessor_candidate_id) const
{
- auto* message = new ChordMessage(NOTIFY);
+ auto* message = new ChordMessage(MessageType::NOTIFY);
message->request_id = predecessor_candidate_id;
message->answer_to = nullptr;
void Node::handleMessage(ChordMessage* message)
{
switch (message->type) {
- case FIND_SUCCESSOR:
- XBT_DEBUG("Received a 'Find Successor' request from %s for id %d", message->issuer_host_name.c_str(),
- message->request_id);
- // is my successor the successor?
- if (is_in_interval(message->request_id, id_ + 1, fingers_[0])) {
- message->type = FIND_SUCCESSOR_ANSWER;
- message->answer_id = fingers_[0];
- XBT_DEBUG("Sending back a 'Find Successor Answer' to %s (mailbox %s): the successor of %d is %d",
- message->issuer_host_name.c_str(), message->answer_to->get_cname(), message->request_id,
- message->answer_id);
+ case MessageType::FIND_SUCCESSOR:
+ XBT_DEBUG("Received a 'Find Successor' request from %s for id %d", message->issuer_host_name.c_str(),
+ message->request_id);
+ // is my successor the successor?
+ if (is_in_interval(message->request_id, id_ + 1, fingers_[0])) {
+ message->type = MessageType::FIND_SUCCESSOR_ANSWER;
+ message->answer_id = fingers_[0];
+ XBT_DEBUG("Sending back a 'Find Successor Answer' to %s (mailbox %s): the successor of %d is %d",
+ message->issuer_host_name.c_str(), message->answer_to->get_cname(), message->request_id,
+ message->answer_id);
+ message->answer_to->put_init(message, 10)->detach(ChordMessage::destroy);
+ } else {
+ // otherwise, forward the request to the closest preceding finger in my table
+ int closest = closestPrecedingFinger(message->request_id);
+ XBT_DEBUG("Forwarding the 'Find Successor' request for id %d to my closest preceding finger %d",
+ message->request_id, closest);
+ simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(closest));
+ mailbox->put_init(message, 10)->detach(ChordMessage::destroy);
+ }
+ break;
+
+ case MessageType::GET_PREDECESSOR:
+ XBT_DEBUG("Receiving a 'Get Predecessor' request from %s", message->issuer_host_name.c_str());
+ message->type = MessageType::GET_PREDECESSOR_ANSWER;
+ message->answer_id = pred_id_;
+ XBT_DEBUG("Sending back a 'Get Predecessor Answer' to %s via mailbox '%s': my predecessor is %d",
+ message->issuer_host_name.c_str(), message->answer_to->get_cname(), message->answer_id);
message->answer_to->put_init(message, 10)->detach(ChordMessage::destroy);
- } else {
- // otherwise, forward the request to the closest preceding finger in my table
- int closest = closestPrecedingFinger(message->request_id);
- XBT_DEBUG("Forwarding the 'Find Successor' request for id %d to my closest preceding finger %d",
- message->request_id, closest);
- simgrid::s4u::Mailbox* mailbox = simgrid::s4u::Mailbox::by_name(std::to_string(closest));
- mailbox->put_init(message, 10)->detach(ChordMessage::destroy);
- }
- break;
-
- case GET_PREDECESSOR:
- XBT_DEBUG("Receiving a 'Get Predecessor' request from %s", message->issuer_host_name.c_str());
- message->type = GET_PREDECESSOR_ANSWER;
- message->answer_id = pred_id_;
- XBT_DEBUG("Sending back a 'Get Predecessor Answer' to %s via mailbox '%s': my predecessor is %d",
- message->issuer_host_name.c_str(), message->answer_to->get_cname(), message->answer_id);
- message->answer_to->put_init(message, 10)->detach(ChordMessage::destroy);
- break;
-
- case NOTIFY:
- // someone is telling me that he may be my new predecessor
- XBT_DEBUG("Receiving a 'Notify' request from %s", message->issuer_host_name.c_str());
- notify(message->request_id);
- delete message;
- break;
+ break;
+
+ case MessageType::NOTIFY:
+ // someone is telling me that he may be my new predecessor
+ XBT_DEBUG("Receiving a 'Notify' request from %s", message->issuer_host_name.c_str());
+ notify(message->request_id);
+ delete message;
+ break;
+
+ case MessageType::PREDECESSOR_LEAVING:
+ // my predecessor is about to quit
+ XBT_DEBUG("Receiving a 'Predecessor Leaving' message from %s", message->issuer_host_name.c_str());
+ // modify my predecessor
+ setPredecessor(message->request_id);
+ delete message;
+ /*TODO :
+ >> notify my new predecessor
+ >> send a notify_predecessors !!
+ */
+ break;
+
+ case MessageType::SUCCESSOR_LEAVING:
+ // my successor is about to quit
+ XBT_DEBUG("Receiving a 'Successor Leaving' message from %s", message->issuer_host_name.c_str());
+ // modify my successor FIXME : this should be implicit ?
+ setFinger(0, message->request_id);
+ delete message;
+ /* TODO
+ >> notify my new successor
+ >> update my table & predecessors table */
+ break;
+
+ case MessageType::PREDECESSOR_ALIVE:
+ XBT_DEBUG("Receiving a 'Predecessor Alive' request from %s", message->issuer_host_name.c_str());
+ message->type = MessageType::PREDECESSOR_ALIVE_ANSWER;
+ XBT_DEBUG("Sending back a 'Predecessor Alive Answer' to %s (mailbox %s)", message->issuer_host_name.c_str(),
+ message->answer_to->get_cname());
+ message->answer_to->put_init(message, 10)->detach(ChordMessage::destroy);
+ break;
- case PREDECESSOR_LEAVING:
- // my predecessor is about to quit
- XBT_DEBUG("Receiving a 'Predecessor Leaving' message from %s", message->issuer_host_name.c_str());
- // modify my predecessor
- setPredecessor(message->request_id);
- delete message;
- /*TODO :
- >> notify my new predecessor
- >> send a notify_predecessors !!
- */
- break;
-
- case SUCCESSOR_LEAVING:
- // my successor is about to quit
- XBT_DEBUG("Receiving a 'Successor Leaving' message from %s", message->issuer_host_name.c_str());
- // modify my successor FIXME : this should be implicit ?
- setFinger(0, message->request_id);
- delete message;
- /* TODO
- >> notify my new successor
- >> update my table & predecessors table */
- break;
-
- case PREDECESSOR_ALIVE:
- XBT_DEBUG("Receiving a 'Predecessor Alive' request from %s", message->issuer_host_name.c_str());
- message->type = PREDECESSOR_ALIVE_ANSWER;
- XBT_DEBUG("Sending back a 'Predecessor Alive Answer' to %s (mailbox %s)", message->issuer_host_name.c_str(),
- message->answer_to->get_cname());
- message->answer_to->put_init(message, 10)->detach(ChordMessage::destroy);
- break;
-
- default:
- XBT_DEBUG("Ignoring unexpected message: %d from %s", message->type, message->issuer_host_name.c_str());
- delete message;
+ default:
+ XBT_DEBUG("Ignoring unexpected message: %d from %s", static_cast<int>(message->type),
+ message->issuer_host_name.c_str());
+ delete message;
}
}
extern int timeout;
/* Types of tasks exchanged between nodes. */
-enum e_message_type_t {
+enum class MessageType {
FIND_SUCCESSOR,
FIND_SUCCESSOR_ANSWER,
GET_PREDECESSOR,
class ChordMessage {
public:
- e_message_type_t type; // type of message
+ MessageType type; // type of message
std::string issuer_host_name = simgrid::s4u::this_actor::get_host()->get_name(); // used for logging
int request_id = -1; // id (used by some types of messages)
int request_finger = 1; // finger parameter (used by some types of messages)
int answer_id = -1; // answer (used by some types of messages)
simgrid::s4u::Mailbox* answer_to = nullptr; // mailbox to send an answer to (if any)
- explicit ChordMessage(e_message_type_t type) : type(type) {}
+ explicit ChordMessage(MessageType type) : type(type) {}
static void destroy(void* message);
};
class XBT_PUBLIC ImpossibleError : public std::logic_error {
public:
- explicit ImpossibleError(const std::string& arg) : std::logic_error(arg) {}
+ using std::logic_error::logic_error;
~ImpossibleError() override;
};
class XBT_PUBLIC InitializationError : public std::logic_error {
public:
- explicit InitializationError(const std::string& arg) : std::logic_error(arg) {}
+ using std::logic_error::logic_error;
~InitializationError() override;
};
class XBT_PUBLIC UnimplementedError : public std::logic_error {
public:
- explicit UnimplementedError(const std::string& arg) : std::logic_error(arg) {}
+ using std::logic_error::logic_error;
~UnimplementedError() override;
};
/** Ancestor class of all SimGrid exception */
class Exception : public std::runtime_error {
public:
- Exception(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
- : std::runtime_error(std::move(message)), throwpoint_(std::move(throwpoint))
+ Exception(const simgrid::xbt::ThrowPoint& throwpoint, const std::string& message)
+ : std::runtime_error(message), throwpoint_(throwpoint)
{
}
Exception(const Exception&) = default;
/** Exception raised when a timeout elapsed */
class TimeoutException : public Exception {
public:
- TimeoutException(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
- : Exception(std::move(throwpoint), std::move(message))
- {
- }
- TimeoutException(const TimeoutException&) = default;
- TimeoutException(TimeoutException&&) noexcept = default;
+ using Exception::Exception;
~TimeoutException() override;
};
/** Exception raised when a host fails */
class HostFailureException : public Exception {
public:
- HostFailureException(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
- : Exception(std::move(throwpoint), std::move(message))
- {
- }
- HostFailureException(const HostFailureException&) = default;
- HostFailureException(HostFailureException&&) noexcept = default;
+ using Exception::Exception;
~HostFailureException() override;
};
/** Exception raised when a communication fails because of the network or because of the remote host */
class NetworkFailureException : public Exception {
public:
- NetworkFailureException(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
- : Exception(std::move(throwpoint), std::move(message))
- {
- }
- NetworkFailureException(const NetworkFailureException&) = default;
- NetworkFailureException(NetworkFailureException&&) noexcept = default;
+ using Exception::Exception;
~NetworkFailureException() override;
};
/** Exception raised when a storage fails */
class StorageFailureException : public Exception {
public:
- StorageFailureException(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
- : Exception(std::move(throwpoint), std::move(message))
- {
- }
- StorageFailureException(const StorageFailureException&) = default;
- StorageFailureException(StorageFailureException&&) noexcept = default;
+ using Exception::Exception;
~StorageFailureException() override;
};
/** Exception raised when a VM fails */
class VmFailureException : public Exception {
public:
- VmFailureException(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
- : Exception(std::move(throwpoint), std::move(message))
- {
- }
- VmFailureException(const VmFailureException&) = default;
- VmFailureException(VmFailureException&&) noexcept = default;
+ using Exception::Exception;
~VmFailureException() override;
};
/** Exception raised when something got canceled before completion */
class CancelException : public Exception {
public:
- CancelException(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
- : Exception(std::move(throwpoint), std::move(message))
- {
- }
- CancelException(const CancelException&) = default;
- CancelException(CancelException&&) noexcept = default;
+ using Exception::Exception;
~CancelException() override;
};
/** Exception raised when something is going wrong during the simulation tracing */
class TracingError : public Exception {
public:
- TracingError(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
- : Exception(std::move(throwpoint), std::move(message))
- {
- }
- TracingError(const TracingError&) = default;
- TracingError(TracingError&&) noexcept = default;
+ using Exception::Exception;
~TracingError() override;
};
XBT_PUBLIC msg_vm_t MSG_vm_create_core(msg_host_t pm, const char* name);
XBT_PUBLIC msg_vm_t MSG_vm_create_multicore(msg_host_t pm, const char* name, int coreAmount);
-XBT_PUBLIC int MSG_vm_is_created(msg_vm_t vm);
-XBT_PUBLIC int MSG_vm_is_running(msg_vm_t vm);
-XBT_PUBLIC int MSG_vm_is_suspended(msg_vm_t vm);
+XBT_PUBLIC int MSG_vm_is_created(const_sg_vm_t vm);
+XBT_PUBLIC int MSG_vm_is_running(const_sg_vm_t vm);
+XBT_PUBLIC int MSG_vm_is_suspended(const_sg_vm_t vm);
XBT_PUBLIC const char* MSG_vm_get_name(const_sg_vm_t vm);
XBT_PUBLIC void MSG_vm_set_ramsize(msg_vm_t vm, size_t size);
template <class F> void register_actor(const std::string& name)
{
kernel::actor::ActorCodeFactory code_factory = [](std::vector<std::string> args) {
- return kernel::actor::ActorCode([args] {
+ return kernel::actor::ActorCode([args = std::move(args)]() mutable {
F code(std::move(args));
code();
});
};
- register_function(name, std::move(code_factory));
+ register_function(name, code_factory);
}
template <class F> void register_actor(const std::string& name, F code)
{
kernel::actor::ActorCodeFactory code_factory = [code](std::vector<std::string> args) {
- return kernel::actor::ActorCode([code, args] { code(std::move(args)); });
+ return kernel::actor::ActorCode([code, args = std::move(args)]() mutable { code(std::move(args)); });
};
- register_function(name, std::move(code_factory));
+ register_function(name, code_factory);
}
void load_deployment(const std::string& deploy) const;
class GatherAction : public ReplayAction<GatherArgParser> {
public:
- explicit GatherAction(const std::string& name) : ReplayAction(name) {}
+ using ReplayAction::ReplayAction;
void kernel(xbt::ReplayAction& action) override;
};
class GatherVAction : public ReplayAction<GatherVArgParser> {
public:
- explicit GatherVAction(const std::string& name) : ReplayAction(name) {}
+ using ReplayAction::ReplayAction;
void kernel(xbt::ReplayAction& action) override;
};
XBT_PUBLIC sg_vm_t sg_vm_create_core(sg_host_t pm, const char* name);
XBT_PUBLIC sg_vm_t sg_vm_create_multicore(sg_host_t pm, const char* name, int core_amount);
-XBT_PUBLIC int sg_vm_is_created(sg_vm_t vm);
-XBT_PUBLIC int sg_vm_is_running(sg_vm_t vm);
-XBT_PUBLIC int sg_vm_is_suspended(sg_vm_t vm);
+XBT_PUBLIC int sg_vm_is_created(const_sg_vm_t vm);
+XBT_PUBLIC int sg_vm_is_running(const_sg_vm_t vm);
+XBT_PUBLIC int sg_vm_is_suspended(const_sg_vm_t vm);
XBT_PUBLIC const char* sg_vm_get_name(const_sg_vm_t vm);
XBT_PUBLIC void sg_vm_set_ramsize(sg_vm_t vm, size_t size);
void bind_flag(T& value, const char* name, std::initializer_list<const char*> aliases, const char* description)
{
bind_flag(value, name, description);
- alias(name, std::move(aliases));
+ alias(name, aliases);
}
/** Bind a variable to configuration flag
bind_flag(T& value, const char* name, std::initializer_list<const char*> aliases, const char* description, F callback)
{
bind_flag(value, name, description, std::move(callback));
- alias(name, std::move(aliases));
+ alias(name, aliases);
}
template <class T, class F>
const std::map<T, std::string>& valid_values, F callback)
{
bind_flag(value, name, description, valid_values, std::move(callback));
- alias(name, std::move(aliases));
+ alias(name, aliases);
}
/** Bind a variable to configuration flag
Flag(const char* name, std::initializer_list<const char*> aliases, const char* desc, T value)
: value_(value), name_(name)
{
- simgrid::config::bind_flag(value_, name, std::move(aliases), desc);
+ simgrid::config::bind_flag(value_, name, aliases, desc);
}
/* A constructor accepting a callback that will be passed the parameter.
Flag(const char* name, std::initializer_list<const char*> aliases, const char* desc, T value, F callback)
: value_(value), name_(name)
{
- simgrid::config::bind_flag(value_, name, std::move(aliases), desc, std::move(callback));
+ simgrid::config::bind_flag(value_, name, aliases, desc, std::move(callback));
}
/* A constructor accepting a map of valid values -> their description,
const std::map<T, std::string>& valid_values, F callback)
: value_(value), name_(name)
{
- simgrid::config::bind_flag(value_, name, std::move(aliases), desc, valid_values, std::move(callback));
+ simgrid::config::bind_flag(value_, name, aliases, desc, valid_values, std::move(callback));
}
// No copy:
*/
class XBT_PUBLIC StdRandom : public Random {
public:
- StdRandom() = default;
- explicit StdRandom(int seed) : Random(seed) {}
+ using Random::Random;
int uniform_int(int min, int max) override;
double uniform_real(double min, double max) override;
*/
class XBT_PUBLIC XbtRandom : public Random {
public:
- XbtRandom() = default;
- explicit XbtRandom(int seed) : Random(seed) {}
+ using Random::Random;
int uniform_int(int min, int max) override;
double uniform_real(double min, double max) override;
string() : string(&NUL, 0) {}
explicit string(const char* s) : string(s, strlen(s)) {}
string(string const& s) : string(s.c_str(), s.size()) {}
- string(string&& s) noexcept : str(std::move(s.str))
+ string(string&& s) noexcept : str(s.str)
{
s.str.len = 0;
s.str.data = &NUL;
JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_VM_isCreated(JNIEnv* env, jobject jvm)
{
- sg_vm_t vm = jvm_get_native(env, jvm);
+ const_sg_vm_t vm = jvm_get_native(env, jvm);
return sg_vm_is_created(vm);
}
JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_VM_isRunning(JNIEnv* env, jobject jvm)
{
- sg_vm_t vm = jvm_get_native(env, jvm);
+ const_sg_vm_t vm = jvm_get_native(env, jvm);
return sg_vm_is_running(vm);
}
JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_VM_isSuspended(JNIEnv* env, jobject jvm)
{
- sg_vm_t vm = jvm_get_native(env, jvm);
+ const_sg_vm_t vm = jvm_get_native(env, jvm);
return sg_vm_is_suspended(vm);
}
*************/
xbt::signal<void(Container const&)> Container::on_creation;
xbt::signal<void(Container const&)> Container::on_destruction;
-xbt::signal<void(Type const&, e_event_type)> Type::on_creation;
+xbt::signal<void(Type const&, PajeEventType)> Type::on_creation;
xbt::signal<void(LinkType const&, Type const&, Type const&)> LinkType::on_creation;
xbt::signal<void(PajeEvent&)> PajeEvent::on_creation;
xbt::signal<void(PajeEvent const&)> PajeEvent::on_destruction;
double timestamp = SIMIX_get_clock();
std::stringstream stream;
- XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_CreateContainer, timestamp);
+ XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, static_cast<unsigned>(PajeEventType::CreateContainer),
+ timestamp);
- stream << std::fixed << std::setprecision(trace_precision) << PAJE_CreateContainer << " ";
+ stream << std::fixed << std::setprecision(trace_precision) << PajeEventType::CreateContainer << " ";
stream << timestamp << " " << c.get_id() << " " << c.type_->get_id() << " " << c.father_->get_id() << " \"";
if (c.get_name().find("rank-") != 0)
stream << c.get_name() << "\"";
std::stringstream stream;
double timestamp = SIMIX_get_clock();
- XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_DestroyContainer, timestamp);
+ XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, static_cast<unsigned>(PajeEventType::DestroyContainer),
+ timestamp);
- stream << std::fixed << std::setprecision(trace_precision) << PAJE_DestroyContainer << " ";
+ stream << std::fixed << std::setprecision(trace_precision) << PajeEventType::DestroyContainer << " ";
stream << timestamp << " " << c.type_->get_id() << " " << c.get_id();
XBT_DEBUG("Dump %s", stream.str().c_str());
tracing_file << stream.str() << std::endl;
static void on_container_creation_ti(const Container& c)
{
- XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_CreateContainer, SIMIX_get_clock());
+ XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, static_cast<unsigned>(PajeEventType::CreateContainer),
+ SIMIX_get_clock());
// if we are in the mode with only one file
static std::ofstream* ti_unique_file = nullptr;
static void on_entity_value_creation(const EntityValue& value)
{
std::stringstream stream;
- XBT_DEBUG("%s: event_type=%u", __func__, PAJE_DefineEntityValue);
- stream << std::fixed << std::setprecision(trace_precision) << PAJE_DefineEntityValue;
+ XBT_DEBUG("%s: event_type=%u", __func__, static_cast<unsigned>(PajeEventType::DefineEntityValue));
+ stream << std::fixed << std::setprecision(trace_precision) << PajeEventType::DefineEntityValue;
stream << " " << value.get_id() << " " << value.get_father()->get_id() << " " << value.get_name();
if (not value.get_color().empty())
stream << " \"" << value.get_color() << "\"";
static void on_event_creation(PajeEvent& event)
{
- XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, event.eventType_, trace_precision, event.timestamp_);
+ XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, static_cast<unsigned>(event.eventType_), trace_precision,
+ event.timestamp_);
event.stream_ << std::fixed << std::setprecision(trace_precision);
event.stream_ << event.eventType_ << " " << event.timestamp_ << " ";
event.stream_ << event.get_type()->get_id() << " " << event.get_container()->get_id();
*tracing_files.at(event.get_container()) << event.stream_.str() << std::endl;
}
-static void on_type_creation(const Type& type, e_event_type event_type)
+static void on_type_creation(const Type& type, PajeEventType event_type)
{
- if (event_type == PAJE_DefineLinkType)
+ if (event_type == PajeEventType::DefineLinkType)
return; // this kind of type has to be handled differently
std::stringstream stream;
stream << std::fixed << std::setprecision(trace_precision);
- XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, event_type, trace_precision, 0.);
+ XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, static_cast<unsigned>(event_type), trace_precision, 0.);
stream << event_type << " " << type.get_id() << " " << type.get_father()->get_id() << " " << type.get_name();
if (type.is_colored())
stream << " \"" << type.get_color() << "\"";
static void on_link_type_creation(const Type& type, const Type& source, const Type& dest)
{
std::stringstream stream;
- XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, PAJE_DefineLinkType, trace_precision, 0.);
- stream << PAJE_DefineLinkType << " " << type.get_id() << " " << type.get_father()->get_id();
+ XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, static_cast<unsigned>(PajeEventType::DefineLinkType),
+ trace_precision, 0.);
+ stream << PajeEventType::DefineLinkType << " " << type.get_id() << " " << type.get_father()->get_id();
stream << " " << source.get_id() << " " << dest.get_id() << " " << type.get_name();
XBT_DEBUG("Dump %s", stream.str().c_str());
tracing_file << stream.str() << std::endl;
namespace simgrid {
namespace instr {
-PajeEvent::PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
+PajeEvent::PajeEvent(Container* container, Type* type, double timestamp, PajeEventType eventType)
: container_(container), type_(type), timestamp_(timestamp), eventType_(eventType)
{
on_creation(*this);
on_destruction(*this);
}
-StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra)
+StateEvent::StateEvent(Container* container, Type* type, PajeEventType event_type, EntityValue* value, TIData* extra)
: PajeEvent::PajeEvent(container, type, SIMIX_get_clock(), event_type), value(value), extra_(extra)
{
#if HAVE_SMPI
void StateEvent::print()
{
if (trace_format == TraceFormat::Paje) {
- if (value != nullptr) // PAJE_PopState Event does not need to have a value
+ if (value != nullptr) // PajeEventType::PopState Event does not need to have a value
stream_ << " " << value->get_id();
if (TRACE_display_sizes())
class EntityValue;
class TIData;
-enum e_event_type : unsigned int {
- PAJE_DefineContainerType,
- PAJE_DefineVariableType,
- PAJE_DefineStateType,
- PAJE_DefineEventType,
- PAJE_DefineLinkType,
- PAJE_DefineEntityValue,
- PAJE_CreateContainer,
- PAJE_DestroyContainer,
- PAJE_SetVariable,
- PAJE_AddVariable,
- PAJE_SubVariable,
- PAJE_SetState,
- PAJE_PushState,
- PAJE_PopState,
- PAJE_ResetState,
- PAJE_StartLink,
- PAJE_EndLink,
- PAJE_NewEvent
+enum class PajeEventType : unsigned int {
+ DefineContainerType,
+ DefineVariableType,
+ DefineStateType,
+ DefineEventType,
+ DefineLinkType,
+ DefineEntityValue,
+ CreateContainer,
+ DestroyContainer,
+ SetVariable,
+ AddVariable,
+ SubVariable,
+ SetState,
+ PushState,
+ PopState,
+ ResetState,
+ StartLink,
+ EndLink,
+ NewEvent
};
+inline std::ostream& operator<<(std::ostream& os, PajeEventType event)
+{
+ return os << static_cast<std::underlying_type<PajeEventType>::type>(event);
+}
+
class PajeEvent {
Container* container_;
Type* type_;
static xbt::signal<void(PajeEvent const&)> on_destruction;
double timestamp_;
- e_event_type eventType_;
+ PajeEventType eventType_;
std::stringstream stream_;
- PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType);
+ PajeEvent(Container* container, Type* type, double timestamp, PajeEventType eventType);
virtual ~PajeEvent();
Container* get_container() const { return container_; }
double value_;
public:
- VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value)
+ VariableEvent(double timestamp, Container* container, Type* type, PajeEventType event_type, double value)
: PajeEvent::PajeEvent(container, type, timestamp, event_type), value_(value)
{
}
public:
static xbt::signal<void(StateEvent const&)> on_destruction;
- StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra);
+ StateEvent(Container* container, Type* type, PajeEventType event_type, EntityValue* value, TIData* extra);
~StateEvent() override { on_destruction(*this); }
bool has_extra() const { return extra_ != nullptr; }
void print() override;
int size_ = -1;
public:
- LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
+ LinkEvent(Container* container, Type* type, PajeEventType event_type, Container* sourceContainer,
const std::string& value, const std::string& key, int size)
: PajeEvent(container, type, SIMIX_get_clock(), event_type)
, endpoint_(sourceContainer)
public:
NewEvent(double timestamp, Container* container, Type* type, EntityValue* value)
- : PajeEvent::PajeEvent(container, type, timestamp, PAJE_NewEvent), value(value)
+ : PajeEvent::PajeEvent(container, type, timestamp, PajeEventType::NewEvent), value(value)
{
}
void print() override;
void dump_header(bool basic, bool display_sizes)
{
// Types
- tracing_file << "%EventDef PajeDefineContainerType " << PAJE_DefineContainerType << std::endl;
+ tracing_file << "%EventDef PajeDefineContainerType " << PajeEventType::DefineContainerType << std::endl;
tracing_file << "% Alias string" << std::endl;
if (basic)
tracing_file << "% ContainerType string" << std::endl;
tracing_file << "% Name string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajeDefineVariableType " << PAJE_DefineVariableType << std::endl;
+ tracing_file << "%EventDef PajeDefineVariableType " << PajeEventType::DefineVariableType << std::endl;
tracing_file << "% Alias string" << std::endl;
tracing_file << "% " << (basic ? "Container" : "") << "Type string" << std::endl;
tracing_file << "% Name string" << std::endl;
tracing_file << "% Color color" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajeDefineStateType " << PAJE_DefineStateType << std::endl;
+ tracing_file << "%EventDef PajeDefineStateType " << PajeEventType::DefineStateType << std::endl;
tracing_file << "% Alias string" << std::endl;
tracing_file << "% " << (basic ? "Container" : "") << "Type string" << std::endl;
tracing_file << "% Name string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajeDefineEventType " << PAJE_DefineEventType << std::endl;
+ tracing_file << "%EventDef PajeDefineEventType " << PajeEventType::DefineEventType << std::endl;
tracing_file << "% Alias string" << std::endl;
tracing_file << "% " << (basic ? "Container" : "") << "Type string" << std::endl;
tracing_file << "% Name string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajeDefineLinkType " << PAJE_DefineLinkType << std::endl;
+ tracing_file << "%EventDef PajeDefineLinkType " << PajeEventType::DefineLinkType << std::endl;
tracing_file << "% Alias string" << std::endl;
tracing_file << "% " << (basic ? "Container" : "") << "Type string" << std::endl;
tracing_file << "% " << (basic ? "Source" : "Start") << "ContainerType string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
// EntityValue
- tracing_file << "%EventDef PajeDefineEntityValue " << PAJE_DefineEntityValue << std::endl;
+ tracing_file << "%EventDef PajeDefineEntityValue " << PajeEventType::DefineEntityValue << std::endl;
tracing_file << "% Alias string" << std::endl;
tracing_file << "% " << (basic ? "Entity" : "") << "Type string" << std::endl;
tracing_file << "% Name string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
// Container
- tracing_file << "%EventDef PajeCreateContainer " << PAJE_CreateContainer << std::endl;
+ tracing_file << "%EventDef PajeCreateContainer " << PajeEventType::CreateContainer << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Alias string" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Name string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajeDestroyContainer " << PAJE_DestroyContainer << std::endl;
+ tracing_file << "%EventDef PajeDestroyContainer " << PajeEventType::DestroyContainer << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Name string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
// Variable
- tracing_file << "%EventDef PajeSetVariable " << PAJE_SetVariable << std::endl;
+ tracing_file << "%EventDef PajeSetVariable " << PajeEventType::SetVariable << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
tracing_file << "% Value double" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajeAddVariable " << PAJE_AddVariable << std::endl;
+ tracing_file << "%EventDef PajeAddVariable " << PajeEventType::AddVariable << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
tracing_file << "% Value double" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajeSubVariable " << PAJE_SubVariable << std::endl;
+ tracing_file << "%EventDef PajeSubVariable " << PajeEventType::SubVariable << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
// State
- tracing_file << "%EventDef PajeSetState " << PAJE_SetState << std::endl;
+ tracing_file << "%EventDef PajeSetState " << PajeEventType::SetState << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
tracing_file << "% Value string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajePushState " << PAJE_PushState << std::endl;
+ tracing_file << "%EventDef PajePushState " << PajeEventType::PushState << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
#endif
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajePopState " << PAJE_PopState << std::endl;
+ tracing_file << "%EventDef PajePopState " << PajeEventType::PopState << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
if (not basic) {
- tracing_file << "%EventDef PajeResetState " << PAJE_ResetState << std::endl;
+ tracing_file << "%EventDef PajeResetState " << PajeEventType::ResetState << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
}
// Link
- tracing_file << "%EventDef PajeStartLink " << PAJE_StartLink << std::endl;
+ tracing_file << "%EventDef PajeStartLink " << PajeEventType::StartLink << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
tracing_file << "% Size int" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
- tracing_file << "%EventDef PajeEndLink " << PAJE_EndLink << std::endl;
+ tracing_file << "%EventDef PajeEndLink " << PajeEventType::EndLink << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
tracing_file << "%EndEventDef" << std::endl;
// Event
- tracing_file << "%EventDef PajeNewEvent " << PAJE_NewEvent << std::endl;
+ tracing_file << "%EventDef PajeNewEvent " << PajeEventType::NewEvent << std::endl;
tracing_file << "% Time date" << std::endl;
tracing_file << "% Type string" << std::endl;
tracing_file << "% Container string" << std::endl;
/* internal do the instrumentation module */
void PajeEvent::insert_into_buffer()
{
- XBT_DEBUG("%s: insert event_type=%u, timestamp=%f, buffersize=%zu)", __func__, eventType_, timestamp_, buffer.size());
+ XBT_DEBUG("%s: insert event_type=%u, timestamp=%f, buffersize=%zu)", __func__, static_cast<unsigned>(eventType_),
+ timestamp_, buffer.size());
std::vector<PajeEvent*>::reverse_iterator i;
for (i = buffer.rbegin(); i != buffer.rend(); ++i) {
PajeEvent* e1 = *i;
- XBT_DEBUG("compare to %p is of type %u; timestamp:%f", e1, e1->eventType_, e1->timestamp_);
+ XBT_DEBUG("compare to %p is of type %u; timestamp:%f", e1, static_cast<unsigned>(e1->eventType_), e1->timestamp_);
if (e1->timestamp_ <= timestamp_)
break;
}
return type_id++;
}
-Type::Type(e_event_type event_type, const std::string& name, const std::string& alias, const std::string& color,
+Type::Type(PajeEventType event_type, const std::string& name, const std::string& alias, const std::string& color,
Type* father)
: name_(name), color_(color), father_(father)
{
void StateType::set_event(const std::string& value_name)
{
- events_.push_back(new StateEvent(get_issuer(), this, PAJE_SetState, get_entity_value(value_name), nullptr));
+ events_.push_back(new StateEvent(get_issuer(), this, PajeEventType::SetState, get_entity_value(value_name), nullptr));
}
void StateType::push_event(const std::string& value_name, TIData* extra)
{
- events_.push_back(new StateEvent(get_issuer(), this, PAJE_PushState, get_entity_value(value_name), extra));
+ events_.push_back(new StateEvent(get_issuer(), this, PajeEventType::PushState, get_entity_value(value_name), extra));
}
void StateType::push_event(const std::string& value_name)
{
- events_.push_back(new StateEvent(get_issuer(), this, PAJE_PushState, get_entity_value(value_name), nullptr));
+ events_.push_back(
+ new StateEvent(get_issuer(), this, PajeEventType::PushState, get_entity_value(value_name), nullptr));
}
void StateType::pop_event()
void StateType::pop_event(TIData* extra)
{
- events_.push_back(new StateEvent(get_issuer(), this, PAJE_PopState, nullptr, extra));
+ events_.push_back(new StateEvent(get_issuer(), this, PajeEventType::PopState, nullptr, extra));
}
void VariableType::instr_event(double now, double delta, const char* resource, double value)
void VariableType::set_event(double timestamp, double value)
{
- events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PAJE_SetVariable, value));
+ events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PajeEventType::SetVariable, value));
}
void VariableType::add_event(double timestamp, double value)
{
- events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PAJE_AddVariable, value));
+ events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PajeEventType::AddVariable, value));
}
void VariableType::sub_event(double timestamp, double value)
{
- events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PAJE_SubVariable, value));
+ events_.push_back(new VariableEvent(timestamp, get_issuer(), this, PajeEventType::SubVariable, value));
}
void LinkType::start_event(Container* startContainer, const std::string& value, const std::string& key)
void LinkType::start_event(Container* startContainer, const std::string& value, const std::string& key, int size)
{
- new LinkEvent(get_issuer(), this, PAJE_StartLink, startContainer, value, key, size);
+ new LinkEvent(get_issuer(), this, PajeEventType::StartLink, startContainer, value, key, size);
}
void LinkType::end_event(Container* endContainer, const std::string& value, const std::string& key)
{
- new LinkEvent(get_issuer(), this, PAJE_EndLink, endContainer, value, key, -1);
+ new LinkEvent(get_issuer(), this, PajeEventType::EndLink, endContainer, value, key, -1);
}
Type* Type::by_name(const std::string& name)
Container* get_issuer() const { return issuer_; }
public:
- static xbt::signal<void(Type const&, e_event_type event_type)> on_creation;
+ static xbt::signal<void(Type const&, PajeEventType event_type)> on_creation;
- Type(e_event_type event_type, const std::string& name, const std::string& alias, const std::string& color,
+ Type(PajeEventType event_type, const std::string& name, const std::string& alias, const std::string& color,
Type* father);
virtual ~Type() = default;
class ContainerType : public Type {
public:
- explicit ContainerType(const std::string& name) : Type(PAJE_DefineContainerType, name, name, "", nullptr){};
- ContainerType(const std::string& name, Type* father) : Type(PAJE_DefineContainerType, name, name, "", father){};
+ explicit ContainerType(const std::string& name) : Type(PajeEventType::DefineContainerType, name, name, "", nullptr){};
+ ContainerType(const std::string& name, Type* father)
+ : Type(PajeEventType::DefineContainerType, name, name, "", father){};
};
class VariableType : public Type {
std::vector<VariableEvent*> events_;
public:
VariableType(const std::string& name, const std::string& color, Type* father)
- : Type(PAJE_DefineVariableType, name, name, color, father)
+ : Type(PajeEventType::DefineVariableType, name, name, color, father)
{
}
void instr_event(double now, double delta, const char* resource, double value);
class ValueType : public Type {
public:
std::map<std::string, EntityValue> values_;
- ValueType(e_event_type event_type, const std::string& name, const std::string& alias, Type* father)
+ ValueType(PajeEventType event_type, const std::string& name, const std::string& alias, Type* father)
: Type(event_type, name, alias, "", father){};
- ValueType(e_event_type event_type, const std::string& name, Type* father)
+ ValueType(PajeEventType event_type, const std::string& name, Type* father)
: Type(event_type, name, name, "", father){};
~ValueType() override = default;
void add_entity_value(const std::string& name, const std::string& color);
public:
static xbt::signal<void(LinkType const&, Type const&, Type const&)> on_creation;
LinkType(const std::string& name, const Type* source, const Type* dest, const std::string& alias, Type* father)
- : ValueType(PAJE_DefineLinkType, name, alias, father)
+ : ValueType(PajeEventType::DefineLinkType, name, alias, father)
{
on_creation(*this, *source, *dest);
}
class EventType : public ValueType {
public:
- EventType(const std::string& name, Type* father) : ValueType(PAJE_DefineEventType, name, father) {}
+ EventType(const std::string& name, Type* father) : ValueType(PajeEventType::DefineEventType, name, father) {}
};
class StateType : public ValueType {
std::vector<StateEvent*> events_;
public:
- StateType(const std::string& name, Type* father) : ValueType(PAJE_DefineStateType, name, father) {}
+ StateType(const std::string& name, Type* father) : ValueType(PajeEventType::DefineStateType, name, father) {}
void set_event(const std::string& value_name);
void push_event(const std::string& value_name);
void push_event(const std::string& value_name, TIData* extra);
simgrid::jedule::Event event(std::string(SD_task_get_name(task)), SD_task_get_start_time(task),
SD_task_get_finish_time(task), "SD");
event.add_resources(*task->allocation);
- my_jedule->add_event(std::move(event));
+ my_jedule->add_event(event);
}
void jedule_sd_init()
context::Context::self()->get_actor()->kill(this);
// start the new actor
- ActorImplPtr actor =
- ActorImpl::create(arg.name, std::move(arg.code), arg.data, arg.host, arg.properties.get(), nullptr);
+ ActorImplPtr actor = ActorImpl::create(arg.name, arg.code, arg.data, arg.host, arg.properties.get(), nullptr);
*actor->on_exit = std::move(*arg.on_exit);
actor->set_kill_time(arg.kill_time);
actor->set_auto_restart(arg.auto_restart);
class XBT_PUBLIC FairBottleneck : public System {
public:
- explicit FairBottleneck(bool selective_update) : System(selective_update) {}
+ using System::System;
void solve() final { bottleneck_solve(); }
private:
linkTemplate.bandwidths.push_back(this->bw_ * numlinks);
linkTemplate.latency = this->lat_;
linkTemplate.policy = this->sharing_policy_;
- linkTemplate.id = std::move(id);
+ linkTemplate.id = id;
sg_platf_new_link(&linkTemplate);
XBT_DEBUG("Generating link %s", linkTemplate.id.c_str());
resource::LinkImpl* link;
/** When an error happens in the execution of a DWARF expression */
class evaluation_error : public std::runtime_error {
public:
- explicit evaluation_error(const char* what) : std::runtime_error(what) {}
+ using std::runtime_error::runtime_error;
};
/** A stack for evaluating a DWARF expression
void RemoteSimulation::ignore_heap(IgnoredHeapRegion const& region)
{
if (ignored_heap_.empty()) {
- ignored_heap_.push_back(std::move(region));
+ ignored_heap_.push_back(region);
return;
}
auto* region = new Region(type, start_addr, size);
region->object_info(object_info);
- snapshot_regions_.push_back(std::unique_ptr<Region>(std::move(region)));
+ snapshot_regions_.push_back(std::unique_ptr<Region>(region));
}
void* Snapshot::read_bytes(void* buffer, std::size_t size, RemotePtr<void> address, ReadOptions options) const
INFO("Could not allocate destination memory");
REQUIRE(source != MAP_FAILED);
- return {.size = byte_size,
- .src = source,
- .dstn = destination,
- .region0 = std::move(region0),
- .region = std::move(region)};
+ return {.size = byte_size, .src = source, .dstn = destination, .region0 = region0, .region = region};
}
void snap_test_helper::read_whole_region()
{
return sg_vm_create_multicore(pm, name, coreAmount);
}
-int MSG_vm_is_created(sg_vm_t vm)
+int MSG_vm_is_created(const_sg_vm_t vm)
{
return sg_vm_is_created(vm);
}
-int MSG_vm_is_running(sg_vm_t vm)
+int MSG_vm_is_running(const_sg_vm_t vm)
{
return sg_vm_is_running(vm);
}
-int MSG_vm_is_suspended(sg_vm_t vm)
+int MSG_vm_is_suspended(const_sg_vm_t vm)
{
return sg_vm_is_suspended(vm);
}
*/
class Performance : public Governor {
public:
- explicit Performance(simgrid::s4u::Host* ptr) : Governor(ptr) {}
+ using Governor::Governor;
std::string get_name() const override { return "Performance"; }
void update() override { get_host()->set_pstate(get_min_pstate()); }
*/
class Powersave : public Governor {
public:
- explicit Powersave(simgrid::s4u::Host* ptr) : Governor(ptr) {}
+ using Governor::Governor;
std::string get_name() const override { return "Powersave"; }
void update() override { get_host()->set_pstate(get_max_pstate()); }
double freq_up_threshold_ = 0.80;
public:
- explicit OnDemand(simgrid::s4u::Host* ptr) : Governor(ptr) {}
+ using Governor::Governor;
std::string get_name() const override { return "OnDemand"; }
void update() override
double freq_down_threshold_ = .2;
public:
- explicit Conservative(simgrid::s4u::Host* ptr) : Governor(ptr) {}
+ using Governor::Governor;
std::string get_name() const override { return "Conservative"; }
void update() override
}
/** @brief Returns whether the given VM has just created, not running. */
-int sg_vm_is_created(sg_vm_t vm)
+int sg_vm_is_created(const_sg_vm_t vm)
{
return vm->get_state() == simgrid::s4u::VirtualMachine::state::CREATED;
}
/** @brief Returns whether the given VM is currently running */
-int sg_vm_is_running(sg_vm_t vm)
+int sg_vm_is_running(const_sg_vm_t vm)
{
return vm->get_state() == simgrid::s4u::VirtualMachine::state::RUNNING;
}
/** @brief Returns whether the given VM is currently suspended, not running. */
-int sg_vm_is_suspended(sg_vm_t vm)
+int sg_vm_is_suspended(const_sg_vm_t vm)
{
return vm->get_state() == simgrid::s4u::VirtualMachine::state::SUSPENDED;
}
simgrid::kernel::actor::ActorCode function;
if (code)
function = simgrid::xbt::wrap_main(code, argc, argv);
- actor->start(std::move(function));
+ actor->start(function);
}
sg_actor_t sg_actor_create(const char* name, sg_host_t host, xbt_main_func_t code, int argc, const char* const* argv)
{
simgrid::kernel::actor::ActorCode function = simgrid::xbt::wrap_main(code, argc, argv);
- return simgrid::s4u::Actor::init(name, host)->start(std::move(function)).get();
+ return simgrid::s4u::Actor::init(name, host)->start(function).get();
}
void sg_actor_set_stacksize(sg_actor_t actor, unsigned size)
kernel::actor::ActorCodeFactory code_factory = [code](std::vector<std::string> args) {
return xbt::wrap_main(code, std::move(args));
};
- register_function(name, std::move(code_factory));
+ register_function(name, code_factory);
}
void Engine::register_default(int (*code)(int, char**)) // XBT_ATTRIB_DEPRECATED_v329
{
kernel::actor::ActorCodeFactory code_factory = [code](std::vector<std::string> args) {
return xbt::wrap_main(code, std::move(args));
};
- register_function(name, std::move(code_factory));
+ register_function(name, code_factory);
}
/** Registers the main function of an actor that will be launched from the deployment file */
void Engine::register_function(const std::string& name, const std::function<void(std::vector<std::string>)>& code)
{
- kernel::actor::ActorCodeFactory code_factory = [code](std::vector<std::string> args) {
+ kernel::actor::ActorCodeFactory code_factory = [code{code}](std::vector<std::string> args) mutable {
return std::bind(std::move(code), std::move(args));
};
- register_function(name, std::move(code_factory));
+ register_function(name, code_factory);
}
/** Registers a function as the default main function of actors
*
// load the library once to add it to the local libs, to get the absolute path
void* libhandle = dlopen(libname.c_str(), RTLD_LAZY);
xbt_assert(libhandle != nullptr,
- "Cannot dlopen %s - check your settings in smpi/privatize-libs", libname.c_str());
+ "Cannot dlopen %s - check your settings in smpi/privatize-libs", libname.c_str());
// get library name from path
std::string fullpath = libname;
#if not defined(__APPLE__) && not defined(__HAIKU__)
target_libs.push_back(target_lib);
XBT_DEBUG("copy lib %s to %s, with size %lld", libpath.c_str(), target_lib.c_str(), (long long)fdin_size2);
smpi_copy_file(libpath, target_lib, fdin_size2);
- void* handle = dlopen(target_lib.c_str(), RTLD_LAZY | RTLD_LOCAL | WANT_RTLD_DEEPBIND);
- xbt_assert(handle != nullptr, "dlopen of library %s failed: %s (errno: %d -- %s)", target_lib.c_str(),
- dlerror(), errno, strerror(errno));
+
+ std::string sedcommand = "sed -i -e 's/" + libname + "/" + target_lib + "/g' " + target_executable;
+ int status = system(sedcommand.c_str());
+ xbt_assert(status == 0, "error while applying sed command %s \n", sedcommand.c_str());
}
}
void HostImpl::set_disks(const std::vector<kernel::resource::DiskImpl*>& disks, s4u::Host* host)
{
- disks_ = std::move(disks);
+ disks_ = disks;
for (auto d : disks_)
d->set_host(host);
}
*/
class XBT_PUBLIC CpuModel : public Model {
public:
- explicit CpuModel(Model::UpdateAlgo algo) : Model(algo) {}
+ using Model::Model;
/**
* @brief Create a Cpu
*/
static xbt::signal<void(CpuAction const&, Action::State)> on_state_change;
- CpuAction(Model* model, double cost, bool failed) : Action(model, cost, failed) {}
- CpuAction(Model* model, double cost, bool failed, lmm::Variable* var) : Action(model, cost, failed, var) {}
+ using Action::Action;
void set_state(Action::State state) override;
friend Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double size, double rate);
public:
- NetworkCm02Action(Model* model, s4u::Host& src, s4u::Host& dst, double cost, bool failed)
- : NetworkAction(model, src, dst, cost, failed){};
+ using NetworkAction::NetworkAction;
~NetworkCm02Action() override = default;
void update_remains_lazy(double now) override;
};
static config::Flag<double> cfg_tcp_gamma;
static config::Flag<bool> cfg_crosstraffic;
- explicit NetworkModel(Model::UpdateAlgo algo) : Model(algo) {}
+ using Model::Model;
NetworkModel(const NetworkModel&) = delete;
NetworkModel& operator=(const NetworkModel&) = delete;
~NetworkModel() override;
XBT_DEBUG("Process %s@%s will be started at time %f", arg->name.c_str(), arg->host->get_cname(), start_time);
simgrid::simix::Timer::set(start_time, [arg, auto_restart]() {
simgrid::kernel::actor::ActorImplPtr new_actor = simgrid::kernel::actor::ActorImpl::create(
- arg->name.c_str(), std::move(arg->code), arg->data, arg->host, arg->properties.get(), nullptr);
+ arg->name.c_str(), arg->code, arg->data, arg->host, arg->properties.get(), nullptr);
if (arg->kill_time >= 0)
new_actor->set_kill_time(arg->kill_time);
if (auto_restart)
try {
simgrid::kernel::actor::ActorImplPtr new_actor = nullptr;
- new_actor = simgrid::kernel::actor::ActorImpl::create(arg->name.c_str(), std::move(code), nullptr, host,
+ new_actor = simgrid::kernel::actor::ActorImpl::create(arg->name.c_str(), code, nullptr, host,
arg->properties.get(), nullptr);
/* The actor creation will fail if the host is currently dead, but that's fine */
if (arg->kill_time >= 0)
break;
}
}
- surf_parse_error(std::move(msg));
+ surf_parse_error(msg);
}
double surf_parse_get_double(const std::string& s)
for (std::string key : keys) {
if (simgrid::config::is_default(key.c_str())) {
std::string cfg = key + ":" + current_property_set->at(key);
- simgrid::config::set_parse(std::move(cfg));
+ simgrid::config::set_parse(cfg);
} else
XBT_INFO("The custom configuration '%s' is already defined by user!", key.c_str());
}
XBT_LOG_NEW_DEFAULT_CATEGORY(random_bug, "For this example");
-enum { ABORT, ASSERT, PRINTF } behavior;
+enum class Behavior { ABORT, ASSERT, PRINTF };
+
+Behavior behavior;
/** A fake application with a bug occurring for some random values */
static void app()
int x = MC_random(0, 5);
int y = MC_random(0, 5);
- if (behavior == ASSERT) {
+ if (behavior == Behavior::ASSERT) {
MC_assert(x != 3 || y != 4);
- } else if (behavior == PRINTF) {
+ } else if (behavior == Behavior::PRINTF) {
if (x == 3 && y == 4)
XBT_ERROR("Error reached");
- } else { // behavior == ABORT
+ } else { // behavior == Behavior::ABORT
abort();
}
}
xbt_assert(argc == 3, "Usage: random-bug raise|assert <platformfile>");
if (strcmp(argv[1], "abort") == 0) {
XBT_INFO("Behavior: abort");
- behavior = ABORT;
+ behavior = Behavior::ABORT;
} else if (strcmp(argv[1], "assert") == 0) {
XBT_INFO("Behavior: assert");
- behavior = ASSERT;
+ behavior = Behavior::ASSERT;
} else if (strcmp(argv[1], "printf") == 0) {
XBT_INFO("Behavior: printf");
- behavior = PRINTF;
+ behavior = Behavior::PRINTF;
} else {
xbt_die("Please use either 'abort', 'assert' or 'printf' as first parameter, to specify what to do when the error "
"is found.");
static void run_test_process(const std::string& name, simgrid::s4u::Host* location, int size)
{
std::vector<std::string> arg = {std::to_string(size)};
- simgrid::s4u::Actor::create(std::move(name), location, computation_fun, arg);
+ simgrid::s4u::Actor::create(name, location, computation_fun, arg);
}
static void test_energy_consumption(const std::string& name, int nb_cores)
set(warnCFLAGS "${warnCFLAGS} -Wclobbered -Wno-error=clobbered -Wno-unused-local-typedefs -Wno-error=attributes -Wno-error=maybe-uninitialized")
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Intel")
- # ignore remark #1418: external function definition with no prior declaration
+ # ignore remarks:
+ # 191: type qualifier is meaningless on cast type
+ # 1418: external function definition with no prior declaration
# 2196: routine is both "inline" and "noinline"
+ # 2651: attribute does not apply to any entity
# 3179: deprecated conversion of string literal to char* (should be const char*)
- # 191: type qualifier is meaningless on cast type
+ # set as warning:
# 597: entity-kind "entity" will not be called for implicit or explicit conversions
# 2330: argument of type "type" is incompatible with parameter of type "type" (dropping qualifiers)
# 11003: no IR in object file xxxx; was the source file compiled with xxxx
- set(warnCFLAGS "${warnCFLAGS} -diag-disable=1418,191,2196,3179 -diag-warning=2330,597,11003")
+ set(warnCFLAGS "${warnCFLAGS} -diag-disable=191,1418,2196,2651,3179 -diag-warning=597,2330,11003")
endif()
set(warnCXXFLAGS "${warnCFLAGS} -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing")