From: Arnaud Giersch Date: Mon, 4 Nov 2013 11:04:19 +0000 (+0100) Subject: Avoid to use static variables from inside a non-static inline function. X-Git-Tag: v3_10_rc1~8 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e9ee90930ac32f25f8436935324f4f7a25a72271 Avoid to use static variables from inside a non-static inline function. Clang is a bit picky about this. --- diff --git a/src/xbt/dict.c b/src/xbt/dict.c index be839e30f5..3984e4315c 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -171,8 +171,9 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict, xbt_dictelm_t current, previous = NULL; xbt_assert(dict); - XBT_DEBUG("ADD %.*s hash = %u, size = %d, & = %u", key_len, key, hash_code, - dict->table_size, hash_code & dict->table_size); + XBT_CDEBUG(xbt_dict, + "ADD %.*s hash = %u, size = %d, & = %u", key_len, key, hash_code, + dict->table_size, hash_code & dict->table_size); current = dict->table[hash_code & dict->table_size]; while (current != NULL && (hash_code != current->hash_code || key_len != current->key_len @@ -194,9 +195,9 @@ XBT_INLINE void xbt_dict_set_ext(xbt_dict_t dict, previous->next = current; } } else { - XBT_DEBUG("Replace %.*s by %.*s under key %.*s", - key_len, (char *) current->content, - key_len, (char *) data, key_len, (char *) key); + XBT_CDEBUG(xbt_dict, "Replace %.*s by %.*s under key %.*s", + key_len, (char *) current->content, + key_len, (char *) data, key_len, (char *) key); /* there is already an element with the same key: overwrite it */ xbt_dictelm_set_data(dict, current, data, free_ctn); } diff --git a/src/xbt/dict_cursor.c b/src/xbt/dict_cursor.c index 790536ced7..c39e65def6 100644 --- a/src/xbt/dict_cursor.c +++ b/src/xbt/dict_cursor.c @@ -81,9 +81,9 @@ XBT_INLINE void xbt_dict_cursor_rewind(xbt_dict_cursor_t cursor) XBT_INLINE void xbt_dict_cursor_first(const xbt_dict_t dict, xbt_dict_cursor_t * cursor) { - XBT_DEBUG("xbt_dict_cursor_first"); + XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_cursor_first"); if (!*cursor) { - XBT_DEBUG("Create the cursor on first use"); + XBT_CDEBUG(xbt_dict_cursor, "Create the cursor on first use"); *cursor = xbt_dict_cursor_new(dict); } else { xbt_dict_cursor_rewind(*cursor); @@ -102,7 +102,7 @@ XBT_INLINE void xbt_dict_cursor_step(xbt_dict_cursor_t cursor) xbt_dictelm_t current; int line; - XBT_DEBUG("xbt_dict_cursor_step"); + XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_cursor_step"); xbt_assert(cursor); current = cursor->current; @@ -111,17 +111,17 @@ XBT_INLINE void xbt_dict_cursor_step(xbt_dict_cursor_t cursor) if (cursor->dict != NULL) { if (current != NULL) { - XBT_DEBUG("current is not null, take the next element"); + XBT_CDEBUG(xbt_dict_cursor, "current is not null, take the next element"); current = current->next; - XBT_DEBUG("next element: %p", current); + XBT_CDEBUG(xbt_dict_cursor, "next element: %p", current); } while (current == NULL && ++line <= cursor->dict->table_size) { - XBT_DEBUG("current is NULL, take the next line"); + XBT_CDEBUG(xbt_dict_cursor, "current is NULL, take the next line"); current = cursor->dict->table[line]; - XBT_DEBUG("element in the next line: %p", current); + XBT_CDEBUG(xbt_dict_cursor, "element in the next line: %p", current); } - XBT_DEBUG("search finished, current = %p, line = %d", current, line); + XBT_CDEBUG(xbt_dict_cursor, "search finished, current = %p, line = %d", current, line); cursor->current = current; cursor->line = line; @@ -139,7 +139,7 @@ XBT_INLINE int xbt_dict_cursor_get_or_free(xbt_dict_cursor_t * cursor, xbt_dictelm_t current; - XBT_DEBUG("xbt_dict_get_or_free"); + XBT_CDEBUG(xbt_dict_cursor, "xbt_dict_get_or_free"); if (!cursor || !(*cursor)) diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index d6d46117af..d9e20b9250 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -149,7 +149,7 @@ XBT_INLINE void xbt_dynar_reset(xbt_dynar_t const dynar) { _sanity_check_dynar(dynar); - XBT_DEBUG("Reset the dynar %p", (void *) dynar); + XBT_CDEBUG(xbt_dyn, "Reset the dynar %p", (void *) dynar); if (dynar->free_f) { xbt_dynar_map(dynar, dynar->free_f); } @@ -557,7 +557,7 @@ XBT_INLINE void xbt_dynar_push(xbt_dynar_t const dynar, XBT_INLINE void *xbt_dynar_pop_ptr(xbt_dynar_t const dynar) { _check_populated_dynar(dynar); - XBT_DEBUG("Pop %p", (void *) dynar); + XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar); dynar->used--; return _xbt_dynar_elm(dynar, dynar->used); } @@ -567,7 +567,7 @@ XBT_INLINE void xbt_dynar_pop(xbt_dynar_t const dynar, void *const dst) { /* sanity checks done by remove_at */ - XBT_DEBUG("Pop %p", (void *) dynar); + XBT_CDEBUG(xbt_dyn, "Pop %p", (void *) dynar); xbt_dynar_remove_at(dynar, dynar->used - 1, dst); } diff --git a/src/xbt/fifo.c b/src/xbt/fifo.c index e28cc7e02b..adaa88dc11 100644 --- a/src/xbt/fifo.c +++ b/src/xbt/fifo.c @@ -429,7 +429,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_new_item(void) */ XBT_INLINE xbt_fifo_item_t xbt_fifo_newitem(void) { - XBT_WARN("This function is deprecated. Use xbt_fifo_new_item."); + XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_new_item."); return xbt_fifo_new_item(); } @@ -469,7 +469,7 @@ XBT_INLINE void xbt_fifo_free_item(xbt_fifo_item_t b) */ XBT_INLINE void xbt_fifo_freeitem(xbt_fifo_item_t b) { - XBT_WARN("This function is deprecated. Use xbt_fifo_free_item."); + XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_free_item."); xbt_fifo_free_item(b); return; } @@ -509,7 +509,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_get_last_item(xbt_fifo_t l) */ XBT_INLINE xbt_fifo_item_t xbt_fifo_getFirstItem(xbt_fifo_t l) { - XBT_WARN("This function is deprecated. Use xbt_fifo_get_first_item."); + XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_get_first_item."); return xbt_fifo_get_first_item(l); } @@ -530,7 +530,7 @@ XBT_INLINE xbt_fifo_item_t xbt_fifo_get_next_item(xbt_fifo_item_t i) */ xbt_fifo_item_t xbt_fifo_getNextItem(xbt_fifo_item_t i) { - XBT_WARN("This function is deprecated. Use xbt_fifo_get_next_item."); + XBT_CWARN(xbt_fifo, "This function is deprecated. Use xbt_fifo_get_next_item."); return xbt_fifo_get_next_item(i); }