From 9bcf7dd5948ad1781a7ff203bb04e21b1dceebc7 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 27 Feb 2016 19:40:23 +0100 Subject: [PATCH] remove every XBT_USE_DEPRECATED parts --- ChangeLog | 1 + include/xbt/asserts.h | 11 -- include/xbt/cunit.h | 36 +---- include/xbt/dict.h | 46 ------ include/xbt/ex.h | 23 --- include/xbt/log.h | 181 --------------------- src/xbt/dict.c | 37 ----- src/xbt/dict_multi.c | 248 ----------------------------- src/xbt/log.c | 3 - teshsuite/bug-17132/CMakeLists.txt | 2 + tools/cmake/DefinePackages.cmake | 1 - tools/cmake/Tests.cmake | 5 - 12 files changed, 4 insertions(+), 590 deletions(-) delete mode 100644 src/xbt/dict_multi.c diff --git a/ChangeLog b/ChangeLog index 116bc1d3ef..8a780fd781 100644 --- a/ChangeLog +++ b/ChangeLog @@ -81,6 +81,7 @@ SimGrid (3.13) UNRELEASED; urgency=low * Kill the xbt_peer_t data type: it's useless without GRAS. * Kill rm_cb feature of config sets: it was never useful. * Kill graphxml parsing feature. It was not used. + * Kill the deprecated code protected by XBT_USE_DEPRECATED * New functions: - xbt_dynar_sort_strings(), when the content is char* - xbt_str_parse_int / xbt_str_parse_double, wrapping strtol/strtod diff --git a/include/xbt/asserts.h b/include/xbt/asserts.h index 58c226d4e5..33bacf3816 100644 --- a/include/xbt/asserts.h +++ b/include/xbt/asserts.h @@ -41,17 +41,6 @@ SG_BEGIN_DECL() do { if (!(cond)) THROWF(0, 0, __VA_ARGS__); } while (0) #endif -#ifdef XBT_USE_DEPRECATED - -#define xbt_assert0(...) xbt_assert(__VA_ARGS__) -#define xbt_assert1(...) xbt_assert(__VA_ARGS__) -#define xbt_assert2(...) xbt_assert(__VA_ARGS__) -#define xbt_assert3(...) xbt_assert(__VA_ARGS__) -#define xbt_assert4(...) xbt_assert(__VA_ARGS__) -#define xbt_assert5(...) xbt_assert(__VA_ARGS__) -#define xbt_assert6(...) xbt_assert(__VA_ARGS__) - -#endif /** @} */ SG_END_DECL() #endif /* _XBT_ASSERTS_H */ diff --git a/include/xbt/cunit.h b/include/xbt/cunit.h index 18b7b2b7c0..d7b80c56c6 100644 --- a/include/xbt/cunit.h +++ b/include/xbt/cunit.h @@ -151,39 +151,5 @@ XBT_PUBLIC(void) xbt_test_skip(void); /** @} */ -#ifdef XBT_USE_DEPRECATED - -/* Kept for backward compatibility. */ - -#define xbt_test_add0(...) xbt_test_add(__VA_ARGS__) -#define xbt_test_add1(...) xbt_test_add(__VA_ARGS__) -#define xbt_test_add2(...) xbt_test_add(__VA_ARGS__) -#define xbt_test_add3(...) xbt_test_add(__VA_ARGS__) -#define xbt_test_add4(...) xbt_test_add(__VA_ARGS__) -#define xbt_test_add5(...) xbt_test_add(__VA_ARGS__) - -#define xbt_test_fail0(...) xbt_test_fail(__VA_ARGS__) -#define xbt_test_fail1(...) xbt_test_fail(__VA_ARGS__) -#define xbt_test_fail2(...) xbt_test_fail(__VA_ARGS__) -#define xbt_test_fail3(...) xbt_test_fail(__VA_ARGS__) -#define xbt_test_fail4(...) xbt_test_fail(__VA_ARGS__) -#define xbt_test_fail5(...) xbt_test_fail(__VA_ARGS__) - -#define xbt_test_assert0(...) xbt_test_assert(__VA_ARGS__) -#define xbt_test_assert1(...) xbt_test_assert(__VA_ARGS__) -#define xbt_test_assert2(...) xbt_test_assert(__VA_ARGS__) -#define xbt_test_assert3(...) xbt_test_assert(__VA_ARGS__) -#define xbt_test_assert4(...) xbt_test_assert(__VA_ARGS__) -#define xbt_test_assert5(...) xbt_test_assert(__VA_ARGS__) - -#define xbt_test_log0(...) xbt_test_log(__VA_ARGS__) -#define xbt_test_log1(...) xbt_test_log(__VA_ARGS__) -#define xbt_test_log2(...) xbt_test_log(__VA_ARGS__) -#define xbt_test_log3(...) xbt_test_log(__VA_ARGS__) -#define xbt_test_log4(...) xbt_test_log(__VA_ARGS__) -#define xbt_test_log5(...) xbt_test_log(__VA_ARGS__) - -#endif - SG_END_DECL() -#endif /* _TS_H_ */ +#endif /* _XBT_CUNIT_H_ */ diff --git a/include/xbt/dict.h b/include/xbt/dict.h index 0c0ec92599..61b2f14957 100644 --- a/include/xbt/dict.h +++ b/include/xbt/dict.h @@ -107,13 +107,6 @@ XBT_PUBLIC(void *) xbt_dict_get_or_null_ext(xbt_dict_t dict, XBT_PUBLIC(void) xbt_dict_remove_ext(xbt_dict_t dict, const char *key, int key_len); -#ifdef XBT_USE_DEPRECATED -XBT_PUBLIC(void) xbt_dicti_set(xbt_dict_t dict, uintptr_t key, - uintptr_t data); -XBT_PUBLIC(uintptr_t) xbt_dicti_get(xbt_dict_t dict, uintptr_t key); -XBT_PUBLIC(void) xbt_dicti_remove(xbt_dict_t dict, uintptr_t key); -#endif - struct s_xbt_dict_cursor { xbt_dictelm_t current; int line; @@ -191,44 +184,5 @@ xbt_dict_foreach(head, cursor, key, data) { /** @} */ -#ifdef XBT_USE_DEPRECATED -/** @defgroup XBT_dict_multi Multi-level dictionaries - * @ingroup XBT_dict - * - * They can be seen as dictionary of multiple keys or as dictionary of - * dictionary of ... of data. Most of the functions here work the same way - * than their simple dictionary counterpart. - * - * Note that there is no xbt_multidict_free neither xbt_multi_dict_new functions. - * Use xbt_dict_free() and xbt_dict_new() instead. - * - * @{ - */ - -/*----[ xbt_multidict_set ]--------------------------------------------------*/ -XBT_PUBLIC(void) -xbt_multidict_set(xbt_dict_t mdict, - xbt_dynar_t keys, void *data, void (*free_ctn) (void *)); -XBT_PUBLIC(void) -xbt_multidict_set_ext(xbt_dict_t mdict, - xbt_dynar_t keys, xbt_dynar_t lens, - void *data, void_f_pvoid_t free_ctn); - -/*----[ xbt_multidict_get ]--------------------------------------------------*/ -XBT_PUBLIC(void *) xbt_multidict_get(xbt_dict_t mdict, xbt_dynar_t keys); -XBT_PUBLIC(void *) xbt_multidict_get_ext(xbt_dict_t mdict, - xbt_dynar_t keys, - xbt_dynar_t lens); - -/*----[ xbt_multidict_remove ]-----------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -XBT_PUBLIC(void) xbt_multidict_remove(xbt_dict_t mdict, xbt_dynar_t keys); -XBT_PUBLIC(void) xbt_multidict_remove_ext(xbt_dict_t mdict, - xbt_dynar_t keys, - xbt_dynar_t lens); - -/** @} */ -#endif - SG_END_DECL() #endif /* _XBT_DICT_H */ diff --git a/include/xbt/ex.h b/include/xbt/ex.h index 526c374181..54a55f3483 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -500,29 +500,6 @@ XBT_PUBLIC(void) xbt_backtrace_display(xbt_ex_t * e); /** @brief Get current backtrace with libunwind */ XBT_PUBLIC(int) xbt_libunwind_backtrace(void *bt[XBT_BACKTRACE_SIZE], int size); -#ifdef XBT_USE_DEPRECATED - -/* Kept for backward compatibility. */ - -#define THROW0(c, v, m) \ - do { if (m) THROWF(c, v, m); else THROW(c, v); } while (0) -#define THROW1(c, v, ...) THROWF(c, v, __VA_ARGS__) -#define THROW2(c, v, ...) THROWF(c, v, __VA_ARGS__) -#define THROW3(c, v, ...) THROWF(c, v, __VA_ARGS__) -#define THROW4(c, v, ...) THROWF(c, v, __VA_ARGS__) -#define THROW5(c, v, ...) THROWF(c, v, __VA_ARGS__) -#define THROW6(c, v, ...) THROWF(c, v, __VA_ARGS__) -#define THROW7(c, v, ...) THROWF(c, v, __VA_ARGS__) - -#define RETHROW0(...) RETHROWF(__VA_ARGS__) -#define RETHROW1(...) RETHROWF(__VA_ARGS__) -#define RETHROW2(...) RETHROWF(__VA_ARGS__) -#define RETHROW3(...) RETHROWF(__VA_ARGS__) -#define RETHROW4(...) RETHROWF(__VA_ARGS__) -#define RETHROW5(...) RETHROWF(__VA_ARGS__) - -#endif - SG_END_DECL() /** @} */ diff --git a/include/xbt/log.h b/include/xbt/log.h index fbde8e2efa..72cdf84266 100644 --- a/include/xbt/log.h +++ b/include/xbt/log.h @@ -693,186 +693,5 @@ extern xbt_log_layout_t xbt_log_default_layout; */ #define XBT_HERE(...) XBT_LOG(xbt_log_priority_trace, "-- was here" __VA_ARGS__) -#ifdef XBT_USE_DEPRECATED - -/* Kept for backward compatibility. */ - -#define CLOG0(...) XBT_CLOG(__VA_ARGS__) -#define CLOG1(...) XBT_CLOG(__VA_ARGS__) -#define CLOG2(...) XBT_CLOG(__VA_ARGS__) -#define CLOG3(...) XBT_CLOG(__VA_ARGS__) -#define CLOG4(...) XBT_CLOG(__VA_ARGS__) -#define CLOG5(...) XBT_CLOG(__VA_ARGS__) -#define CLOG6(...) XBT_CLOG(__VA_ARGS__) -#define CLOG7(...) XBT_CLOG(__VA_ARGS__) -#define CLOG8(...) XBT_CLOG(__VA_ARGS__) -#define CLOG9(...) XBT_CLOG(__VA_ARGS__) -#define CLOG10(...) XBT_CLOG(__VA_ARGS__) - -#define CDEBUG0(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG1(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG2(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG3(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG4(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG5(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG6(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG7(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG8(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG9(...) XBT_CDEBUG(__VA_ARGS__) -#define CDEBUG10(...) XBT_CDEBUG(__VA_ARGS__) - -#define CVERB0(...) XBT_CVERB(__VA_ARGS__) -#define CVERB1(...) XBT_CVERB(__VA_ARGS__) -#define CVERB2(...) XBT_CVERB(__VA_ARGS__) -#define CVERB3(...) XBT_CVERB(__VA_ARGS__) -#define CVERB4(...) XBT_CVERB(__VA_ARGS__) -#define CVERB5(...) XBT_CVERB(__VA_ARGS__) -#define CVERB6(...) XBT_CVERB(__VA_ARGS__) -#define CVERB7(...) XBT_CVERB(__VA_ARGS__) -#define CVERB8(...) XBT_CVERB(__VA_ARGS__) -#define CVERB9(...) XBT_CVERB(__VA_ARGS__) -#define CVERB10(...) XBT_CVERB(__VA_ARGS__) - -#define CINFO0(...) XBT_CINFO(__VA_ARGS__) -#define CINFO1(...) XBT_CINFO(__VA_ARGS__) -#define CINFO2(...) XBT_CINFO(__VA_ARGS__) -#define CINFO3(...) XBT_CINFO(__VA_ARGS__) -#define CINFO4(...) XBT_CINFO(__VA_ARGS__) -#define CINFO5(...) XBT_CINFO(__VA_ARGS__) -#define CINFO6(...) XBT_CINFO(__VA_ARGS__) -#define CINFO7(...) XBT_CINFO(__VA_ARGS__) -#define CINFO8(...) XBT_CINFO(__VA_ARGS__) -#define CINFO9(...) XBT_CINFO(__VA_ARGS__) -#define CINFO10(...) XBT_CINFO(__VA_ARGS__) - -#define CWARN0(...) XBT_CWARN(__VA_ARGS__) -#define CWARN1(...) XBT_CWARN(__VA_ARGS__) -#define CWARN2(...) XBT_CWARN(__VA_ARGS__) -#define CWARN3(...) XBT_CWARN(__VA_ARGS__) -#define CWARN4(...) XBT_CWARN(__VA_ARGS__) -#define CWARN5(...) XBT_CWARN(__VA_ARGS__) -#define CWARN6(...) XBT_CWARN(__VA_ARGS__) -#define CWARN7(...) XBT_CWARN(__VA_ARGS__) -#define CWARN8(...) XBT_CWARN(__VA_ARGS__) -#define CWARN9(...) XBT_CWARN(__VA_ARGS__) -#define CWARN10(...) XBT_CWARN(__VA_ARGS__) - -#define CERROR0(...) XBT_CERROR(__VA_ARGS__) -#define CERROR1(...) XBT_CERROR(__VA_ARGS__) -#define CERROR2(...) XBT_CERROR(__VA_ARGS__) -#define CERROR3(...) XBT_CERROR(__VA_ARGS__) -#define CERROR4(...) XBT_CERROR(__VA_ARGS__) -#define CERROR5(...) XBT_CERROR(__VA_ARGS__) -#define CERROR6(...) XBT_CERROR(__VA_ARGS__) -#define CERROR7(...) XBT_CERROR(__VA_ARGS__) -#define CERROR8(...) XBT_CERROR(__VA_ARGS__) -#define CERROR9(...) XBT_CERROR(__VA_ARGS__) -#define CERROR10(...) XBT_CERROR(__VA_ARGS__) - -#define CCRITICAL0(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL1(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL2(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL3(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL4(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL5(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL6(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL7(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL8(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL9(...) XBT_CCRITICAL(__VA_ARGS__) -#define CCRITICAL10(...) XBT_CCRITICAL(__VA_ARGS__) - -#define LOG0(...) XBT_LOG(__VA_ARGS__) -#define LOG1(...) XBT_LOG(__VA_ARGS__) -#define LOG2(...) XBT_LOG(__VA_ARGS__) -#define LOG3(...) XBT_LOG(__VA_ARGS__) -#define LOG4(...) XBT_LOG(__VA_ARGS__) -#define LOG5(...) XBT_LOG(__VA_ARGS__) -#define LOG6(...) XBT_LOG(__VA_ARGS__) -#define LOG7(...) XBT_LOG(__VA_ARGS__) -#define LOG8(...) XBT_LOG(__VA_ARGS__) -#define LOG9(...) XBT_LOG(__VA_ARGS__) -#define LOG10(...) XBT_LOG(__VA_ARGS__) - -#define DEBUG0(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG1(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG2(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG3(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG4(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG5(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG6(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG7(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG8(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG9(...) XBT_DEBUG(__VA_ARGS__) -#define DEBUG10(...) XBT_DEBUG(__VA_ARGS__) - -#define VERB0(...) XBT_VERB(__VA_ARGS__) -#define VERB1(...) XBT_VERB(__VA_ARGS__) -#define VERB2(...) XBT_VERB(__VA_ARGS__) -#define VERB3(...) XBT_VERB(__VA_ARGS__) -#define VERB4(...) XBT_VERB(__VA_ARGS__) -#define VERB5(...) XBT_VERB(__VA_ARGS__) -#define VERB6(...) XBT_VERB(__VA_ARGS__) -#define VERB7(...) XBT_VERB(__VA_ARGS__) -#define VERB8(...) XBT_VERB(__VA_ARGS__) -#define VERB9(...) XBT_VERB(__VA_ARGS__) -#define VERB10(...) XBT_VERB(__VA_ARGS__) - -#define INFO0(...) XBT_INFO(__VA_ARGS__) -#define INFO1(...) XBT_INFO(__VA_ARGS__) -#define INFO2(...) XBT_INFO(__VA_ARGS__) -#define INFO3(...) XBT_INFO(__VA_ARGS__) -#define INFO4(...) XBT_INFO(__VA_ARGS__) -#define INFO5(...) XBT_INFO(__VA_ARGS__) -#define INFO6(...) XBT_INFO(__VA_ARGS__) -#define INFO7(...) XBT_INFO(__VA_ARGS__) -#define INFO8(...) XBT_INFO(__VA_ARGS__) -#define INFO9(...) XBT_INFO(__VA_ARGS__) -#define INFO10(...) XBT_INFO(__VA_ARGS__) - -#define WARN0(...) XBT_WARN(__VA_ARGS__) -#define WARN1(...) XBT_WARN(__VA_ARGS__) -#define WARN2(...) XBT_WARN(__VA_ARGS__) -#define WARN3(...) XBT_WARN(__VA_ARGS__) -#define WARN4(...) XBT_WARN(__VA_ARGS__) -#define WARN5(...) XBT_WARN(__VA_ARGS__) -#define WARN6(...) XBT_WARN(__VA_ARGS__) -#define WARN7(...) XBT_WARN(__VA_ARGS__) -#define WARN8(...) XBT_WARN(__VA_ARGS__) -#define WARN9(...) XBT_WARN(__VA_ARGS__) -#define WARN10(...) XBT_WARN(__VA_ARGS__) - -#define ERROR0(...) XBT_ERROR(__VA_ARGS__) -#define ERROR1(...) XBT_ERROR(__VA_ARGS__) -#define ERROR2(...) XBT_ERROR(__VA_ARGS__) -#define ERROR3(...) XBT_ERROR(__VA_ARGS__) -#define ERROR4(...) XBT_ERROR(__VA_ARGS__) -#define ERROR5(...) XBT_ERROR(__VA_ARGS__) -#define ERROR6(...) XBT_ERROR(__VA_ARGS__) -#define ERROR7(...) XBT_ERROR(__VA_ARGS__) -#define ERROR8(...) XBT_ERROR(__VA_ARGS__) -#define ERROR9(...) XBT_ERROR(__VA_ARGS__) -#define ERROR10(...) XBT_ERROR(__VA_ARGS__) - -#define CRITICAL0(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL1(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL2(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL3(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL4(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL5(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL6(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL7(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL8(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL9(...) XBT_CRITICAL(__VA_ARGS__) -#define CRITICAL10(...) XBT_CRITICAL(__VA_ARGS__) - -#define XBT_IN1(...) XBT_IN(__VA_ARGS__); -#define XBT_IN2(...) XBT_IN(__VA_ARGS__); -#define XBT_IN3(...) XBT_IN(__VA_ARGS__); -#define XBT_IN4(...) XBT_IN(__VA_ARGS__); -#define XBT_IN5(...) XBT_IN(__VA_ARGS__); -#define XBT_IN6(...) XBT_IN(__VA_ARGS__); - -#endif - SG_END_DECL() #endif /* ! _XBT_LOG_H_ */ diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 46d7509ad7..f04465a5c7 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -412,43 +412,6 @@ XBT_INLINE void xbt_dict_remove(xbt_dict_t dict, const char *key) xbt_dict_remove_ext(dict, key, strlen(key)); } -#ifdef XBT_USE_DEPRECATED -/** - * \brief Add data to the dict (arbitrary key) - * \param dict the container - * \param key the key to set the new data - * \param data the data to add in the dict - * - * Set the \a data in the structure under the \a key. - * Both \a data and \a key are considered as uintptr_t. - */ -XBT_INLINE void xbt_dicti_set(xbt_dict_t dict, - uintptr_t key, uintptr_t data) -{ - xbt_dict_set_ext(dict, (void *)&key, sizeof key, (void*)data, NULL); -} - -/** - * \brief Retrieve data from the dict (key considered as a uintptr_t) - * - * \param dict the dealer of data - * \param key the key to find data - * \return the data that we are looking for (or 0 if not found) - * - * Mixing uintptr_t keys with regular keys in the same dict is discouraged - */ -XBT_INLINE uintptr_t xbt_dicti_get(xbt_dict_t dict, uintptr_t key) -{ - return (uintptr_t)xbt_dict_get_or_null_ext(dict, (void *)&key, sizeof key); -} - -/** Remove a uintptr_t key from the dict */ -XBT_INLINE void xbt_dicti_remove(xbt_dict_t dict, uintptr_t key) -{ - xbt_dict_remove_ext(dict, (void *)&key, sizeof key); -} -#endif - /** @brief Remove all data from the dict */ void xbt_dict_reset(xbt_dict_t dict) { diff --git a/src/xbt/dict_multi.c b/src/xbt/dict_multi.c deleted file mode 100644 index a8ef163d02..0000000000 --- a/src/xbt/dict_multi.c +++ /dev/null @@ -1,248 +0,0 @@ -/* dict_multi - dictionnaries of dictionnaries of ... of data */ - -/* Copyright (c) 2004-2014. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifdef XBT_USE_DEPRECATED - -#include "dict_private.h" - -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_dict_multi, xbt_dict, - "Dictionaries of multiple keys"); - -static void _free_dict(void *d) -{ - XBT_VERB("free dict %p", d); - xbt_dict_free((xbt_dict_t *) & d); -} - -/** \brief Insert \e data under all the keys contained in \e keys, providing their sizes in \e lens. - * - * \arg mdict: the multi-dict - * \arg keys: dynar of (char *) containing all the keys - * \arg lens: length of each element of \e keys - * \arg data: what to store in the structure - * \arg free_ctn: function to use to free the pushed content on need - * - * Dynars are not modified during the operation. - */ - -void -xbt_multidict_set_ext(xbt_dict_t mdict, - xbt_dynar_t keys, xbt_dynar_t lens, - void *data, void_f_pvoid_t free_ctn) -{ - - xbt_dict_t thislevel, nextlevel = NULL; - int i; - - unsigned long int thislen; - char *thiskey; - int keys_len = xbt_dynar_length(keys); - - xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens)); - xbt_assert(keys_len, "Can't set a zero-long key set in a multidict"); - - XBT_DEBUG("xbt_multidict_set(%p,%d)", mdict, keys_len); - - for (i = 0, thislevel = mdict; i < keys_len - 1; - i++, thislevel = nextlevel) { - - xbt_dynar_get_cpy(keys, i, &thiskey); - xbt_dynar_get_cpy(lens, i, &thislen); - - XBT_DEBUG("multi_set: at level %d, len=%ld, key=%p |%*s|", i, thislen, - thiskey, (int) thislen, thiskey); - - /* search the dict of next level */ - nextlevel = xbt_dict_get_or_null_ext(thislevel, thiskey, thislen); - if (nextlevel == NULL) { - /* make sure the dict of next level exists */ - nextlevel = xbt_dict_new(); - XBT_VERB("Create a dict (%p)", nextlevel); - xbt_dict_set_ext(thislevel, thiskey, thislen, nextlevel, - &_free_dict); - } - } - - xbt_dynar_get_cpy(keys, i, &thiskey); - xbt_dynar_get_cpy(lens, i, &thislen); - - xbt_dict_set_ext(thislevel, thiskey, thislen, data, free_ctn); -} - -/** \brief Insert \e data under all the keys contained in \e keys - * - * \arg head: the head of dict - * \arg keys: dynar of null-terminated strings containing all the keys - * \arg data: what to store in the structure - * \arg free_ctn: function to use to free the pushed content on need - */ -void -xbt_multidict_set(xbt_dict_t mdict, - xbt_dynar_t keys, void *data, void_f_pvoid_t free_ctn) -{ - xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int), NULL); - unsigned long i; - - for (i = 0; i < xbt_dynar_length(keys); i++) { - char *thiskey = xbt_dynar_get_as(keys, i, char *); - unsigned long int thislen = (unsigned long int) strlen(thiskey); - XBT_DEBUG("Push %ld as level %lu length", thislen, i); - xbt_dynar_push(lens, &thislen); - } - - TRY { - xbt_multidict_set_ext(mdict, keys, lens, data, free_ctn); - } - TRY_CLEANUP { - xbt_dynar_free(&lens); - } - CATCH_ANONYMOUS { - RETHROW; - } -} - -/** \brief Insert \e data under all the keys contained in \e keys, providing their sizes in \e lens. - * - * \arg mdict: the multi-dict - * \arg keys: dynar of (char *) containing all the keys - * \arg lens: length of each element of \e keys - * \arg data: where to put what was found in structure - * \arg free_ctn: function to use to free the pushed content on need - * - * Dynars are not modified during the operation. - */ -void *xbt_multidict_get_ext(xbt_dict_t mdict, - xbt_dynar_t keys, xbt_dynar_t lens) -{ - xbt_dict_t thislevel, nextlevel; - int i; - - unsigned long int thislen; - char *thiskey; - int keys_len = xbt_dynar_length(keys); - - xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens)); - xbt_assert(!xbt_dynar_is_empty(keys), - "Can't get a zero-long key set in a multidict"); - - XBT_DEBUG("xbt_multidict_get(%p, %ld)", mdict, xbt_dynar_length(keys)); - - for (i = 0, thislevel = mdict; i < keys_len - 1; - i++, thislevel = nextlevel) { - - xbt_dynar_get_cpy(keys, i, &thiskey); - xbt_dynar_get_cpy(lens, i, &thislen); - - XBT_DEBUG("multi_get: at level %d (%p), len=%ld, key=%p |%*s|", - i, thislevel, thislen, thiskey, (int) thislen, thiskey); - - /* search the dict of next level: let mismatch raise if not found */ - nextlevel = xbt_dict_get_ext(thislevel, thiskey, thislen); - } - - xbt_dynar_get_cpy(keys, i, &thiskey); - xbt_dynar_get_cpy(lens, i, &thislen); - - return xbt_dict_get_ext(thislevel, thiskey, thislen); -} - -void *xbt_multidict_get(xbt_dict_t mdict, xbt_dynar_t keys) -{ - xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int), NULL); - unsigned long i; - void *res; - - for (i = 0; i < xbt_dynar_length(keys); i++) { - char *thiskey = xbt_dynar_get_as(keys, i, char *); - unsigned long int thislen = (unsigned long int) strlen(thiskey); - xbt_dynar_push(lens, &thislen); - } - - res = xbt_multidict_get_ext(mdict, keys, lens), xbt_dynar_free(&lens); - return res; -} - - -/** \brief Remove the entry under all the keys contained in \e keys, providing their sizes in \e lens. - * - * \arg mdict: the multi-dict - * \arg keys: dynar of (char *) containing all the keys - * \arg lens: length of each element of \e keys - * \arg data: what to store in the structure - * \arg free_ctn: function to use to free the pushed content on need - * - * Dynars are not modified during the operation. - * - * Removing a non-existant key is ok. - */ - -void -xbt_multidict_remove_ext(xbt_dict_t mdict, xbt_dynar_t keys, - xbt_dynar_t lens) -{ - volatile xbt_dict_t thislevel; - volatile xbt_dict_t nextlevel = NULL; - volatile int i; - xbt_ex_t e; - - unsigned long int thislen; - char *thiskey; - int keys_len = xbt_dynar_length(keys); - - xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens)); - xbt_assert(xbt_dynar_length(keys), - "Can't remove a zero-long key set in a multidict"); - - for (i = 0, thislevel = mdict; i < keys_len - 1; - i++, thislevel = nextlevel) { - - xbt_dynar_get_cpy(keys, i, &thiskey); - xbt_dynar_get_cpy(lens, i, &thislen); - - /* search the dict of next level */ - TRY { - nextlevel = xbt_dict_get_ext(thislevel, thiskey, thislen); - } - CATCH(e) { - /* If non-existant entry, nothing to do */ - if (e.category == arg_error) - xbt_ex_free(e); - else - RETHROW; - } - } - - xbt_dynar_get_cpy(keys, i, &thiskey); - xbt_dynar_get_cpy(lens, i, &thislen); - - xbt_dict_remove_ext(thislevel, thiskey, thislen); -} - -void xbt_multidict_remove(xbt_dict_t mdict, xbt_dynar_t keys) -{ - xbt_dynar_t lens = xbt_dynar_new(sizeof(unsigned long int), NULL); - unsigned long i; - - for (i = 0; i < xbt_dynar_length(keys); i++) { - char *thiskey = xbt_dynar_get_as(keys, i, char *); - unsigned long int thislen = strlen(thiskey); - xbt_dynar_push(lens, &thislen); - } - - TRY { - xbt_multidict_remove_ext(mdict, keys, lens); - } - TRY_CLEANUP { - xbt_dynar_free(&lens); - } - CATCH_ANONYMOUS { - RETHROW; - } -} - -#endif diff --git a/src/xbt/log.c b/src/xbt/log.c index 76ecb58d60..cd559c18a1 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -570,9 +570,6 @@ static void xbt_log_connect_categories(void) XBT_LOG_CONNECT(xbt_dict); XBT_LOG_CONNECT(xbt_dict_cursor); XBT_LOG_CONNECT(xbt_dict_elm); -#ifdef XBT_USE_DEPRECATED - XBT_LOG_CONNECT(xbt_dict_multi); -#endif XBT_LOG_CONNECT(xbt_dyn); XBT_LOG_CONNECT(xbt_ex); XBT_LOG_CONNECT(xbt_fifo); diff --git a/teshsuite/bug-17132/CMakeLists.txt b/teshsuite/bug-17132/CMakeLists.txt index 0fe354b7c2..510f29702d 100644 --- a/teshsuite/bug-17132/CMakeLists.txt +++ b/teshsuite/bug-17132/CMakeLists.txt @@ -22,3 +22,5 @@ set(txt_files ${txt_files} ${CMAKE_CURRENT_SOURCE_DIR}/hostfile.txt PARENT_SCOPE) + +ADD_TESH_FACTORIES(tesh-smpi-bug-17132 "thread" --setenv srcdir=${CMAKE_CURRENT_SOURCE_DIR} --cd ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/bug-17132.tesh) diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 6765bf9595..8b10cee4c0 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -249,7 +249,6 @@ set(XBT_SRC src/xbt/dict.c src/xbt/dict_cursor.c src/xbt/dict_elm.c - src/xbt/dict_multi.c src/xbt/dynar.c src/xbt/ex.c src/xbt/fifo.c diff --git a/tools/cmake/Tests.cmake b/tools/cmake/Tests.cmake index 1cd1096444..b0d0e6261e 100644 --- a/tools/cmake/Tests.cmake +++ b/tools/cmake/Tests.cmake @@ -361,11 +361,6 @@ IF(NOT enable_memcheck) ENDIF() # smpi broken usage ADD_TESH_FACTORIES(tesh-smpi-broken "thread" --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong broken_hostfiles.tesh) - # https://gforge.inria.fr/tracker/index.php?func=detail&aid=17132&group_id=12&atid=165 - ADD_TESH_FACTORIES(tesh-smpi-bug-17132 "thread" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132 --cd ${CMAKE_BINARY_DIR}/teshsuite/bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132.tesh) - IF(enable_debug) - ADD_TESH_FACTORIES(tesh-smpi-bug-17132-surf-debug "thread" --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132 --cd ${CMAKE_BINARY_DIR}/teshsuite/bug-17132 ${CMAKE_HOME_DIRECTORY}/teshsuite/bug-17132/bug-17132-surf-debug.tesh) - ENDIF() ADD_TESH(tesh-smpi-replay-ti-tracing --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/pingpong --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/pingpong TI_output.tesh) FOREACH (GATHER_COLL default ompi mpich ompi_basic_linear ompi_linear_sync ompi_binomial mvapich2 mvapich2_two_level impi) ADD_TESH(tesh-smpi-gather-coll-${GATHER_COLL} --cfg smpi/gather:${GATHER_COLL} --setenv bindir=${CMAKE_BINARY_DIR}/teshsuite/smpi/gather --cd ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/gather gather_coll.tesh) -- 2.20.1