int i;
- _XBT_GNUC_UNUSED int res = sscanf(argv[1], "%d", &number_of_tasks);
+ XBT_ATTRIB_UNUSED int res = sscanf(argv[1], "%d", &number_of_tasks);
xbt_assert(res,"Invalid argument %s\n", argv[1]);
res = sscanf(argv[2], "%lg", &task_comp_size);
xbt_assert(res, "Invalid argument %s\n", argv[2]);
int worker(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
while (1) {
res = MSG_task_receive(&(task),MSG_host_get_name(MSG_host_self()));
xbt_assert(res == MSG_OK, "MSG_task_receive failed");
int i;
- _XBT_GNUC_UNUSED int res = sscanf(argv[1], "%d", &number_of_tasks);
+ XBT_ATTRIB_UNUSED int res = sscanf(argv[1], "%d", &number_of_tasks);
xbt_assert(res,"Invalid argument %s\n", argv[1]);
res = sscanf(argv[2], "%lg", &task_comp_size);
xbt_assert(res, "Invalid argument %s\n", argv[2]);
int worker(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
char channel[1024];
build_channel_name(channel,MSG_process_get_data(MSG_process_self()),
int i;
- _XBT_GNUC_UNUSED int res = sscanf(argv[1], "%lg", &timeout);
+ XBT_ATTRIB_UNUSED int res = sscanf(argv[1], "%lg", &timeout);
xbt_assert(res,"Invalid argument %s\n", argv[1]);
res = sscanf(argv[2], "%lg", &task_comp_size);
xbt_assert(res, "Invalid argument %s\n", argv[2]);
int worker(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
char channel[1024];
build_channel_name(channel,MSG_process_get_data(MSG_process_self()),
TRACE_category(master_name);
- _XBT_GNUC_UNUSED int res = sscanf(argv[1], "%lg", &timeout);
+ XBT_ATTRIB_UNUSED int res = sscanf(argv[1], "%lg", &timeout);
xbt_assert(res,"Invalid argument %s\n", argv[1]);
res = sscanf(argv[2], "%lg", &task_comp_size);
xbt_assert(res, "Invalid argument %s\n", argv[2]);
int worker(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
char channel[1024];
build_channel_name(channel,MSG_process_get_data(MSG_process_self()),
TRACE_category(master_name);
- _XBT_GNUC_UNUSED int res = sscanf(argv[1], "%lg", &timeout);
+ XBT_ATTRIB_UNUSED int res = sscanf(argv[1], "%lg", &timeout);
xbt_assert(res,"Invalid argument %s\n", argv[1]);
res = sscanf(argv[2], "%lg", &task_comp_size);
xbt_assert(res, "Invalid argument %s\n", argv[2]);
int worker(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
char channel[1024];
const char *my_master = MSG_process_get_data(MSG_process_self());
int receiver(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED msg_error_t res;
+ XBT_ATTRIB_UNUSED msg_error_t res;
int id = -1;
char mailbox[80];
msg_comm_t res_irecv;
XBT_INFO("sleep_start_time : %f , sleep_test_time : %f", sleep_start_time,
sleep_test_time);
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[1], "%d", &id);
xbt_assert(read,
"Invalid argument %s\n", argv[1]);
int receiver(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED msg_error_t res;
+ XBT_ATTRIB_UNUSED msg_error_t res;
int id = -1;
char mailbox[80];
msg_comm_t res_irecv;
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[1], "%d", &id);
xbt_assert(read, "Invalid argument %s\n", argv[1]);
MSG_process_sleep(10);
sprintf(mailbox, "finalize");
msg_comm_t res_irecv;
- _XBT_GNUC_UNUSED msg_error_t res_wait;
+ XBT_ATTRIB_UNUSED msg_error_t res_wait;
for (i = 0; i < receivers_count; i++) {
task = NULL;
res_irecv = MSG_task_irecv(&(task), mailbox);
int tasks = atof(argv[2]);
msg_task_t *task = xbt_new(msg_task_t, tasks);
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[1], "%d", &id);
xbt_assert(read, "Invalid argument %s\n", argv[1]);
sprintf(mailbox, "receiver-%d", id);
/* Here we are waiting for the receiving of all communications */
msg_task_t task_com;
while (!xbt_dynar_is_empty(comms)) {
- _XBT_GNUC_UNUSED msg_error_t err;
+ XBT_ATTRIB_UNUSED msg_error_t err;
xbt_dynar_remove_at(comms, MSG_comm_waitany(comms), &res_irecv);
task_com = MSG_comm_get_task(res_irecv);
MSG_comm_destroy(res_irecv);
int slave(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
XBT_DEBUG("mailbox: %s",MSG_process_get_name(MSG_process_self()));
while (1) {
double task_comp_size = 0;
double task_comm_size = 0;
int i;
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[1], "%d", &number_of_tasks);
xbt_assert(read, "Invalid argument %s\n", argv[1]);
double task_comp_size = 0;
double task_comm_size = 0;
int i;
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[1], "%d", &number_of_tasks);
xbt_assert(read, "Invalid argument %s\n", argv[1]);
double task_comp_size = 0;
double task_comm_size = 0;
int i;
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[1], "%d", &number_of_tasks);
xbt_assert(read, "Invalid argument %s\n", argv[1]);
int i;
- _XBT_GNUC_UNUSED int res = sscanf(argv[1], "%d", &number_of_tasks);
+ XBT_ATTRIB_UNUSED int res = sscanf(argv[1], "%d", &number_of_tasks);
xbt_assert(res,"Invalid argument %s\n", argv[1]);
res = sscanf(argv[2], "%lg", &task_comp_size);
xbt_assert(res, "Invalid argument %s\n", argv[2]);
int slave(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
while (1) {
res = MSG_task_receive(&(task),MSG_host_get_name(MSG_host_self()));
xbt_assert(res == MSG_OK, "MSG_task_get failed");
int slave(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
int id = -1;
char mailbox[80];
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[1], "%d", &id);
xbt_assert(read, "Invalid argument %s\n", argv[1]);
"Unknown host %s. Stopping Now! ", argv[i]);
}
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[argc - 2], "%lg", &computation_amount);
xbt_assert(read, "Invalid argument %s\n", argv[argc - 2]);
read = sscanf(argv[argc - 1], "%lg", &communication_amount);
"Unknown host %s. Stopping Now! ", argv[i]);
}
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[argc - 1], "%lg", &communication_amount);
xbt_assert(read, "Invalid argument %s\n", argv[argc - 1]);
computation_duration = (double *) calloc(host_list_size, sizeof(double));
double priority = 1.0;
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res = sscanf(argv[1], "%lg", &computation_amount);
+ XBT_ATTRIB_UNUSED int res = sscanf(argv[1], "%lg", &computation_amount);
xbt_assert(res, "Invalid argument %s\n", argv[1]);
res = sscanf(argv[2], "%lg", &priority);
xbt_assert(res, "Invalid argument %s\n", argv[2]);
xbt_dict_cursor_t cursor = NULL;
char *key, *data;
const char *noexist = "UnknownProcessProp";
- _XBT_GNUC_UNUSED const char *value;
+ XBT_ATTRIB_UNUSED const char *value;
XBT_INFO("== Print the properties of the process");
xbt_dict_foreach(props, cursor, key, data)
int host_number = atoi(MSG_process_get_name(MSG_process_self()));
char mailbox[256];
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
if (host_number == 0){ //master send then receive
sprintf(mailbox, "%d", host_number+1);
task = MSG_task_create("Token", task_comp_size, task_comm_size, NULL);
int host_number = atoi(MSG_process_get_name(MSG_process_self()));
char mailbox[256];
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
if (host_number == 0){ //master send then receive
sprintf(mailbox, "%d", host_number+1);
task = MSG_task_create("Token", task_comp_size, task_comm_size, NULL);
int slave(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
int id = -1;
char mailbox[80];
- _XBT_GNUC_UNUSED int read;
+ XBT_ATTRIB_UNUSED int read;
read = sscanf(argv[1], "%d", &id);
xbt_assert(read, "Invalid argument %s\n", argv[1]);
XBT_PUBLIC(void) surf_parse_init_callbacks(void);
XBT_PUBLIC(void) surf_parse_reset_callbacks(void);
XBT_PUBLIC(void) surf_parse_free_callbacks(void);
-XBT_PUBLIC(void) surf_parse_error(const char *msg,...) _XBT_GNUC_PRINTF(1,2) _XBT_GNUC_NORETURN;
-XBT_PUBLIC(void) surf_parse_warn(const char *msg,...) _XBT_GNUC_PRINTF(1,2);
+XBT_PUBLIC(void) surf_parse_error(const char *msg,...) XBT_ATTRIB_PRINTF(1,2) XBT_ATTRIB_NORETURN;
+XBT_PUBLIC(void) surf_parse_warn(const char *msg,...) XBT_ATTRIB_PRINTF(1,2);
XBT_PUBLIC(double) surf_parse_get_double(const char *string);
XBT_PUBLIC(int) surf_parse_get_int(const char *string);
XBT_PUBLIC(double) surf_parse_get_time(const char *string);
#endif
#if defined(__MINGW32__) && defined(__MINGW_PRINTF_FORMAT)
- # define _XBT_GNUC_PRINTF( format_idx, arg_idx ) \
+ # define XBT_ATTRIB_PRINTF( format_idx, arg_idx ) \
__attribute__((__format__ (__MINGW_PRINTF_FORMAT, format_idx, arg_idx)))
#else
- # define _XBT_GNUC_PRINTF( format_idx, arg_idx ) \
+ # define XBT_ATTRIB_PRINTF( format_idx, arg_idx ) \
__attribute__((__format__ (__printf__, format_idx, arg_idx)))
#endif
#if defined(__MINGW32__) && defined(__MINGW_SCANF_FORMAT)
- # define _XBT_GNUC_SCANF( format_idx, arg_idx ) \
+ # define XBT_ATTRIB_SCANF( format_idx, arg_idx ) \
__attribute__((__MINGW_SCANF_FORMAT (__scanf__, format_idx, arg_idx)))
#else
- # define _XBT_GNUC_SCANF( format_idx, arg_idx ) \
+ # define XBT_ATTRIB_SCANF( format_idx, arg_idx ) \
__attribute__((__format__ (__scanf__, format_idx, arg_idx)))
#endif
-# define _XBT_GNUC_NORETURN __attribute__((__noreturn__))
-# define _XBT_GNUC_UNUSED __attribute__((__unused__))
+# define XBT_ATTRIB_NORETURN __attribute__((__noreturn__))
+# define XBT_ATTRIB_UNUSED __attribute__((__unused__))
/* Constructor priorities exist since gcc 4.3. Apparently, they are however not
* supported on Macs. */
# undef _XBT_NEED_INIT_PRAGMA
#else /* !__GNUC__ */
-# define _XBT_GNUC_PRINTF( format_idx, arg_idx )
-# define _XBT_GNUC_SCANF( format_idx, arg_idx )
-# define _XBT_GNUC_NORETURN
-# define _XBT_GNUC_UNUSED
+# define XBT_ATTRIB_PRINTF( format_idx, arg_idx )
+# define XBT_ATTRIB_SCANF( format_idx, arg_idx )
+# define XBT_ATTRIB_NORETURN
+# define XBT_ATTRIB_UNUSED
# define _XBT_GNUC_CONSTRUCTOR(prio)
# define _XBT_GNUC_DESTRUCTOR(prio)
# define _XBT_NEED_INIT_PRAGMA 1
/* test operations */
XBT_PUBLIC(void) _xbt_test_add(const char *file, int line, const char *fmt,
- ...) _XBT_GNUC_PRINTF(3, 4);
+ ...) XBT_ATTRIB_PRINTF(3, 4);
XBT_PUBLIC(void) _xbt_test_fail(const char *file, int line,
- const char *fmt, ...) _XBT_GNUC_PRINTF(3,
+ const char *fmt, ...) XBT_ATTRIB_PRINTF(3,
4);
XBT_PUBLIC(void) _xbt_test_log(const char *file, int line, const char *fmt,
- ...) _XBT_GNUC_PRINTF(3, 4);
+ ...) XBT_ATTRIB_PRINTF(3, 4);
/** @brief Declare that a new test begins (printf-like parameters, describing the test)
* @hideinitializer */
#define xbt_test_add(...) _xbt_test_add(__FILE__, __LINE__, __VA_ARGS__)
} s_xbt_dynar_t;
static XBT_INLINE void
-_xbt_dynar_cursor_first(const xbt_dynar_t dynar _XBT_GNUC_UNUSED,
+_xbt_dynar_cursor_first(const xbt_dynar_t dynar XBT_ATTRIB_UNUSED,
unsigned int *const cursor)
{
/* iterating over a NULL dynar is a no-op (but we don't want to have uninitialized counters) */
/* ********************************** */
XBT_PUBLIC(void) _xbt_log_event_log(xbt_log_event_t ev,
const char *fmt,
- ...) _XBT_GNUC_PRINTF(2, 3);
+ ...) XBT_ATTRIB_PRINTF(2, 3);
XBT_PUBLIC(int) _xbt_log_cat_init(xbt_log_category_t category,
e_xbt_log_priority_t priority);
*/
#if defined(SIMGRID_NEED_ASPRINTF)||defined(DOXYGEN)
XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt, /*args */
- ...) _XBT_GNUC_PRINTF(2, 3);
+ ...) XBT_ATTRIB_PRINTF(2, 3);
#endif
/** @brief print to allocated string (reimplemented when not provided by the system)
*
* Works just like asprintf(), but returns a pointer to the newly
* created string, or aborts on error.
*/
-XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
+XBT_PUBLIC(char *) bprintf(const char *fmt, ...) XBT_ATTRIB_PRINTF(1, 2);
/** @} */
SG_END_DECL()
* @{
*/
/** @brief Kill the program in silence */
-XBT_PUBLIC(void) xbt_abort(void) _XBT_GNUC_NORETURN;
+XBT_PUBLIC(void) xbt_abort(void) XBT_ATTRIB_NORETURN;
/**
* @brief Kill the program with an error message
not need to load the whole str.h and its heavy dependencies */
#ifndef __USE_GNU /* do not redeclare existing headers */
XBT_PUBLIC(int) asprintf(char **ptr, const char *fmt, /*args */
- ...) _XBT_GNUC_PRINTF(2, 3);
+ ...) XBT_ATTRIB_PRINTF(2, 3);
XBT_PUBLIC(int) vasprintf(char **ptr, const char *fmt, va_list ap);
#endif
-XBT_PUBLIC(char *) bprintf(const char *fmt, ...) _XBT_GNUC_PRINTF(1, 2);
+XBT_PUBLIC(char *) bprintf(const char *fmt, ...) XBT_ATTRIB_PRINTF(1, 2);
/** @addtogroup XBT_syscall
* @brief Malloc and associated functions, killing the program on error (with \ref XBT_ex)
xbt_os_thread_set_extra_data(context);
//Attach the thread to the JVM
JNIEnv *env;
- _XBT_GNUC_UNUSED jint error = (*__java_vm)->AttachCurrentThread(__java_vm, (void **) &env, NULL);
+ XBT_ATTRIB_UNUSED jint error = (*__java_vm)->AttachCurrentThread(__java_vm, (void **) &env, NULL);
xbt_assert((error == JNI_OK), "The thread could not be attached to the JVM");
context->jenv = get_current_thread_env();
//Wait for the first scheduling round to happen.
/* detach the thread and kills it */
JNIEnv *env = ctx_java->jenv;
(*env)->DeleteGlobalRef(env,ctx_java->jprocess);
- _XBT_GNUC_UNUSED jint error = (*__java_vm)->DetachCurrentThread(__java_vm);
+ XBT_ATTRIB_UNUSED jint error = (*__java_vm)->DetachCurrentThread(__java_vm);
xbt_assert((error == JNI_OK), "The thread couldn't be detached.");
xbt_os_sem_release(((smx_ctx_java_t)context)->end);
xbt_os_thread_exit(NULL);
buffer.data = xbt_new(char, buffer.capacity);
/* copy the binary chunk from src into a buffer */
- _XBT_GNUC_UNUSED int error = lua_dump(src, sglua_memory_writer, &buffer);
+ XBT_ATTRIB_UNUSED int error = lua_dump(src, sglua_memory_writer, &buffer);
xbt_assert(!error, "Failed to dump the function from the source state: error %d",
error);
XBT_DEBUG("Fonction dumped: %zu bytes", buffer.size);
lua_pushstring(L, argv[i]);
/* call the function */
- _XBT_GNUC_UNUSED int err;
+ XBT_ATTRIB_UNUSED int err;
err = lua_pcall(L, argc - 1, 1, 0);
xbt_assert(err == 0, "Error running function `%s': %s", argv[0],
lua_tostring(L, -1));
void STag_dax__adag(void)
{
- _XBT_GNUC_UNUSED double version;
+ XBT_ATTRIB_UNUSED double version;
version = dax_parse_double(A_dax__adag_version);
xbt_assert(version == 2.1,
*/
void SIMIX_launch_application(const char *file)
{
- _XBT_GNUC_UNUSED int parse_status;
+ XBT_ATTRIB_UNUSED int parse_status;
xbt_assert(simix_global,
"SIMIX_global_init has to be called before SIMIX_launch_application.");
/* Stag and Etag parse functions */
void STag_surfxml_platform(void) {
- _XBT_GNUC_UNUSED double version = surf_parse_get_double(A_surfxml_platform_version);
+ XBT_ATTRIB_UNUSED double version = surf_parse_get_double(A_surfxml_platform_version);
xbt_assert((version >= 1.0), "******* BIG FAT WARNING *********\n "
"You're using an ancient XML file.\n"
/* 0. Make sure that we already calculated the resource share at the physical
* machine layer. */
{
- _XBT_GNUC_UNUSED Model *ws_model = surf_host_model;
- _XBT_GNUC_UNUSED Model *vm_ws_model = surf_vm_model;
- _XBT_GNUC_UNUSED unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &ws_model);
- _XBT_GNUC_UNUSED unsigned int index_of_vm_ws_model = xbt_dynar_search(model_list_invoke, &vm_ws_model);
+ XBT_ATTRIB_UNUSED Model *ws_model = surf_host_model;
+ XBT_ATTRIB_UNUSED Model *vm_ws_model = surf_vm_model;
+ XBT_ATTRIB_UNUSED unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &ws_model);
+ XBT_ATTRIB_UNUSED unsigned int index_of_vm_ws_model = xbt_dynar_search(model_list_invoke, &vm_ws_model);
xbt_assert((index_of_pm_ws_model < index_of_vm_ws_model), "Cannot assume surf_host_model comes before");
/* Another option is that we call sub_ws->share_resource() here. The
VMHL13::~VMHL13()
{
/* Free the cpu_action of the VM. */
- _XBT_GNUC_UNUSED int ret = p_action->unref();
+ XBT_ATTRIB_UNUSED int ret = p_action->unref();
xbt_assert(ret == 1, "Bug: some resource still remains");
}
new_cpu_action->setBound(old_bound);
}
- _XBT_GNUC_UNUSED int ret = p_action->unref();
+ XBT_ATTRIB_UNUSED int ret = p_action->unref();
xbt_assert(ret == 1, "Bug: some resource still remains");
p_action = new_cpu_action;
{
xbt_dict_cursor_t cursor;
char *key;
- _XBT_GNUC_UNUSED char *key2;
+ XBT_ATTRIB_UNUSED char *key2;
void *data;
int effective = 0;
{
xbt_ex_t ex;
int r1;
- int _XBT_GNUC_UNUSED r2;
+ int XBT_ATTRIB_UNUSED r2;
int v1;
volatile int v2;
ETag_graphxml_edge_fun = __parse_edge;
xbt_graph_parse_open(filename);
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
res = xbt_graph_parse();
xbt_assert(!res, "Parse error in %s", filename);
xbt_graph_parse_close();
double xbt_graph_parse_get_double(const char *string)
{
double result;
- _XBT_GNUC_UNUSED int ret = 0;
+ XBT_ATTRIB_UNUSED int ret = 0;
ret = sscanf(string, "%lg", &result);
xbt_assert((ret == 1), "Parse error line %d : %s not a number",
int slave(int argc, char *argv[])
{
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
int id = -1;
char mailbox[80];
static int killall(int argc, char *argv[]){
msg_task_t task = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
int i;
for (i=0; i<3;i++) {
res = MSG_task_receive(&(task), mailbox);
int server(int argc, char *argv[])
{
msg_task_t to_execute = NULL;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
storage_info(MSG_host_self());
int slave(int argc, char *argv[])
{
msg_task_t task;
- _XBT_GNUC_UNUSED int res;
+ XBT_ATTRIB_UNUSED int res;
int id = -1;
char mailbox[80];
double start, end;