double clock = simgrid::s4u::Engine::get_clock();
ACT_DEBUG("Entering Close: %s (filename: %s)", NAME.c_str(), file_name.c_str());
- XBT_ATTRIB_UNUSED auto count = opened_files.erase(full_name);
- xbt_assert(count == 1, "File not found in opened files: %s", full_name.c_str());
+ xbt_assert(opened_files.erase(full_name) == 1, "File not found in opened files: %s", full_name.c_str());
log_action(action, simgrid::s4u::Engine::get_clock() - clock);
}
//Attach the thread to the JVM
JNIEnv *env;
- XBT_ATTRIB_UNUSED jint error = __java_vm->AttachCurrentThread((void**)&env, nullptr);
- xbt_assert((error == JNI_OK), "The thread could not be attached to the JVM");
+ xbt_assert(__java_vm->AttachCurrentThread((void**)&env, nullptr) == JNI_OK,
+ "The thread could not be attached to the JVM");
this->jenv_ = env;
}
if (env->ExceptionOccurred()) {
XBT_DEBUG("Something went wrong in this Java actor, forget about it.");
env->ExceptionClear();
- XBT_ATTRIB_UNUSED jint error = __java_vm->DetachCurrentThread();
- xbt_assert(error == JNI_OK, "Cannot detach failing thread");
+ xbt_assert(__java_vm->DetachCurrentThread() == JNI_OK, "Cannot detach failing thread");
simgrid::ForcefulKillException::do_throw();
}
}
profile->stochastic_event_list.emplace_back(stochevent);
} else {
- XBT_ATTRIB_UNUSED int res = sscanf(val.c_str(), "%lg %lg\n", &event.date_, &event.value_);
- xbt_assert(res == 2, "%s:%d: Syntax error in trace\n%s", name.c_str(), linecount, input.c_str());
+ xbt_assert(sscanf(val.c_str(), "%lg %lg\n", &event.date_, &event.value_) == 2,
+ "%s:%d: Syntax error in trace\n%s", name.c_str(), linecount, input.c_str());
xbt_assert(last_event->date_ <= event.date_,
"%s:%d: Invalid trace: Events must be sorted, but time %g > time %g.\n%s", name.c_str(), linecount,
// From PTRACE_O_TRACEEXIT:
#ifdef __linux__
if (status>>8 == (SIGTRAP | (PTRACE_EVENT_EXIT<<8))) {
- long ptrace_res = ptrace(PTRACE_GETEVENTMSG, remote_process_->pid(), 0, &status);
- xbt_assert(ptrace_res != -1, "Could not get exit status");
+ xbt_assert(ptrace(PTRACE_GETEVENTMSG, remote_process_->pid(), 0, &status) != -1, "Could not get exit status");
if (WIFSIGNALED(status)) {
MC_report_crash(status);
this->get_remote_process().terminate();
memset(&m, 0, sizeof m);
m.type = MessageType::FINALIZE;
m.value = terminate_asap;
- int res = checker_side_.get_channel().send(m);
- xbt_assert(res == 0, "Could not ask the app to finalize on need");
+ xbt_assert(checker_side_.get_channel().send(m) == 0, "Could not ask the app to finalize on need");
s_mc_message_t answer;
- ssize_t s = checker_side_.get_channel().receive(answer);
- xbt_assert(s != -1, "Could not receive answer to FINALIZE");
+ xbt_assert(checker_side_.get_channel().receive(answer) != -1, "Could not receive answer to FINALIZE");
}
bool ModelChecker::checkDeadlock()
{
- int res = checker_side_.get_channel().send(MessageType::DEADLOCK_CHECK);
- xbt_assert(res == 0, "Could not check deadlock state");
+ xbt_assert(checker_side_.get_channel().send(MessageType::DEADLOCK_CHECK) == 0, "Could not check deadlock state");
s_mc_message_int_t message;
ssize_t s = checker_side_.get_channel().receive(message);
xbt_assert(s != -1, "Could not receive message");
// Make sure we do not outlive our parent
sigset_t mask;
sigemptyset (&mask);
- int sigprocmask_res = sigprocmask(SIG_SETMASK, &mask, nullptr);
- xbt_assert(sigprocmask_res >= 0, "Could not unblock signals");
- int prctl_res = prctl(PR_SET_PDEATHSIG, SIGHUP);
- xbt_assert(prctl_res == 0, "Could not PR_SET_PDEATHSIG");
+ xbt_assert(sigprocmask(SIG_SETMASK, &mask, nullptr) >= 0, "Could not unblock signals");
+ xbt_assert(prctl(PR_SET_PDEATHSIG, SIGHUP) == 0, "Could not PR_SET_PDEATHSIG");
#endif
// Remove CLOEXEC to pass the socket to the application
- int fdflags = fcntl(socket, F_GETFD, 0);
- int fcntl_res = fdflags != -1 ? fcntl(socket, F_SETFD, fdflags & ~FD_CLOEXEC) : -1;
- xbt_assert(fcntl_res != -1, "Could not remove CLOEXEC for socket");
+ int fdflags = fcntl(socket, F_GETFD, 0);
+ xbt_assert(fdflags != -1 && fcntl(socket, F_SETFD, fdflags & ~FD_CLOEXEC) != -1,
+ "Could not remove CLOEXEC for socket");
// Disable lazy relocation in the model-checked process to prevent the application from
// modifying its .got.plt during snapshot.
// between the model-checker process (ourselves) and the model-checked
// process:
int sockets[2];
- int res = socketpair(AF_LOCAL, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sockets);
- xbt_assert(res != -1, "Could not create socketpair");
+ xbt_assert(socketpair(AF_LOCAL, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, sockets) != -1, "Could not create socketpair");
pid_t pid = fork();
xbt_assert(pid >= 0, "Could not fork model-checked process");
s_mc_message_initial_addresses_t message{
MessageType::INITIAL_ADDRESSES, mmalloc_preinit(), simgrid::kernel::actor::get_maxpid_addr(),
simgrid::simix::simix_global_get_actors_addr(), simgrid::simix::simix_global_get_dead_actors_addr()};
- int send_res = instance_->channel_.send(message);
- xbt_assert(send_res == 0, "Could not send the initial message with addresses.");
+ xbt_assert(instance_->channel_.send(message) == 0, "Could not send the initial message with addresses.");
instance_->handle_messages();
return instance_.get();
// Send result:
s_mc_message_int_t answer{MessageType::DEADLOCK_CHECK_REPLY, deadlock};
- int send_res = channel_.send(answer);
- xbt_assert(send_res == 0, "Could not send response");
+ xbt_assert(channel_.send(answer) == 0, "Could not send response");
}
void AppSide::handle_simcall_execute(const s_mc_message_simcall_handle_t* message) const
{
// Send result:
s_mc_message_simcall_is_visible_answer_t answer{MessageType::SIMCALL_IS_VISIBLE_ANSWER, value};
- int send_res = channel_.send(answer);
- xbt_assert(send_res == 0, "Could not send response");
+ xbt_assert(channel_.send(answer) == 0, "Could not send response");
break;
}
// Send result:
s_mc_message_simcall_to_string_answer_t answer{MessageType::SIMCALL_TO_STRING_ANSWER, {0}};
value.copy(answer.value, (sizeof answer.value) - 1); // last byte was set to '\0' by initialization above
- int send_res = channel_.send(answer);
- xbt_assert(send_res == 0, "Could not send response");
+ xbt_assert(channel_.send(answer) == 0, "Could not send response");
break;
}
// Send result:
s_mc_message_simcall_to_string_answer_t answer{MessageType::SIMCALL_TO_STRING_ANSWER, {0}};
value.copy(answer.value, (sizeof answer.value) - 1); // last byte was set to '\0' by initialization above
- int send_res = channel_.send(answer);
- xbt_assert(send_res == 0, "Could not send response");
+ xbt_assert(channel_.send(answer) == 0, "Could not send response");
break;
}
#endif
}
coverage_checkpoint();
- int send_res = channel_.send(MessageType::DEADLOCK_CHECK_REPLY); // really?
- xbt_assert(send_res == 0, "Could not answer to FINALIZE");
+ xbt_assert(channel_.send(MessageType::DEADLOCK_CHECK_REPLY) == 0, // DEADLOCK_CHECK_REPLY, really?
+ "Could not answer to FINALIZE");
if (terminate_asap)
::_Exit(0);
break;
coverage_checkpoint();
while (true) {
simgrid::mc::execute_actors();
- int send_res = channel_.send(MessageType::WAITING);
- xbt_assert(send_res == 0, "Could not send WAITING message to model-checker");
+ xbt_assert(channel_.send(MessageType::WAITING) == 0, "Could not send WAITING message to model-checker");
this->handle_messages();
}
}
{
int fdin = open(src.c_str(), O_RDONLY);
xbt_assert(fdin >= 0, "Cannot read from %s. Please make sure that the file exists and is executable.", src.c_str());
- XBT_ATTRIB_UNUSED int unlink_status = unlink(target.c_str());
- xbt_assert(unlink_status == 0 || errno == ENOENT, "Failed to unlink file %s: %s", target.c_str(), strerror(errno));
+ xbt_assert(unlink(target.c_str()) == 0 || errno == ENOENT, "Failed to unlink file %s: %s", target.c_str(),
+ strerror(errno));
int fdout = open(target.c_str(), O_CREAT | O_RDWR | O_EXCL, S_IRWXU);
xbt_assert(fdout >= 0, "Cannot write into %s: %s", target.c_str(), strerror(errno));
for (auto const& libname : privatize_libs) {
// 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());
+ xbt_assert(libhandle != nullptr, "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__)
- XBT_ATTRIB_UNUSED int dl_iterate_res = dl_iterate_phdr(visit_libs, &fullpath);
- xbt_assert(dl_iterate_res != 0, "Can't find a linked %s - check your settings in smpi/privatize-libs",
- fullpath.c_str());
+ xbt_assert(dl_iterate_phdr(visit_libs, &fullpath) != 0,
+ "Can't find a linked %s - check your settings in smpi/privatize-libs", fullpath.c_str());
XBT_DEBUG("Extra lib to privatize '%s' found", fullpath.c_str());
#else
xbt_die("smpi/privatize-libs is not (yet) compatible with OSX nor with Haiku");
{
while (1) {
msg_task_t task = NULL;
- XBT_ATTRIB_UNUSED int res = MSG_task_receive(&(task), "worker_mailbox");
- xbt_assert(res == MSG_OK, "MSG_task_get failed");
+ xbt_assert(MSG_task_receive(&(task), "worker_mailbox") == MSG_OK, "MSG_task_receive failed");
XBT_INFO("Handling task \"%s\"", MSG_task_get_name(task));
if (!strcmp(MSG_task_get_name(task), "finalize")) {