From: Marion Guthmuller Date: Tue, 21 Feb 2012 17:15:15 +0000 (+0100) Subject: Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid X-Git-Tag: exp_20120308~34 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/eb3be59d63b0d199fa3f32b5a22553e44cfb917a?hp=f7ce33e664fa8829deb5f0db0b1d60bfc207972e Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot//simgrid/simgrid --- diff --git a/buildtools/Cmake/CompleteInFiles.cmake b/buildtools/Cmake/CompleteInFiles.cmake index e34c8d0ecd..745fab82ec 100644 --- a/buildtools/Cmake/CompleteInFiles.cmake +++ b/buildtools/Cmake/CompleteInFiles.cmake @@ -68,7 +68,11 @@ include(TestBigEndian) TEST_BIG_ENDIAN(BIGENDIAN) include(FindGraphviz) -include(FindPCRE) +if(WIN32) +include(FindPcreWin) +else(WIN32) +include(FindPCRE) +endif(WIN32) set(HAVE_GTNETS 0) if(enable_gtnets) diff --git a/buildtools/Cmake/MakeLibWin.cmake b/buildtools/Cmake/MakeLibWin.cmake index 03db5e02de..cd41fa9e55 100644 --- a/buildtools/Cmake/MakeLibWin.cmake +++ b/buildtools/Cmake/MakeLibWin.cmake @@ -6,17 +6,35 @@ add_library(gras SHARED ${gras_sources}) set_target_properties(gras PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_EXPORT -DDLL_EXPORT" VERSION ${libgras_version} OUTPUT_NAME "gras") set_target_properties(simgrid PROPERTIES COMPILE_FLAGS "-D_XBT_DLL_EXPORT -DDLL_EXPORT" VERSION ${libsimgrid_version} OUTPUT_NAME "simgrid") -set(GRAS_DEP "ws2_32 -lpthread") -set(SIMGRID_DEP "ws2_32 -lpthread") +# libpthreadGC2.dll +if(ARCH_32_BITS) + find_library(PATH_PTHREAD_LIB + NAMES pthreadGC2.dll + HINTS + $ENV{PATH} + PATH_SUFFIXES bin/ c/bin + ) +else(ARCH_32_BITS) + find_library(PATH_PTHREAD_LIB + NAMES pthreadGC2-w64.dll + HINTS + $ENV{PATH} + PATH_SUFFIXES bin/ c/bin + ) +endif(ARCH_32_BITS) + +set(GRAS_DEP "ws2_32 ${PATH_PTHREAD_LIB}") +set(SIMGRID_DEP "ws2_32 ${PATH_PCRE_LIB} ${PATH_PTHREAD_LIB}") if(ARCH_32_BITS) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -march=i486") else(ARCH_32_BITS) - message(FATAL_ERROR "Sorry, Simgrid fails with full 64bits for now! Please contact us.") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64") +# message(FATAL_ERROR "Sorry, Simgrid fails with full 64bits for now! Please contact us.") endif(ARCH_32_BITS) target_link_libraries(gras ${GRAS_DEP}) -target_link_libraries(simgrid ${SIMGRID_DEP} ${PATH_PCRE_LIB}) +target_link_libraries(simgrid ${SIMGRID_DEP}) find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS) message(STATUS "pexports: ${PEXPORTS_PATH}") diff --git a/buildtools/Cmake/Modules/FindPCRE.cmake b/buildtools/Cmake/Modules/FindPCRE.cmake index 5eb24f8a4c..51cd61341b 100644 --- a/buildtools/Cmake/Modules/FindPCRE.cmake +++ b/buildtools/Cmake/Modules/FindPCRE.cmake @@ -10,16 +10,7 @@ find_library(PATH_PCRE_LIB /opt/local /opt/csw /sw - /usr) - -string(REGEX MATCH ".dll.a" operation "${PATH_PCRE_LIB}") - -if(NOT operation) - if(WIN32) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-DPCRE_STATIC ") - endif(WIN32) -endif(NOT operation) - + /usr) find_path(PATH_PCRE_H "pcre.h" HINTS @@ -48,27 +39,6 @@ else(PATH_PCRE_LIB) message(STATUS "Looking for lib pcre - not found") endif(PATH_PCRE_LIB) -if(WIN32) - find_path(PATH_PCRE_LICENCE "LICENCE" - HINTS - $ENV{SIMGRID_PCRE_LIBRARY_PATH} - $ENV{LD_LIBRARY_PATH} - $ENV{PCRE_LIBRARY_PATH} - PATH_SUFFIXES GnuWin32 - PATHS - /opt - /opt/local - /opt/csw - /sw - /usr) - message(STATUS "Looking for pcre licence") - if(PATH_PCRE_LICENCE) - message(STATUS "Looking for pcre licence - found") - else(PATH_PCRE_LICENCE) - message(STATUS "Looking for pcre licence - not found") - endif(PATH_PCRE_LICENCE) -endif(WIN32) - if(PATH_PCRE_LIB AND PATH_PCRE_H) string(REGEX REPLACE "/libpcre.*[.]${LIB_EXE}$" "" PATHLIBPCRE "${PATH_PCRE_LIB}") string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}") diff --git a/buildtools/Cmake/Modules/FindPcreWin.cmake b/buildtools/Cmake/Modules/FindPcreWin.cmake new file mode 100644 index 0000000000..c22412cdd2 --- /dev/null +++ b/buildtools/Cmake/Modules/FindPcreWin.cmake @@ -0,0 +1,44 @@ +# LIB libpcre.dll +find_library(PATH_PCRE_LIB + NAMES pcre + HINTS + $ENV{SIMGRID_PCRE_LIBRARY_PATH} + $ENV{PCRE_LIBRARY_PATH} + PATH_SUFFIXES bin/ GnuWin32/bin + ) + +find_path(PATH_PCRE_H "pcre.h" + HINTS + $ENV{SIMGRID_PCRE_LIBRARY_PATH} + $ENV{PCRE_LIBRARY_PATH} + PATH_SUFFIXES include/ GnuWin32/include + ) + +message(STATUS "Looking for pcre.h") +if(PATH_PCRE_H) +message(STATUS "Looking for pcre.h - found") +else(PATH_PCRE_H) +message(STATUS "Looking for pcre.h - not found") +endif(PATH_PCRE_H) + +message(STATUS "Looking for lib pcre") +if(PATH_PCRE_LIB) +message(STATUS "Looking for lib pcre - found") +else(PATH_PCRE_LIB) +message(STATUS "Looking for lib pcre - not found") +endif(PATH_PCRE_LIB) + +if(PATH_PCRE_LIB AND PATH_PCRE_H) + string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}") + string(REGEX MATCH "-I${PATH_PCRE_H} " operation "${CMAKE_C_FLAGS}") + if(NOT operation) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${PATH_PCRE_H} ") + endif(NOT operation) +else(PATH_PCRE_LIB) + message(FATAL_ERROR "Please install the pcre package before using SimGrid.") +endif(PATH_PCRE_LIB AND PATH_PCRE_H) + +set(PCRE_LIBRARY_PATH $ENV{PCRE_LIBRARY_PATH}) + +mark_as_advanced(PATH_PCRE_H) +mark_as_advanced(PATH_PCRE_LIB) \ No newline at end of file diff --git a/buildtools/Cmake/simgrid.nsi.in b/buildtools/Cmake/simgrid.nsi.in index 2c9bba63da..0e36ce0ee1 100644 --- a/buildtools/Cmake/simgrid.nsi.in +++ b/buildtools/Cmake/simgrid.nsi.in @@ -193,7 +193,7 @@ Section "Examples" ExamplesSection file @CMAKE_HOME_DIRECTORY@\examples\msg\masterslave\deployment_masterslave_forwarder.xml file @CMAKE_HOME_DIRECTORY@\examples\msg\msg_platform.xml file @CMAKE_HOME_DIRECTORY@\doc\HelloWorld\CMakeLists.txt - file @CMAKE_HOME_DIRECTORY@\doc\HelloWorld\FindPCRE.cmake + file @CMAKE_HOME_DIRECTORY@\doc\HelloWorld\FindPcreWin.cmake # create shortcuts in the start menu programs directory CreateDirectory "$SMPROGRAMS\SimGrid @SIMGRID_VERSION_MAJOR@.@SIMGRID_VERSION_MINOR@.@SIMGRID_VERSION_PATCH@\Examples\" @@ -207,9 +207,9 @@ Section "Pcre library" PCRESection setOutPath $INSTDIR\GnuWin32 file /r "@PCRE_LIBRARY_PATH@\lib" file /r "@PCRE_LIBRARY_PATH@\include" - file /nonfatal /r "@PCRE_LIBRARY_PATH@\bin" - file /nonfatal /r "@PCRE_LIBRARY_PATH@\man" - file /nonfatal /r "@PCRE_LIBRARY_PATH@\share" + file /r "@PCRE_LIBRARY_PATH@\bin" + file /r "@PCRE_LIBRARY_PATH@\man" + file /r "@PCRE_LIBRARY_PATH@\share" SectionEnd Section "Java Bindings" JavaSection diff --git a/doc/HelloWorld/CMakeLists.txt b/doc/HelloWorld/CMakeLists.txt index a74538de30..ac917df224 100644 --- a/doc/HelloWorld/CMakeLists.txt +++ b/doc/HelloWorld/CMakeLists.txt @@ -17,7 +17,7 @@ set(CMAKE_EXE_LINKER_FLAGS "" CACHE TYPE INTERNAL FORCE) ############################### # Test the build dependencies # ############################### -include(FindPCRE.cmake) +include(FindPcreWin.cmake) message(STATUS "Looking for lib Simgrid") if("$ENV{SIMGRID_ROOT}" STREQUAL "") message(STATUS "Looking for lib Simgrid - Not found") diff --git a/doc/HelloWorld/FindPCRE.cmake b/doc/HelloWorld/FindPCRE.cmake deleted file mode 100644 index 858e0e2dbe..0000000000 --- a/doc/HelloWorld/FindPCRE.cmake +++ /dev/null @@ -1,99 +0,0 @@ -### SET THE LIBRARY EXTENSION AND GCC VERSION -if(APPLE) #MAC - set(LIB_EXE "dylib") -else(APPLE) - if(WIN32) #WINDOWS - set(LIB_EXE "a") - set(BIN_EXE ".exe") - else(WIN32) #UNIX - set(LIB_EXE "so") - endif(WIN32) -endif(APPLE) - -find_library(PATH_PCRE_LIB - NAMES pcre - HINTS - $ENV{SIMGRID_PCRE_LIBRARY_PATH} - $ENV{LD_LIBRARY_PATH} - $ENV{PCRE_LIBRARY_PATH} - PATH_SUFFIXES lib/ GnuWin32/lib - PATHS - /opt - /opt/local - /opt/csw - /sw - /usr) - -string(REGEX MATCH ".dll.a" operation "${PATH_PCRE_LIB}") - -if(NOT operation) - if(WIN32) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-DPCRE_STATIC ") - endif(WIN32) -endif(NOT operation) - -find_path(PATH_PCRE_H "pcre.h" - HINTS - $ENV{SIMGRID_PCRE_LIBRARY_PATH} - $ENV{LD_LIBRARY_PATH} - $ENV{PCRE_LIBRARY_PATH} - PATH_SUFFIXES include/ GnuWin32/include - PATHS - /opt - /opt/local - /opt/csw - /sw - /usr) - -message(STATUS "Looking for pcre.h") -if(PATH_PCRE_H) -message(STATUS "Looking for pcre.h - found") -else(PATH_PCRE_H) -message(STATUS "Looking for pcre.h - not found") -endif(PATH_PCRE_H) - -message(STATUS "Looking for lib pcre") -if(PATH_PCRE_LIB) -message(STATUS "Looking for lib pcre - found") -else(PATH_PCRE_LIB) -message(STATUS "Looking for lib pcre - not found") -endif(PATH_PCRE_LIB) - -if(WIN32) - find_path(PATH_PCRE_LICENCE "LICENCE" - HINTS - $ENV{SIMGRID_PCRE_LIBRARY_PATH} - $ENV{LD_LIBRARY_PATH} - $ENV{PCRE_LIBRARY_PATH} - PATH_SUFFIXES GnuWin32 - PATHS - /opt - /opt/local - /opt/csw - /sw - /usr) - message(STATUS "Looking for pcre licence") - if(PATH_PCRE_LICENCE) - message(STATUS "Looking for pcre licence - found") - else(PATH_PCRE_LICENCE) - message(STATUS "Looking for pcre licence - not found") - endif(PATH_PCRE_LICENCE) -endif(WIN32) - -if(PATH_PCRE_LIB AND PATH_PCRE_H) - string(REGEX REPLACE "/libpcre.*[.]${LIB_EXE}$" "" PATHLIBPCRE "${PATH_PCRE_LIB}") - string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}") - string(REGEX MATCH "-L${PATHLIBPCRE} " operation "${CMAKE_C_FLAGS}") - if(NOT operation) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-L${PATHLIBPCRE} ") - endif(NOT operation) - string(REGEX MATCH "-I${PATH_PCRE_H} " operation "${CMAKE_C_FLAGS}") - if(NOT operation) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${PATH_PCRE_H} ") - endif(NOT operation) -else(PATH_PCRE_LIB) - message(FATAL_ERROR "Please install the libpcre3-dev package or equivalent before using SimGrid.") -endif(PATH_PCRE_LIB AND PATH_PCRE_H) - -mark_as_advanced(PATH_PCRE_H) -mark_as_advanced(PATH_PCRE_LIB) \ No newline at end of file diff --git a/doc/HelloWorld/FindPcreWin.cmake b/doc/HelloWorld/FindPcreWin.cmake new file mode 100644 index 0000000000..f2e1ad3a41 --- /dev/null +++ b/doc/HelloWorld/FindPcreWin.cmake @@ -0,0 +1,42 @@ +# LIB libpcre.dll +find_library(PATH_PCRE_LIB + NAMES pcre + HINTS + $ENV{SIMGRID_PCRE_LIBRARY_PATH} + $ENV{PCRE_LIBRARY_PATH} + PATH_SUFFIXES bin/ GnuWin32/bin + ) + +find_path(PATH_PCRE_H "pcre.h" + HINTS + $ENV{SIMGRID_PCRE_LIBRARY_PATH} + $ENV{PCRE_LIBRARY_PATH} + PATH_SUFFIXES include/ GnuWin32/include + ) + +message(STATUS "Looking for pcre.h") +if(PATH_PCRE_H) +message(STATUS "Looking for pcre.h - found") +else(PATH_PCRE_H) +message(STATUS "Looking for pcre.h - not found") +endif(PATH_PCRE_H) + +message(STATUS "Looking for lib pcre") +if(PATH_PCRE_LIB) +message(STATUS "Looking for lib pcre - found") +else(PATH_PCRE_LIB) +message(STATUS "Looking for lib pcre - not found") +endif(PATH_PCRE_LIB) + +if(PATH_PCRE_LIB AND PATH_PCRE_H) + string(REGEX REPLACE "/pcre.h" "" PATH_PCRE_H "${PATH_PCRE_H}") + string(REGEX MATCH "-I${PATH_PCRE_H} " operation "${CMAKE_C_FLAGS}") + if(NOT operation) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${PATH_PCRE_H} ") + endif(NOT operation) +else(PATH_PCRE_LIB) + message(FATAL_ERROR "Please install the pcre package before using SimGrid.") +endif(PATH_PCRE_LIB AND PATH_PCRE_H) + +mark_as_advanced(PATH_PCRE_H) +mark_as_advanced(PATH_PCRE_LIB) \ No newline at end of file diff --git a/examples/msg/chord/chord.c b/examples/msg/chord/chord.c index 9995fb6d39..038c754acb 100644 --- a/examples/msg/chord/chord.c +++ b/examples/msg/chord/chord.c @@ -461,7 +461,7 @@ static void handle_task(node_t node, m_task_t task) { case TASK_FIND_SUCCESSOR_ANSWER: case TASK_GET_PREDECESSOR_ANSWER: - XBT_DEBUG("Ignoring unexpected task of type %d (%p)", type, task); + XBT_DEBUG("Ignoring unexpected task of type %d (%p)", (int)type, task); task_free(task); break; } @@ -626,7 +626,7 @@ static int remote_find_successor(node_t node, int ask_to, int id) if (res != MSG_OK) { XBT_DEBUG("Failed to receive the answer to my 'Find Successor' request (task %p): %d", - task_sent, res); + task_sent, (int)res); stop = 1; MSG_comm_destroy(node->comm_receive); node->comm_receive = NULL; @@ -707,7 +707,7 @@ static int remote_get_predecessor(node_t node, int ask_to) if (res != MSG_OK) { XBT_DEBUG("Failed to receive the answer to my 'Get Predecessor' request (task %p): %d", - task_sent, res); + task_sent, (int)res); stop = 1; MSG_comm_destroy(node->comm_receive); node->comm_receive = NULL; diff --git a/include/msg/datatypes.h b/include/msg/datatypes.h index edb9b7366f..70d1d302db 100644 --- a/include/msg/datatypes.h +++ b/include/msg/datatypes.h @@ -145,7 +145,7 @@ typedef enum { MSG_HOST_FAILURE = 4, /**< @brief System shutdown. The host on which you are running has just been rebooted. Free your datastructures and return now !*/ - MSG_TASK_CANCELED = 8, /**< @brief Canceled task. This task has been canceled by somebody!*/ + MSG_TASK_CANCELED = 8 /**< @brief Canceled task. This task has been canceled by somebody!*/ } MSG_error_t; /** @} */ diff --git a/include/simdag/datatypes.h b/include/simdag/datatypes.h index 961e1fed6d..6b77dfaa80 100644 --- a/include/simdag/datatypes.h +++ b/include/simdag/datatypes.h @@ -82,7 +82,7 @@ typedef enum { typedef enum { SD_TASK_NOT_TYPED = 0, /**< @brief no specified type */ SD_TASK_COMM_E2E = 1, /**< @brief end to end communication */ - SD_TASK_COMP_SEQ = 2, /**< @brief sequential computation */ + SD_TASK_COMP_SEQ = 2 /**< @brief sequential computation */ } e_SD_task_kind_t; diff --git a/include/simix/datatypes.h b/include/simix/datatypes.h index b05bdf311c..f306ccc88d 100644 --- a/include/simix/datatypes.h +++ b/include/simix/datatypes.h @@ -44,7 +44,7 @@ typedef enum { SIMIX_DST_HOST_FAILURE, SIMIX_SRC_TIMEOUT, SIMIX_DST_TIMEOUT, - SIMIX_LINK_FAILURE, + SIMIX_LINK_FAILURE } e_smx_state_t; /** @} */ diff --git a/src/amok/Bandwidth/bandwidth.c b/src/amok/Bandwidth/bandwidth.c index d28219ce47..6e917ced0c 100644 --- a/src/amok/Bandwidth/bandwidth.c +++ b/src/amok/Bandwidth/bandwidth.c @@ -168,7 +168,7 @@ void amok_bw_test(xbt_socket_t peer, request->peer.name = NULL; request->peer.port = xbt_socket_my_port(measMasterIn); XBT_DEBUG - ("Handshaking with %s:%d to connect it back on my %d (bufsize=%ld, msg_size=%ld, msg_amount=%ld)", + ("Handshaking with %s:%d to connect it back on my %d (bufsize=%lu, msg_size=%lu, msg_amount=%lu)", xbt_socket_peer_name(peer), xbt_socket_peer_port(peer), request->peer.port, request->buf_size, request->msg_size, request->msg_amount); @@ -192,7 +192,7 @@ void amok_bw_test(xbt_socket_t peer, xbt_socket_peer_name(peer), request_ack->peer.port); } XBT_DEBUG - ("Got ACK; conduct the experiment (msg_size = %ld, msg_amount=%ld)", + ("Got ACK; conduct the experiment (msg_size = %lu, msg_amount=%lu)", request->msg_size, request->msg_amount); *sec = 0; @@ -462,7 +462,7 @@ void amok_bw_request(const char *from_name, unsigned int from_port, - XBT_DEBUG("Ask for a BW test between %s:%d and %s:%d", from_name, from_port, + XBT_DEBUG("Ask for a BW test between %s:%u and %s:%u", from_name, from_port, to_name, to_port); gras_msg_rpccall(sock, 20 * 60, "BW request", &request, &result); @@ -471,7 +471,7 @@ void amok_bw_request(const char *from_name, unsigned int from_port, if (bw) *bw = result->bw; - XBT_VERB("BW test (%s:%d -> %s:%d) took %f sec (%f kb/s)", + XBT_VERB("BW test (%s:%u -> %s:%u) took %f sec (%f kb/s)", from_name, from_port, to_name, to_port, result->sec, ((double) result->bw) / 1024.0); @@ -489,7 +489,7 @@ int amok_bw_cb_bw_request(gras_msg_cb_ctx_t ctx, void *payload) xbt_socket_t peer, asker; asker = gras_msg_cb_ctx_from(ctx); - XBT_VERB("Asked by %s:%d to conduct a bw XP with %s:%d (request: %ld %ld)", + XBT_VERB("Asked by %s:%d to conduct a bw XP with %s:%d (request: %lu %lu)", xbt_socket_peer_name(asker), xbt_socket_peer_port(asker), request->peer.name, request->peer.port, request->msg_size, request->msg_amount); diff --git a/src/amok/Bandwidth/saturate.c b/src/amok/Bandwidth/saturate.c index 191f18aabb..fc374dd756 100644 --- a/src/amok/Bandwidth/saturate.c +++ b/src/amok/Bandwidth/saturate.c @@ -79,7 +79,7 @@ void amok_bw_saturate_start(const char *from_name, unsigned int from_port, xbt_socket_t sock; sat_request_t request = xbt_new(s_sat_request_t, 1); - XBT_VERB("Start from_name %s:%d -> to_name %s:%d", + XBT_VERB("Start from_name %s:%u -> to_name %s:%u", from_name, from_port, to_name, to_port); sock = gras_socket_client(from_name, from_port); @@ -151,7 +151,7 @@ void amok_bw_saturate_begin(const char *to_name, unsigned int to_port, /* Negociate the saturation with the peer */ sat_request_t request = xbt_new(s_sat_request_t, 1); - XBT_DEBUG("Begin to saturate to %s:%d", to_name, to_port); + XBT_DEBUG("Begin to saturate to %s:%u", to_name, to_port); memset(&msg_got, 0, sizeof(msg_got)); request->msg_size = msg_size; @@ -170,7 +170,7 @@ void amok_bw_saturate_begin(const char *to_name, unsigned int to_port, 1, /* at least one sec */ &sec, &bw); msg_size = request->msg_size = (int) bw; - XBT_DEBUG("Saturate with packets of %d bytes", request->msg_size); + XBT_DEBUG("Saturate with packets of %u bytes", request->msg_size); } /* Launch the saturation */ @@ -186,7 +186,7 @@ void amok_bw_saturate_begin(const char *to_name, unsigned int to_port, free(request); gras_socket_close(peer_cmd); - XBT_INFO("Saturation(%s:%d->%s:%d) started", gras_os_myname(), + XBT_INFO("Saturation(%s:%d->%s:%u) started", gras_os_myname(), gras_os_myport(), to_name, to_port); /* Start experiment */ @@ -215,7 +215,7 @@ void amok_bw_saturate_begin(const char *to_name, unsigned int to_port, /* Check whether the experiment has to be terminated by now */ elapsed = gras_os_time() - start; - XBT_DEBUG("elapsed %f duration %f (msg_size=%d)", elapsed, duration, + XBT_DEBUG("elapsed %f duration %f (msg_size=%u)", elapsed, duration, msg_size); } while (saturate_further && (duration == 0 || elapsed < duration)); @@ -232,7 +232,7 @@ void amok_bw_saturate_begin(const char *to_name, unsigned int to_port, bw_res_t answer = xbt_new(s_bw_res_t, 1); s_gras_msg_cb_ctx_t ctx; - XBT_INFO("Saturation from %s:%d to %s:%d stopped by %s:%d", + XBT_INFO("Saturation from %s:%d to %s:%u stopped by %s:%d", gras_os_myname(), gras_os_myport(), to_name, to_port, xbt_socket_peer_name(msg_got.expe), xbt_socket_peer_port(msg_got.expe)); @@ -248,7 +248,7 @@ void amok_bw_saturate_begin(const char *to_name, unsigned int to_port, free(answer); } else { XBT_INFO - ("Saturation from %s:%d to %s:%d elapsed after %f sec (achieving %f kb/s)", + ("Saturation from %s:%d to %s:%u elapsed after %f sec (achieving %f kb/s)", gras_os_myname(), gras_os_myport(), to_name, to_port, elapsed, bw / 1024.0); } @@ -332,12 +332,12 @@ void amok_bw_saturate_stop(const char *from_name, unsigned int from_port, { xbt_socket_t sock = gras_socket_client(from_name, from_port); bw_res_t answer; - XBT_VERB("Ask %s:%d to stop the saturation", from_name, from_port); + XBT_VERB("Ask %s:%u to stop the saturation", from_name, from_port); TRY { gras_msg_rpccall(sock, 60, "amok_bw_sat stop", NULL, &answer); } CATCH_ANONYMOUS { - RETHROWF("Cannot ask %s:%d to stop saturation: %s", from_name, from_port); + RETHROWF("Cannot ask %s:%u to stop saturation: %s", from_name, from_port); } gras_socket_close(sock); if (time) diff --git a/src/gras/Msg/gras_msg_exchange.c b/src/gras/Msg/gras_msg_exchange.c index 993ae1ebe2..4ef5303a35 100644 --- a/src/gras/Msg/gras_msg_exchange.c +++ b/src/gras/Msg/gras_msg_exchange.c @@ -402,7 +402,7 @@ void gras_msg_handle(volatile double timeOut) volatile unsigned int cpt2 = cpt; if (!ran_ok) { XBT_DEBUG - ("Use the callback #%d (@%p) for incomming msg '%s' (payload_size=%d)", + ("Use the callback #%u (@%p) for incomming msg '%s' (payload_size=%d)", cpt + 1, cb, msg.type->name, msg.payl_size); if (!cb(&ctx, msg.payl)) { /* cb handled the message */ @@ -442,7 +442,7 @@ void gras_msg_handle(volatile double timeOut) ran_ok = 1; } else { RETHROWF - ("Callback #%d (@%p) to message '%s' (payload size: %d) raised an exception: %s", + ("Callback #%u (@%p) to message '%s' (payload size: %d) raised an exception: %s", cpt + 1, cb, msg.type->name, msg.payl_size); } } @@ -481,7 +481,7 @@ void gras_msg_handle(volatile double timeOut) default: THROWF(unknown_error, 0, - "Cannot handle messages of kind %d yet", msg.type->kind); + "Cannot handle messages of kind %d yet", (int)msg.type->kind); } } diff --git a/src/gras/Msg/gras_msg_types.c b/src/gras/Msg/gras_msg_types.c index a2f5d07367..8d43297815 100644 --- a/src/gras/Msg/gras_msg_types.c +++ b/src/gras/Msg/gras_msg_types.c @@ -289,7 +289,7 @@ void gras_cb_unregister_(gras_msgtype_t msgtype, gras_msg_cb_t cb) } } if (!found) - XBT_VERB("Ignoring removal of unexisting callback to msg id %d", + XBT_VERB("Ignoring removal of unexisting callback to msg id %u", msgtype->code); } diff --git a/src/gras/Msg/rl_msg.c b/src/gras/Msg/rl_msg.c index a973c66d46..738b911f4f 100644 --- a/src/gras/Msg/rl_msg.c +++ b/src/gras/Msg/rl_msg.c @@ -63,7 +63,7 @@ void gras_msg_send_ext(xbt_socket_t sock, break; default: - THROWF(unknown_error, 0, "Unknown msg kind %d", kind); + THROWF(unknown_error, 0, "Unknown msg kind %d", (int)kind); } xbt_datadesc_send(sock, string_type, &msgtype->name); diff --git a/src/gras/Msg/rpc.c b/src/gras/Msg/rpc.c index 608e06c37d..9dd7549b5f 100644 --- a/src/gras/Msg/rpc.c +++ b/src/gras/Msg/rpc.c @@ -87,7 +87,7 @@ static int msgfilter_rpcID(gras_msg_t msg, void *ctx) xbt_dynar_foreach(_gras_rpc_cancelled, cursor, rpc_ctx) { if (msg->ID == rpc_ctx->ID && msg->kind == e_gras_msg_kind_rpcanswer) { XBT_VERB - ("Got an answer to the already canceled (timeouted?) RPC %ld. Ignore it (leaking the payload!).", + ("Got an answer to the already canceled (timeouted?) RPC %lu. Ignore it (leaking the payload!).", msg->ID); xbt_dynar_cursor_rm(_gras_rpc_cancelled, &cursor); return 1; @@ -172,7 +172,7 @@ void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer) _gras_rpc_cancelled = xbt_dynar_new(sizeof(ctx), NULL); xbt_dynar_push(_gras_rpc_cancelled, &ctx); XBT_INFO - ("canceled RPC %ld pushed onto the stack (%s from %s:%d) Reason: %s", + ("canceled RPC %lu pushed onto the stack (%s from %s:%d) Reason: %s", ctx->ID, ctx->msgtype->name, xbt_socket_peer_name(ctx->expeditor), xbt_socket_peer_port(ctx->expeditor), e.msg); @@ -185,7 +185,7 @@ void gras_msg_rpc_async_wait(gras_msg_cb_ctx_t ctx, void *answer) memcpy(&e, received.payl, received.payl_size); free(received.payl); XBT_VERB("Raise a remote exception cat:%d coming from %s (%s)", - e.category, e.host, e.msg); + (int)e.category, e.host, e.msg); __xbt_running_ctx_fetch()->exception.msg = e.msg; __xbt_running_ctx_fetch()->exception.category = e.category; __xbt_running_ctx_fetch()->exception.value = e.value; diff --git a/src/gras/Msg/sg_msg.c b/src/gras/Msg/sg_msg.c index 4f49dec5ba..0471d13b68 100644 --- a/src/gras/Msg/sg_msg.c +++ b/src/gras/Msg/sg_msg.c @@ -159,7 +159,7 @@ gras_msg_t gras_msg_recv_any(void) sock_data->rdv_client : sock_data->rdv_server); xbt_dynar_push(comms, &(sock_data->comm_recv)); } - XBT_VERB("Wait on %ld 'sockets'", xbt_dynar_length(comms)); + XBT_VERB("Wait on %lu 'sockets'", xbt_dynar_length(comms)); /* Wait for the end of any of these communications */ got = simcall_comm_waitany(comms); diff --git a/src/gras/Transport/transport.c b/src/gras/Transport/transport.c index 7b025cae6e..79cc64ac61 100644 --- a/src/gras/Transport/transport.c +++ b/src/gras/Transport/transport.c @@ -208,7 +208,7 @@ void gras_socket_close(xbt_socket_t sock) for (cursor = 0; cursor < xbt_dynar_length(sockets); cursor++) { _xbt_dynar_cursor_get(sockets, cursor, &sock_iter); if (sock == sock_iter) { - XBT_DEBUG("remove sock cursor %d dize %lu\n", cursor, + XBT_DEBUG("remove sock cursor %u dize %lu\n", cursor, xbt_dynar_length(sockets)); xbt_dynar_cursor_rm(sockets, &cursor); if (sock->plugin->socket_close) diff --git a/src/gras/Transport/transport_plugin_file.c b/src/gras/Transport/transport_plugin_file.c index ba81c85567..0951ef75b9 100644 --- a/src/gras/Transport/transport_plugin_file.c +++ b/src/gras/Transport/transport_plugin_file.c @@ -208,7 +208,6 @@ gras_trp_file_chunk_send_raw(xbt_socket_t sock, { xbt_assert(sock->outgoing, "Cannot write on client file socket"); - xbt_assert(size >= 0, "Cannot send a negative amount of data"); while (size) { int status = 0; @@ -244,7 +243,6 @@ gras_trp_file_chunk_recv(xbt_socket_t sock, xbt_assert(sock, "Cannot recv on an NULL socket"); xbt_assert(sock->incoming, "Cannot recv on client file socket"); - xbt_assert(size >= 0, "Cannot receive a negative amount of data"); if (sock->recvd) { data[0] = sock->recvd_val; @@ -257,7 +255,7 @@ gras_trp_file_chunk_recv(xbt_socket_t sock, int status = 0; status = read(sock->sd, data + got, (long int) size); - XBT_DEBUG("read(%d, %p, %ld);", sock->sd, data + got, size); + XBT_DEBUG("read(%d, %p, %lu);", sock->sd, data + got, size); if (status < 0) { THROWF(system_error, 0, "read(%d,%p,%d) failed: %s", diff --git a/src/gras/Transport/transport_plugin_sg.c b/src/gras/Transport/transport_plugin_sg.c index 277aea06e6..ebdc3d9255 100644 --- a/src/gras/Transport/transport_plugin_sg.c +++ b/src/gras/Transport/transport_plugin_sg.c @@ -266,7 +266,7 @@ void gras_trp_sg_socket_close(xbt_socket_t sock) if (sock->incoming && !sock->outgoing && sockdata->server_port >= 0) { /* server mode socket. Unregister it from 'OS' tables */ xbt_dynar_foreach(hd->ports, cpt, pr) { - XBT_DEBUG("Check pr %d of %lu", cpt, xbt_dynar_length(hd->ports)); + XBT_DEBUG("Check pr %u of %lu", cpt, xbt_dynar_length(hd->ports)); if (pr->port == sockdata->server_port) { xbt_dynar_cursor_rm(hd->ports, &cpt); XBT_OUT(); diff --git a/src/gras/Virtu/process.c b/src/gras/Virtu/process.c index 24c0f62f75..b2d442cab8 100644 --- a/src/gras/Virtu/process.c +++ b/src/gras/Virtu/process.c @@ -134,14 +134,14 @@ void gras_procdata_init() xbt_dynar_foreach(_gras_procdata_fabrics, cursor, fab) { if (cursor + 1 <= xbt_set_length(pd->libdata)) { - XBT_DEBUG("Skip fabric %d: there is already %ld libdata", + XBT_DEBUG("Skip fabric %u: there is already %lu libdata", cursor, xbt_set_length(pd->libdata)); continue; /* allow to recall this function to get recently added fabrics */ } - XBT_DEBUG("Go ahead for cursor %d, there is %ld libdata", + XBT_DEBUG("Go ahead for cursor %u, there is %lu libdata", cursor, xbt_set_length(pd->libdata)); - xbt_assert(fab.name, "Name of fabric #%d is NULL!", cursor); + xbt_assert(fab.name, "Name of fabric #%u is NULL!", cursor); XBT_DEBUG("Create the procdata for %s", fab.name); /* Check for our own errors */ diff --git a/src/gras/Virtu/sg_process.c b/src/gras/Virtu/sg_process.c index ea7e0f5492..1841604c5c 100644 --- a/src/gras/Virtu/sg_process.c +++ b/src/gras/Virtu/sg_process.c @@ -105,7 +105,7 @@ void gras_process_exit() unsigned int cpt; s_gras_msg_t msg; XBT_WARN - ("process %d terminated, but %ld messages are still queued. Message list:", + ("process %d terminated, but %lu messages are still queued. Message list:", gras_os_getpid(), xbt_dynar_length(msg_pd->msg_queue)); xbt_dynar_foreach(msg_pd->msg_queue, cpt, msg) { XBT_WARN(" Message %s (%s) from %s@%s:%d", msg.type->name, diff --git a/src/include/surf/random_mgr.h b/src/include/surf/random_mgr.h index 55ff757741..3580ab4738 100644 --- a/src/include/surf/random_mgr.h +++ b/src/include/surf/random_mgr.h @@ -14,19 +14,20 @@ SG_BEGIN_DECL() -typedef enum { NONE, DRAND48, RAND, RNGSTREAM } Generator; +typedef enum { NONE, DRAND48, RAND, RNGSTREAM } e_random_generator_t; typedef struct random_data_desc { long int seed; double max, min; double mean, std; /* note: mean and standard deviation are normalized */ - Generator generator; + e_random_generator_t generator; } s_random_data_t, *random_data_t; XBT_PUBLIC_DATA(xbt_dict_t) random_data_list; XBT_PUBLIC(double) random_generate(random_data_t random); -XBT_PUBLIC(random_data_t) random_new(Generator generator, long int seed, +XBT_PUBLIC(random_data_t) random_new(e_random_generator_t generator, + long int seed, double min, double max, double mean, double stdDeviation); diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index aff8a88f87..24eaf2b0d7 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -25,7 +25,7 @@ typedef enum { SURF_NETWORK_ELEMENT_NULL = 0, /* NULL */ SURF_NETWORK_ELEMENT_HOST, /* host type */ SURF_NETWORK_ELEMENT_ROUTER, /* router type */ - SURF_NETWORK_ELEMENT_AS, /* AS type */ + SURF_NETWORK_ELEMENT_AS /* AS type */ } e_surf_network_element_type_t; XBT_PUBLIC(e_surf_network_element_type_t) diff --git a/src/include/surf/surf_resource_lmm.h b/src/include/surf/surf_resource_lmm.h index 4f7eb940f0..992f70db07 100644 --- a/src/include/surf/surf_resource_lmm.h +++ b/src/include/surf/surf_resource_lmm.h @@ -20,7 +20,7 @@ static XBT_INLINE lmm_system_t system, double constraint_value, tmgr_history_t history, - int state_init, + e_surf_resource_state_t state_init, tmgr_trace_t state_trace, double metric_peak, tmgr_trace_t metric_trace) diff --git a/src/instr/instr_private.h b/src/instr/instr_private.h index ce67b0923a..2125632fd0 100644 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@ -29,7 +29,7 @@ typedef enum { TYPE_LINK, TYPE_CONTAINER, TYPE_STATE, - TYPE_EVENT, + TYPE_EVENT } e_entity_types; typedef struct s_type *type_t; @@ -58,7 +58,7 @@ typedef enum { INSTR_AS, INSTR_SMPI, INSTR_MSG_PROCESS, - INSTR_MSG_TASK, + INSTR_MSG_TASK } e_container_types; typedef struct s_container *container_t; diff --git a/src/msg/msg_actions.c b/src/msg/msg_actions.c index ea4bdba612..92f9288816 100644 --- a/src/msg/msg_actions.c +++ b/src/msg/msg_actions.c @@ -56,7 +56,8 @@ static int MSG_action_runner(int argc, char *argv[]) if (action_fp) { // A unique trace file while ((evt = action_get_action(argv[0]))) { - msg_action_fun function = xbt_dict_get(action_funs, evt[1]); + msg_action_fun function = + (msg_action_fun)xbt_dict_get(action_funs, evt[1]); function(evt); free(evt); } @@ -69,7 +70,8 @@ static int MSG_action_runner(int argc, char *argv[]) xbt_replay_trace_reader_t reader = xbt_replay_trace_reader_new(argv[1]); while ((evt=xbt_replay_trace_reader_get(reader))) { if (!strcmp(argv[0],evt[0])) { - msg_action_fun function = xbt_dict_get(action_funs, evt[1]); + msg_action_fun function = + (msg_action_fun)xbt_dict_get(action_funs, evt[1]); function(evt); free(evt); } else { @@ -98,7 +100,6 @@ void _MSG_action_exit() static const char **action_get_action(char *name) { - ssize_t read; xbt_dynar_t evt = NULL; char *evtname = NULL; @@ -110,7 +111,7 @@ static const char **action_get_action(char *name) } // Read lines until I reach something for me (which breaks in loop body) // or end of file reached - while ((read = getline(&action_line, &action_len, action_fp)) != -1) { + while (getline(&action_line, &action_len, action_fp) != -1) { // cleanup and split the string I just read char *comment = strchr(action_line, '#'); if (comment != NULL) diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index dc1b77a96d..9ed804e03e 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -68,7 +68,7 @@ MSG_error_t MSG_task_execute(m_task_t task) simdata->isused=0; - XBT_DEBUG("Execution task '%s' finished in state %d", task->name, comp_state); + XBT_DEBUG("Execution task '%s' finished in state %d", task->name, (int)comp_state); if (comp_state == SIMIX_DONE) { /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */ simdata->computation_amount = 0.0; @@ -185,7 +185,7 @@ MSG_error_t MSG_parallel_task_execute(m_task_t task) comp_state = simcall_host_execution_wait(simdata->compute); p_simdata->waiting_action = NULL; - XBT_DEBUG("Finished waiting for execution of action %p, state = %d", simdata->compute, comp_state); + XBT_DEBUG("Finished waiting for execution of action %p, state = %d", simdata->compute, (int)comp_state); simdata->isused=0; diff --git a/src/simdag/sd_daxloader.c b/src/simdag/sd_daxloader.c index 684f656f0c..c44a71926d 100644 --- a/src/simdag/sd_daxloader.c +++ b/src/simdag/sd_daxloader.c @@ -258,7 +258,7 @@ static void dump_res() unsigned int cursor; SD_task_t task; xbt_dynar_foreach(result, cursor, task) { - XBT_INFO("Task %d", cursor); + XBT_INFO("Task %u", cursor); SD_task_dump(task); } } @@ -312,12 +312,11 @@ xbt_dynar_t SD_daxload(const char *filename) xbt_dict_foreach(files, cursor, name, file) { unsigned int cpt1, cpt2; - SD_task_t newfile = NULL; + SD_task_t newfile; SD_dependency_t depbefore, depafter; if (xbt_dynar_is_empty(file->tasks_before)) { xbt_dynar_foreach(file->tasks_after, cpt2, depafter) { - SD_task_t newfile = - SD_task_create_comm_e2e(file->name, NULL, file->amount); + newfile = SD_task_create_comm_e2e(file->name, NULL, file->amount); SD_task_dependency_add(NULL, NULL, root_task, newfile); SD_task_dependency_add(NULL, NULL, newfile, depafter->dst); #ifdef HAVE_TRACING @@ -333,8 +332,7 @@ xbt_dynar_t SD_daxload(const char *filename) } } else if (xbt_dynar_is_empty(file->tasks_after)) { xbt_dynar_foreach(file->tasks_before, cpt2, depbefore) { - SD_task_t newfile = - SD_task_create_comm_e2e(file->name, NULL, file->amount); + newfile = SD_task_create_comm_e2e(file->name, NULL, file->amount); SD_task_dependency_add(NULL, NULL, depbefore->src, newfile); SD_task_dependency_add(NULL, NULL, newfile, end_task); #ifdef HAVE_TRACING @@ -356,8 +354,7 @@ xbt_dynar_t SD_daxload(const char *filename) ("File %s is produced and consumed by task %s. This loop dependency will prevent the execution of the task.", file->name, depbefore->src->name); } - newfile = - SD_task_create_comm_e2e(file->name, NULL, file->amount); + newfile = SD_task_create_comm_e2e(file->name, NULL, file->amount); SD_task_dependency_add(NULL, NULL, depbefore->src, newfile); SD_task_dependency_add(NULL, NULL, newfile, depafter->dst); #ifdef HAVE_TRACING diff --git a/src/simdag/sd_task.c b/src/simdag/sd_task.c index 9109ff9a63..038d46e857 100644 --- a/src/simdag/sd_task.c +++ b/src/simdag/sd_task.c @@ -372,7 +372,7 @@ void SD_task_dump(SD_task_t task) } } XBT_INFO(" - amount: %.0f", SD_task_get_amount(task)); - XBT_INFO(" - Dependencies to satisfy: %d", task->unsatisfied_dependencies); + XBT_INFO(" - Dependencies to satisfy: %u", task->unsatisfied_dependencies); if (!xbt_dynar_is_empty(task->tasks_before)) { XBT_INFO(" - pre-dependencies:"); xbt_dynar_foreach(task->tasks_before, counter, dependency) { @@ -877,7 +877,7 @@ void __SD_task_really_run(SD_task_t task) xbt_assert(__SD_task_is_runnable_or_in_fifo(task), "Task '%s' is not runnable or in a fifo! Task state: %d", - SD_task_get_name(task), SD_task_get_state(task)); + SD_task_get_name(task), (int)SD_task_get_state(task)); xbt_assert(task->workstation_list != NULL, "Task '%s': workstation_list is NULL!", SD_task_get_name(task)); @@ -979,7 +979,7 @@ void __SD_task_really_run(SD_task_t task) __SD_task_destroy_scheduling_data(task); /* now the scheduling data are not useful anymore */ __SD_task_set_state(task, SD_RUNNING); xbt_assert(__SD_task_is_running(task), "Bad state of task '%s': %d", - SD_task_get_name(task), SD_task_get_state(task)); + SD_task_get_name(task), (int)SD_task_get_state(task)); } @@ -998,7 +998,7 @@ int __SD_task_try_to_run(SD_task_t task) xbt_assert(__SD_task_is_runnable(task), "Task '%s' is not runnable! Task state: %d", - SD_task_get_name(task), SD_task_get_state(task)); + SD_task_get_name(task), (int)SD_task_get_state(task)); for (i = 0; i < task->workstation_nb; i++) { @@ -1020,7 +1020,7 @@ int __SD_task_try_to_run(SD_task_t task) } __SD_task_set_state(task, SD_IN_FIFO); xbt_assert(__SD_task_is_in_fifo(task), "Bad state of task '%s': %d", - SD_task_get_name(task), SD_task_get_state(task)); + SD_task_get_name(task), (int)SD_task_get_state(task)); XBT_DEBUG("Task '%s' state is now SD_IN_FIFO", SD_task_get_name(task)); } else { __SD_task_really_run(task); @@ -1046,7 +1046,7 @@ void __SD_task_just_done(SD_task_t task) xbt_assert(__SD_task_is_running(task), "The task must be running! Task state: %d", - SD_task_get_state(task)); + (int)SD_task_get_state(task)); xbt_assert(task->workstation_list != NULL, "Task '%s': workstation_list is NULL!", SD_task_get_name(task)); @@ -1065,7 +1065,7 @@ void __SD_task_just_done(SD_task_t task) for (i = 0; i < task->workstation_nb; i++) { workstation = task->workstation_list[i]; XBT_DEBUG("Workstation '%s': access_mode = %d", - SD_workstation_get_name(workstation), workstation->access_mode); + SD_workstation_get_name(workstation), (int)workstation->access_mode); if (workstation->access_mode == SD_WORKSTATION_SEQUENTIAL_ACCESS) { xbt_assert(workstation->task_fifo != NULL, "Workstation '%s' has sequential access but no fifo!", @@ -1088,7 +1088,7 @@ void __SD_task_just_done(SD_task_t task) xbt_assert(__SD_task_is_in_fifo(candidate), "Bad state of candidate '%s': %d", SD_task_get_name(candidate), - SD_task_get_state(candidate)); + (int)SD_task_get_state(candidate)); } XBT_DEBUG("Candidate in fifo: %p", candidate); @@ -1127,7 +1127,7 @@ void __SD_task_just_done(SD_task_t task) xbt_assert(__SD_task_is_in_fifo(candidate), "Bad state of candidate '%s': %d", - SD_task_get_name(candidate), SD_task_get_state(candidate)); + SD_task_get_name(candidate), (int)SD_task_get_state(candidate)); for (j = 0; j < candidate->workstation_nb && can_start; j++) { workstation = candidate->workstation_list[j]; @@ -1161,7 +1161,7 @@ void __SD_task_just_done(SD_task_t task) /* finally execute the task */ XBT_DEBUG("Task '%s' state: %d", SD_task_get_name(candidate), - SD_task_get_state(candidate)); + (int)SD_task_get_state(candidate)); __SD_task_really_run(candidate); XBT_DEBUG @@ -1171,7 +1171,7 @@ void __SD_task_just_done(SD_task_t task) xbt_assert(__SD_task_is_running(candidate), "Bad state of task '%s': %d", SD_task_get_name(candidate), - SD_task_get_state(candidate)); + (int)SD_task_get_state(candidate)); XBT_DEBUG("Okay, the task is running."); } /* can start */ diff --git a/src/simix/smx_context_raw.c b/src/simix/smx_context_raw.c index 7fb23eb2cb..fa653a78c8 100644 --- a/src/simix/smx_context_raw.c +++ b/src/simix/smx_context_raw.c @@ -97,10 +97,14 @@ __asm__ ( ); #elif PROCESSOR_x86_64 __asm__ ( -#if defined(APPLE) || defined(_WIN32) +#if defined(APPLE) ".text\n" ".globl _raw_makecontext\n" "_raw_makecontext:\n" +#elif defined(_WIN32) + ".text\n" + ".globl raw_makecontext\n" + "raw_makecontext:\n" #else ".text\n" ".globl raw_makecontext\n" @@ -128,10 +132,14 @@ __asm__ ( ); __asm__ ( -#if defined(APPLE) || defined(_WIN32) +#if defined(APPLE) ".text\n" ".globl _raw_swapcontext\n" "_raw_swapcontext:\n" +#elif defined(_WIN32) + ".text\n" + ".globl raw_swapcontext\n" + "raw_swapcontext:\n" #else ".text\n" ".globl raw_swapcontext\n" diff --git a/src/simix/smx_deployment.c b/src/simix/smx_deployment.c index f5187d4209..511e69585a 100644 --- a/src/simix/smx_deployment.c +++ b/src/simix/smx_deployment.c @@ -177,7 +177,7 @@ xbt_main_func_t SIMIX_get_registered_function(const char *name) xbt_assert(simix_global, "SIMIX_global_init has to be called before SIMIX_get_registered_function."); - res = xbt_dict_get_or_null(simix_global->registered_functions, name); + res = (xbt_main_func_t)xbt_dict_get_or_null(simix_global->registered_functions, name); return res ? res : default_function; } diff --git a/src/simix/smx_global.c b/src/simix/smx_global.c index 3d6682deee..913abb2bf0 100644 --- a/src/simix/smx_global.c +++ b/src/simix/smx_global.c @@ -358,13 +358,13 @@ void SIMIX_display_process_status(void) action_description = "I/O"; break; } - XBT_INFO("Process %ld (%s@%s): waiting for %s action %p (%s) in state %d to finish", + XBT_INFO("Process %lu (%s@%s): waiting for %s action %p (%s) in state %d to finish", process->pid, process->name, process->smx_host->name, action_description, process->waiting_action, - process->waiting_action->name, process->waiting_action->state); + process->waiting_action->name, (int)process->waiting_action->state); } else { - XBT_INFO("Process %ld (%s@%s)", process->pid, process->name, process->smx_host->name); + XBT_INFO("Process %lu (%s@%s)", process->pid, process->name, process->smx_host->name); } } } diff --git a/src/simix/smx_host.c b/src/simix/smx_host.c index 01a4de8831..08b7ebec38 100644 --- a/src/simix/smx_host.c +++ b/src/simix/smx_host.c @@ -299,7 +299,7 @@ void SIMIX_pre_host_execution_wait(smx_simcall_t simcall) { smx_action_t action = simcall->host_execution_wait.execution; - XBT_DEBUG("Wait for execution of action %p, state %d", action, action->state); + XBT_DEBUG("Wait for execution of action %p, state %d", action, (int)action->state); /* Associate this simcall to the action */ xbt_fifo_push(action->simcalls, simcall); @@ -355,7 +355,7 @@ void SIMIX_execution_finish(smx_action_t action) default: xbt_die("Internal error in SIMIX_execution_finish: unexpected action state %d", - action->state); + (int)action->state); } simcall->issuer->waiting_action = NULL; simcall->host_execution_wait.result = action->state; diff --git a/src/simix/smx_io.c b/src/simix/smx_io.c index 60fe284061..df706e660a 100644 --- a/src/simix/smx_io.c +++ b/src/simix/smx_io.c @@ -258,7 +258,7 @@ void SIMIX_io_finish(smx_action_t action) default: xbt_die("Internal error in SIMIX_io_finish: unexpected action state %d", - action->state); + (int)action->state); } simcall->issuer->waiting_action = NULL; SIMIX_simcall_answer(simcall); diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 74cefadfa5..db189293bd 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -154,7 +154,7 @@ smx_action_t SIMIX_rdv_get_comm(smx_rdv_t rdv, e_smx_comm_type_t type, } XBT_DEBUG("Sorry, communication action %p does not match our needs:" " its type is %d but we are looking for a comm of type %d", - action, action->comm.type, type); + action, (int)action->comm.type, (int)type); } XBT_DEBUG("No matching communication action found"); return NULL; @@ -247,7 +247,7 @@ smx_action_t SIMIX_comm_new(e_smx_comm_type_t type) void SIMIX_comm_destroy(smx_action_t action) { XBT_DEBUG("Destroy action %p (refcount: %d), state: %d", - action, action->comm.refcount, action->state); + action, action->comm.refcount, (int)action->state); if (action->comm.refcount <= 0) { xbt_backtrace_display_current(); @@ -588,7 +588,7 @@ void SIMIX_comm_finish(smx_action_t action) if (action->comm.rdv) SIMIX_rdv_remove(action->comm.rdv, action); - XBT_DEBUG("SIMIX_comm_finish: action state = %d", action->state); + XBT_DEBUG("SIMIX_comm_finish: action state = %d", (int)action->state); /* Check out for errors */ switch (action->state) { @@ -648,7 +648,7 @@ void SIMIX_comm_finish(smx_action_t action) break; default: - xbt_die("Unexpected action state in SIMIX_comm_finish: %d", action->state); + xbt_die("Unexpected action state in SIMIX_comm_finish: %d", (int)action->state); } /* if there is an exception during a waitany or a testany, indicate the position of the failed communication */ @@ -698,7 +698,7 @@ void SIMIX_post_comm(smx_action_t action) action->state = SIMIX_DONE; XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d", - action, action->state, action->comm.src_proc, action->comm.dst_proc, action->comm.detached); + action, (int)action->state, action->comm.src_proc, action->comm.dst_proc, action->comm.detached); /* destroy the surf actions associated with the Simix communication */ SIMIX_comm_destroy_internal_actions(action); diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index 5571160f6b..13dca2f9a2 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -253,7 +253,7 @@ static XBT_INLINE void SIMIX_context_suspend(smx_context_t context) /** \brief Executes all the processes to run (in parallel if possible). */ -static XBT_INLINE void SIMIX_context_runall() +static XBT_INLINE void SIMIX_context_runall(void) { simix_global->context_factory->runall(); } diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 048f5c3ec7..e830985671 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -56,7 +56,7 @@ void SIMIX_process_cleanup(smx_process_t process) if (action->comm.src_proc == process) { XBT_DEBUG("Found an unfinished send comm %p (detached = %d), state %d, src = %p, dst = %p", - action, action->comm.detached, action->state, action->comm.src_proc, action->comm.dst_proc); + action, action->comm.detached, (int)action->state, action->comm.src_proc, action->comm.dst_proc); action->comm.src_proc = NULL; if (action->comm.detached) { @@ -76,7 +76,7 @@ void SIMIX_process_cleanup(smx_process_t process) } else if (action->comm.dst_proc == process){ XBT_DEBUG("Found an unfinished recv comm %p, state %d, src = %p, dst = %p", - action, action->state, action->comm.src_proc, action->comm.dst_proc); + action, (int)action->state, action->comm.src_proc, action->comm.dst_proc); action->comm.dst_proc = NULL; if (action->comm.detached && action->comm.refcount == 1 @@ -306,7 +306,7 @@ void SIMIX_process_killall(smx_process_t issuer) } } - SIMIX_context_runall(simix_global->process_to_run); + SIMIX_context_runall(); SIMIX_process_empty_trash(); } @@ -370,7 +370,7 @@ void SIMIX_process_suspend(smx_process_t process, smx_process_t issuer) default: xbt_die("Internal error in SIMIX_process_suspend: unexpected action type %d", - process->waiting_action->type); + (int)process->waiting_action->type); } } } @@ -410,7 +410,7 @@ void SIMIX_process_resume(smx_process_t process, smx_process_t issuer) default: xbt_die("Internal error in SIMIX_process_resume: unexpected action type %d", - process->waiting_action->type); + (int)process->waiting_action->type); } } else { diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c index 56863f8051..4e7c79da76 100644 --- a/src/simix/smx_smurf.c +++ b/src/simix/smx_smurf.c @@ -20,7 +20,7 @@ void SIMIX_simcall_push(smx_process_t self) { if (self != simix_global->maestro_process) { XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, - SIMIX_simcall_name(self->simcall.call), self->simcall.call); + SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call); SIMIX_process_yield(self); } else { SIMIX_simcall_pre(&self->simcall, 0); @@ -30,7 +30,7 @@ void SIMIX_simcall_push(smx_process_t self) void SIMIX_simcall_answer(smx_simcall_t simcall) { if (simcall->issuer != simix_global->maestro_process){ - XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), simcall->call, + XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), (int)simcall->call, simcall->issuer->name, simcall->issuer); simcall->issuer->simcall.call = SIMCALL_NONE; xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, simcall->issuer); diff --git a/src/simix/smx_synchro.c b/src/simix/smx_synchro.c index d09b4163f9..c9af7b95a8 100644 --- a/src/simix/smx_synchro.c +++ b/src/simix/smx_synchro.c @@ -392,7 +392,7 @@ void SIMIX_cond_destroy(smx_cond_t cond) /** @brief Initialize a semaphore */ smx_sem_t SIMIX_sem_init(unsigned int value) { - XBT_IN("(%d)",value); + XBT_IN("(%u)",value); s_smx_process_t p; smx_sem_t sem = xbt_new0(s_smx_sem_t, 1); diff --git a/src/surf/cpu_cas01.c b/src/surf/cpu_cas01.c index 3755de922a..6ba5ee425a 100644 --- a/src/surf/cpu_cas01.c +++ b/src/surf/cpu_cas01.c @@ -305,9 +305,9 @@ static double cpu_share_resources_lazy(double now) } static double cpu_share_resources_full(double now) { - surf_action_cpu_Cas01_t action; + s_surf_action_cpu_Cas01_t action; return generic_maxmin_share_resources(surf_cpu_model->states.running_action_set, - xbt_swag_offset(*action, generic_lmm_action.variable), + xbt_swag_offset(action, generic_lmm_action.variable), cpu_maxmin_system, lmm_solve); } @@ -434,8 +434,6 @@ static void cpu_update_resource_state(void *id, cpu->state_current = SURF_RESOURCE_ON; else { lmm_constraint_t cnst = cpu->constraint; - lmm_variable_t var = NULL; - lmm_element_t elem = NULL; cpu->state_current = SURF_RESOURCE_OFF; diff --git a/src/surf/network.c b/src/surf/network.c index 0da4bbfe07..af6e1ed707 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -80,7 +80,7 @@ static void heap_insert(surf_action_network_CM02_t action, double key, enum h } static void heap_remove(surf_action_network_CM02_t action){ - action->hat = NONE; + action->hat = NOTSET; if(((surf_action_network_CM02_t) action)->index_heap >= 0){ xbt_heap_remove(net_action_heap,action->index_heap); } diff --git a/src/surf/random_mgr.c b/src/surf/random_mgr.c index 6fb652d53f..8bad98fa8a 100644 --- a/src/surf/random_mgr.c +++ b/src/surf/random_mgr.c @@ -191,7 +191,7 @@ int _rand_r(unsigned int *pseed) #endif -static double custom_random(Generator generator, long int *seed) +static double custom_random(e_random_generator_t generator, long int *seed) { switch (generator) { @@ -252,7 +252,7 @@ double random_generate(random_data_t random) return X * (random->max - random->min) + random->min; } -random_data_t random_new(Generator generator, long int seed, +random_data_t random_new(e_random_generator_t generator, long int seed, double min, double max, double mean, double std) { random_data_t random = xbt_new0(s_random_data_t, 1); diff --git a/src/surf/surf.c b/src/surf/surf.c index 2b5121ab8a..e78088e9ee 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -465,9 +465,12 @@ double surf_solve(double max_date) } surf_min_index = 0; + if (surf_get_nthreads() > 1) { /* parallel version */ +#ifdef CONTEXT_THREADS xbt_parmap_apply(surf_parmap, (void_f_pvoid_t) surf_share_resources, model_list); +#endif } else { /* sequential version */ @@ -551,7 +554,9 @@ double surf_solve(double max_date) if (surf_get_nthreads() > 1) { /* parallel version */ +#ifdef CONTEXT_THREADS xbt_parmap_apply(surf_parmap, (void_f_pvoid_t) surf_update_actions_state, model_list); +#endif } else { /* sequential version */ diff --git a/src/surf/surf_private.h b/src/surf/surf_private.h index 25731a2e43..bb7ee785a1 100644 --- a/src/surf/surf_private.h +++ b/src/surf/surf_private.h @@ -20,7 +20,7 @@ typedef enum { UM_FULL, UM_LAZY, - UM_UNDEFINED, + UM_UNDEFINED } e_UM_t; /* user-visible parameters */ diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 1d11084198..7ae78fcaee 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -328,7 +328,7 @@ void routing_AS_begin(const char *AS_id, const char *wanted_routing_type) for (cpt = 0; routing_models[cpt].name; cpt++) fprintf(stderr, " %s: %s\n", routing_models[cpt].name, routing_models[cpt].desc); - xbt_die(NULL); + xbt_die("dying"); } /* make a new routing component */ @@ -1012,7 +1012,24 @@ static void routing_parse_Srandom(void) int start, end; xbt_dynar_t radical_ends; - random->generator = A_surfxml_random_generator; + switch (A_surfxml_random_generator) { + case AU_surfxml_random_generator: + case A_surfxml_random_generator_NONE: + random->generator = NONE; + break; + case A_surfxml_random_generator_DRAND48: + random->generator = DRAND48; + break; + case A_surfxml_random_generator_RAND: + random->generator = RAND; + break; + case A_surfxml_random_generator_RNGSTREAM: + random->generator = RNGSTREAM; + break; + default: + surf_parse_error("Invalid random generator"); + break; + } random->seed = seed; random->min = min; random->max = max; @@ -1036,7 +1053,7 @@ static void routing_parse_Srandom(void) XBT_DEBUG ("id = '%s' min = '%f' max = '%f' mean = '%f' std_deviatinon = '%f' generator = '%d' seed = '%ld' radical = '%s'", random_id, random->min, random->max, random->mean, random->std, - random->generator, random->seed, random_radical); + (int)random->generator, random->seed, random_radical); if (!random_value) random_value = xbt_dict_new_homogeneous(free); diff --git a/src/surf/surf_routing_floyd.c b/src/surf/surf_routing_floyd.c index ea030ea1fd..4d71a2273d 100644 --- a/src/surf/surf_routing_floyd.c +++ b/src/surf/surf_routing_floyd.c @@ -248,7 +248,6 @@ void model_floyd_parse_route(AS_t rc, const char *src, /* set the size of table routing */ size_t table_size = xbt_dict_length(rc->to_index); int *src_id, *dst_id; - int i,j; src_id = xbt_dict_get_or_null(rc->to_index, src); dst_id = xbt_dict_get_or_null(rc->to_index, dst); @@ -258,6 +257,7 @@ void model_floyd_parse_route(AS_t rc, const char *src, if(!as->link_table) { + int i,j; /* Create Cost, Predecessor and Link tables */ as->cost_table = xbt_new0(double, table_size * table_size); /* link cost from host to host */ as->predecessor_table = xbt_new0(int, table_size * table_size); /* predecessor host numbers */ diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index a9fcb6ce9d..18a6a7a2c4 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -497,16 +497,16 @@ void STag_surfxml_random(void){ #define parse_method(type,name) \ void type##Tag_surfxml_##name(void) \ { surfxml_call_cb_functions(type##Tag_surfxml_##name##_cb_list); } -parse_method(E, route); -parse_method(E, link_ctn); -parse_method(E, process); -parse_method(E, argument); -parse_method(E, prop); -parse_method(E, trace); -parse_method(E, trace_connect); -parse_method(E, random); -parse_method(E, ASroute); -parse_method(E, bypassRoute); +parse_method(E, route) +parse_method(E, link_ctn) +parse_method(E, process) +parse_method(E, argument) +parse_method(E, prop) +parse_method(E, trace) +parse_method(E, trace_connect) +parse_method(E, random) +parse_method(E, ASroute) +parse_method(E, bypassRoute) /* Open and Close parse file */ @@ -638,8 +638,8 @@ double get_cpu_power(const char *power) return power_scale; } -double random_min, random_max, random_mean, random_std_deviation, - random_generator; +double random_min, random_max, random_mean, random_std_deviation; +e_random_generator_t random_generator; char *random_id; static void init_randomness(void) @@ -649,7 +649,24 @@ static void init_randomness(void) random_max = surf_parse_get_double(A_surfxml_random_max); random_mean = surf_parse_get_double(A_surfxml_random_mean); random_std_deviation = surf_parse_get_double(A_surfxml_random_std_deviation); - random_generator = A_surfxml_random_generator; + switch (A_surfxml_random_generator) { + case AU_surfxml_random_generator: + case A_surfxml_random_generator_NONE: + random_generator = NONE; + break; + case A_surfxml_random_generator_DRAND48: + random_generator = DRAND48; + break; + case A_surfxml_random_generator_RAND: + random_generator = RAND; + break; + case A_surfxml_random_generator_RNGSTREAM: + random_generator = RNGSTREAM; + break; + default: + surf_parse_error("Invalid random generator"); + break; + } } static void add_randomness(void) diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 2c7319421f..b241314578 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -276,7 +276,7 @@ static double ws_get_link_latency(const void *link) static int ws_link_shared(const void *link) { - return surf_network_model->extension.network.get_link_latency(link); + return surf_network_model->extension.network.link_shared(link); } static void ws_finalize(void) diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index 861e4047f9..c948bd967f 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -13,7 +13,7 @@ typedef enum { SURF_WORKSTATION_RESOURCE_CPU, - SURF_WORKSTATION_RESOURCE_LINK, + SURF_WORKSTATION_RESOURCE_LINK } e_surf_workstation_model_type_t; /**************************************/ diff --git a/src/xbt/backtrace_linux.c b/src/xbt/backtrace_linux.c index 4fc1ebc6f4..9704bc0560 100644 --- a/src/xbt/backtrace_linux.c +++ b/src/xbt/backtrace_linux.c @@ -94,7 +94,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) //FIXME: This code could be greatly im /* to extract the addresses from the backtrace */ char **addrs; - char buff[256], *p; + char buff[256]; /* To read the output of addr2line */ FILE *pipe; @@ -126,8 +126,6 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) //FIXME: This code could be greatly im /* build the commandline */ if (stat(xbt_binary_name, &stat_buf)) { /* Damn. binary not in current dir. We'll have to dig the PATH to find it */ - int i; - for (i = 0; environ[i]; i++) { if (!strncmp("PATH=", environ[i], 5)) { xbt_dynar_t path = xbt_str_split(environ[i] + 5, ":"); @@ -170,6 +168,7 @@ void xbt_ex_setup_backtrace(xbt_ex_t * e) //FIXME: This code could be greatly im addrs = xbt_new(char *, e->used); for (i = 0; i < e->used; i++) { + char *p; /* retrieve this address */ XBT_DEBUG("Retrieving address number %d from '%s'", i, backtrace_syms[i]); snprintf(buff, 256, "%s", strchr(backtrace_syms[i], '[') + 1); diff --git a/src/xbt/config.c b/src/xbt/config.c index 39b4262834..2b65a7304e 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -213,7 +213,7 @@ xbt_cfg_register(xbt_cfg_t * cfg, *cfg = xbt_cfg_new(); xbt_assert(type >= xbt_cfgelm_int && type <= xbt_cfgelm_peer, "type of %s not valid (%d should be between %d and %d)", - name, type, xbt_cfgelm_int, xbt_cfgelm_peer); + name, (int)type, xbt_cfgelm_int, xbt_cfgelm_peer); res = xbt_dict_get_or_null((xbt_dict_t) * cfg, name); if (res) { @@ -223,7 +223,7 @@ xbt_cfg_register(xbt_cfg_t * cfg, res = xbt_new(s_xbt_cfgelm_t, 1); XBT_DEBUG("Register cfg elm %s (%s) (%d to %d %s (=%d) @%p in set %p)", - name, desc, min, max, xbt_cfgelm_type_name[type], type, res, + name, desc, min, max, xbt_cfgelm_type_name[type], (int)type, res, *cfg); res->desc = xbt_strdup(desc); @@ -260,7 +260,7 @@ xbt_cfg_register(xbt_cfg_t * cfg, break; default: - XBT_ERROR("%d is an invalide type code", type); + XBT_ERROR("%d is an invalide type code", (int)type); } xbt_dict_set((xbt_dict_t) * cfg, name, res, NULL); @@ -326,7 +326,7 @@ void xbt_cfg_register_str(xbt_cfg_t * cfg, const char *entry) "; Should be :_to__"); tok++; - for (type = 0; + for (type = (e_xbt_cfgelm_type_t)0; type < xbt_cfgelm_type_count && strcmp(tok, xbt_cfgelm_type_name[type]); type++); xbt_assert(type < xbt_cfgelm_type_count, @@ -490,7 +490,7 @@ e_xbt_cfgelm_type_t xbt_cfg_get_type(xbt_cfg_t cfg, const char *name) "Can't get the type of '%s' since this variable does not exist", name); - XBT_INFO("type in variable = %d", variable->type); + XBT_INFO("type in variable = %d", (int)variable->type); return variable->type; } @@ -509,7 +509,7 @@ void xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa) char *str; int i; double d; - e_xbt_cfgelm_type_t type = 0; /* Set a dummy value to make gcc happy. It cannot get uninitialized */ + e_xbt_cfgelm_type_t type = xbt_cfgelm_any; /* Set a dummy value to make gcc happy. It cannot get uninitialized */ xbt_ex_t e; @@ -549,7 +549,7 @@ void xbt_cfg_set_vargs(xbt_cfg_t cfg, const char *name, va_list pa) break; default: - xbt_die("Config element variable %s not valid (type=%d)", name, type); + xbt_die("Config element variable %s not valid (type=%d)", name, (int)type); } } @@ -899,7 +899,7 @@ void xbt_cfg_set_string(xbt_cfg_t cfg, const char *name, const char *val) variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_string); XBT_DEBUG("Variable: %d to %d %s (=%d) @%p", variable->min, variable->max, - xbt_cfgelm_type_name[variable->type], variable->type, variable); + xbt_cfgelm_type_name[variable->type], (int)variable->type, variable); if (variable->max == 1) { if (!xbt_dynar_is_empty(variable->content)) { diff --git a/src/xbt/datadesc/cbps.c b/src/xbt/datadesc/cbps.c index b397268d9a..2810ac3815 100644 --- a/src/xbt/datadesc/cbps.c +++ b/src/xbt/datadesc/cbps.c @@ -378,7 +378,7 @@ void xbt_datadesc_cb_push_uint_mult(xbt_datadesc_type_t ignored, unsigned int old = *(unsigned int *) data; unsigned int new = xbt_cbps_i_pop(vars); - XBT_DEBUG("push %d x %d as a size", old, new); + XBT_DEBUG("push %u x %u as a size", old, new); xbt_cbps_i_push(vars, (int) (old * new)); } @@ -400,6 +400,6 @@ void xbt_datadesc_cb_push_ulint_mult(xbt_datadesc_type_t ignored, unsigned long int old = *(unsigned long int *) data; unsigned long int new = xbt_cbps_i_pop(vars); - XBT_DEBUG("push %ld x %ld as a size", old, new); + XBT_DEBUG("push %lu x %lu as a size", old, new); xbt_cbps_i_push(vars, (int) (old * new)); } diff --git a/src/xbt/datadesc/datadesc.c b/src/xbt/datadesc/datadesc.c index 6942b2434a..8c2328fcb6 100644 --- a/src/xbt/datadesc/datadesc.c +++ b/src/xbt/datadesc/datadesc.c @@ -227,7 +227,7 @@ void xbt_datadesc_type_dump(const xbt_datadesc_type_t ddt) printf(" alignment["); for (cpt = 0; cpt < xbt_arch_count; cpt++) { - printf("%s%s%ld%s", + printf("%s%s%lu%s", cpt > 0 ? ", " : "", cpt == GRAS_THISARCH ? ">" : "", ddt->alignment[cpt], cpt == GRAS_THISARCH ? "<" : ""); @@ -236,7 +236,7 @@ void xbt_datadesc_type_dump(const xbt_datadesc_type_t ddt) printf(" aligned_size["); for (cpt = 0; cpt < xbt_arch_count; cpt++) { - printf("%s%s%ld%s", + printf("%s%s%lu%s", cpt > 0 ? ", " : "", cpt == GRAS_THISARCH ? ">" : "", ddt->aligned_size[cpt], cpt == GRAS_THISARCH ? "<" : ""); @@ -248,10 +248,10 @@ void xbt_datadesc_type_dump(const xbt_datadesc_type_t ddt) struct_data = ddt->category.struct_data; xbt_dynar_foreach(struct_data.fields, cpt, field) { - printf(">>> Dump field #%d (%s) (offset=%ld)\n", + printf(">>> Dump field #%u (%s) (offset=%ld)\n", cpt, field->name, field->offset[GRAS_THISARCH]); xbt_datadesc_type_dump(field->type); - printf("<<< end dump field #%d (%s)\n", cpt, field->name); + printf("<<< end dump field #%u (%s)\n", cpt, field->name); } } fflush(stdout); diff --git a/src/xbt/datadesc/ddt_create.c b/src/xbt/datadesc/ddt_create.c index 7d2b0284c5..ba295af2a3 100644 --- a/src/xbt/datadesc/ddt_create.c +++ b/src/xbt/datadesc/ddt_create.c @@ -224,7 +224,7 @@ xbt_datadesc_struct_append(xbt_datadesc_type_t struct_type, field->name = (char *) strdup(name); XBT_DEBUG("----------------"); - XBT_DEBUG("PRE s={size=%ld,align=%ld,asize=%ld}", + XBT_DEBUG("PRE s={size=%ld,align=%lu,asize=%lu}", struct_type->size[GRAS_THISARCH], struct_type->alignment[GRAS_THISARCH], struct_type->aligned_size[GRAS_THISARCH]); @@ -250,11 +250,11 @@ xbt_datadesc_struct_append(xbt_datadesc_type_t struct_type, XBT_DEBUG("Push a %s into %s at offset %ld.", field_type->name, struct_type->name, field->offset[GRAS_THISARCH]); - XBT_DEBUG(" f={size=%ld,align=%ld,asize=%ld}", + XBT_DEBUG(" f={size=%ld,align=%lu,asize=%lu}", field_type->size[GRAS_THISARCH], field_type->alignment[GRAS_THISARCH], field_type->aligned_size[GRAS_THISARCH]); - XBT_DEBUG(" s={size=%ld,align=%ld,asize=%ld}", + XBT_DEBUG(" s={size=%ld,align=%lu,asize=%lu}", struct_type->size[GRAS_THISARCH], struct_type->alignment[GRAS_THISARCH], struct_type->aligned_size[GRAS_THISARCH]); @@ -273,7 +273,7 @@ void xbt_datadesc_struct_close(xbt_datadesc_type_t struct_type) for (arch = 0; arch < xbt_arch_count; arch++) { struct_type->size[arch] = struct_type->aligned_size[arch]; } - XBT_DEBUG("structure %s closed. size=%ld,align=%ld,asize=%ld", + XBT_DEBUG("structure %s closed. size=%ld,align=%lu,asize=%lu", struct_type->name, struct_type->size[GRAS_THISARCH], struct_type->alignment[GRAS_THISARCH], @@ -1012,7 +1012,7 @@ int xbt_datadesc_type_cmp(const xbt_datadesc_type_t d1, } if (d1->alignment[cpt] != d2->alignment[cpt]) { - XBT_DEBUG("ddt_cmp: %s->alignment=%ld != %s->alignment=%ld (on %s)", + XBT_DEBUG("ddt_cmp: %s->alignment=%lu != %s->alignment=%lu (on %s)", d1->name, d1->alignment[cpt], d2->name, d2->alignment[cpt], xbt_arches[cpt].name); return d1->alignment[cpt] > d2->alignment[cpt] ? 1 : -1; @@ -1020,7 +1020,7 @@ int xbt_datadesc_type_cmp(const xbt_datadesc_type_t d1, if (d1->aligned_size[cpt] != d2->aligned_size[cpt]) { XBT_DEBUG - ("ddt_cmp: %s->aligned_size=%ld != %s->aligned_size=%ld (on %s)", + ("ddt_cmp: %s->aligned_size=%lu != %s->aligned_size=%lu (on %s)", d1->name, d1->aligned_size[cpt], d2->name, d2->aligned_size[cpt], xbt_arches[cpt].name); return d1->aligned_size[cpt] > d2->aligned_size[cpt] ? 1 : -1; @@ -1073,7 +1073,7 @@ int xbt_datadesc_type_cmp(const xbt_datadesc_type_t d1, field_desc_2 = field2->type; ret = xbt_datadesc_type_cmp(field_desc_1, field_desc_2); if (ret) { - XBT_DEBUG("%s->field[%d]=%s != %s->field[%d]=%s", + XBT_DEBUG("%s->field[%u]=%s != %s->field[%u]=%s", d1->name, cpt, field1->name, d2->name, cpt, field2->name); return ret; } diff --git a/src/xbt/datadesc/ddt_exchange.c b/src/xbt/datadesc/ddt_exchange.c index 12f601d49d..b9fdb29ada 100644 --- a/src/xbt/datadesc/ddt_exchange.c +++ b/src/xbt/datadesc/ddt_exchange.c @@ -30,7 +30,7 @@ xbt_dd_send_int(xbt_socket_t sock, int *i, int stable) xbt_assert(int_type); } - XBT_DEBUG("send_int(%u)", *i); + XBT_DEBUG("send_int(%d)", *i); xbt_trp_send(sock, (char *) i, int_type->size[GRAS_THISARCH], stable); } @@ -55,7 +55,7 @@ xbt_dd_recv_int(xbt_socket_t sock, int r_arch, int *i) xbt_dd_convert_elm(int_type, 1, r_arch, ptr, i); free(ptr); } - XBT_DEBUG("recv_int(%u)", *i); + XBT_DEBUG("recv_int(%d)", *i); } /* @@ -157,7 +157,7 @@ xbt_datadesc_memcpy_rec(xbt_cbps_t state, if (XBT_LOG_ISENABLED(xbt_ddt_exchange, xbt_log_priority_verbose)) { if (sub_type == xbt_datadesc_by_name("unsigned int")) { - XBT_VERB("Copied value for field '%s': %d (type: unsigned int)", + XBT_VERB("Copied value for field '%s': %u (type: unsigned int)", field->name, *(unsigned int *) field_dst); } else if (sub_type == xbt_datadesc_by_name("int")) { XBT_VERB("Copied value for field '%s': %d (type: int)", @@ -166,7 +166,7 @@ xbt_datadesc_memcpy_rec(xbt_cbps_t state, } else if (sub_type == xbt_datadesc_by_name("unsigned long int")) { XBT_VERB - ("Copied value for field '%s': %ld (type: unsigned long int)", + ("Copied value for field '%s': %lu (type: unsigned long int)", field->name, *(unsigned long int *) field_dst); } else if (sub_type == xbt_datadesc_by_name("long int")) { XBT_VERB("Copied value for field '%s': %ld (type: long int)", @@ -205,7 +205,7 @@ xbt_datadesc_memcpy_rec(xbt_cbps_t state, type->name); xbt_assert(field_num < xbt_dynar_length(union_data.fields), - "union field selector of %s returned %d but there is only %lu fields", + "union field selector of %s returned %u but there is only %lu fields", type->name, field_num, xbt_dynar_length(union_data.fields)); @@ -323,18 +323,14 @@ xbt_datadesc_memcpy_rec(xbt_cbps_t state, array_count = array_data.fixed_size; if (array_count == -1) array_count = subsize; - if (array_count == -1) { + if (array_count == -1) array_count = array_data.dynamic_size(type, state, src); - xbt_assert(array_count >= 0, - "Invalid (negative) array size for type %s", - type->name); - } /* send the content */ sub_type = array_data.type; elm_size = sub_type->aligned_size[GRAS_THISARCH]; if (sub_type->category_code == e_xbt_datadesc_type_cat_scalar) { - XBT_VERB("Array of %ld scalars, copy it in one shot", array_count); + XBT_VERB("Array of %lu scalars, copy it in one shot", array_count); memcpy(dst, src, sub_type->aligned_size[GRAS_THISARCH] * array_count); count += sub_type->aligned_size[GRAS_THISARCH] * array_count; @@ -343,7 +339,7 @@ xbt_datadesc_memcpy_rec(xbt_cbps_t state, && sub_type->category.array_data.type->category_code == e_xbt_datadesc_type_cat_scalar) { - XBT_VERB("Array of %ld fixed array of scalars, copy it in one shot", + XBT_VERB("Array of %lu fixed array of scalars, copy it in one shot", array_count); memcpy(dst, src, sub_type->category.array_data. @@ -354,10 +350,10 @@ xbt_datadesc_memcpy_rec(xbt_cbps_t state, * array_count * sub_type->category.array_data.fixed_size; } else { - XBT_VERB("Array of %ld stuff, copy it in one after the other", + XBT_VERB("Array of %lu stuff, copy it in one after the other", array_count); for (cpt = 0; cpt < array_count; cpt++) { - XBT_VERB("Copy the %dth stuff out of %ld", cpt, array_count); + XBT_VERB("Copy the %uth stuff out of %lu", cpt, array_count); count += xbt_datadesc_memcpy_rec(state, refs, sub_type, src_ptr, dst_ptr, 0, detect_cycle diff --git a/src/xbt/datadesc/ddt_parse.c b/src/xbt/datadesc/ddt_parse.c index 498f56e7d4..7165982386 100644 --- a/src/xbt/datadesc/ddt_parse.c +++ b/src/xbt/datadesc/ddt_parse.c @@ -656,7 +656,7 @@ static xbt_datadesc_type_t parse_struct(char *definition) if (field.tm.is_ref) PARSE_ERROR ("Not enough XBT_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)", - field.name, field.tm.is_ref); + field.name, (int)field.tm.is_ref); XBT_VERB("Append field '%s' to %p", field.name, (void *) struct_type); xbt_datadesc_struct_append(struct_type, field.name, field.type); diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 226c5d1cc7..13b84d06ba 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -252,7 +252,7 @@ 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 = %d, size = %d, & = %d", key_len, key, hash_code, + XBT_DEBUG("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 && @@ -675,7 +675,7 @@ void xbt_dict_dump_sizes(xbt_dict_t dict) continue; if (size == 0) continue; - printf("%delm x %u cells; ", count, size); + printf("%uelm x %u cells; ", count, size); } } printf("\n"); @@ -728,7 +728,7 @@ void xbt_dict_postexit(void) continue; if (size == 0) continue; - printf("%delm x %d cells; ", count, size); + printf("%uelm x %d cells; ", count, size); avg += count * size; total_count += size; } @@ -1144,7 +1144,6 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") xbt_dict_t head = NULL; int i, j, k; char *key; - void *data; srand((unsigned int) time(NULL)); @@ -1205,6 +1204,7 @@ XBT_TEST_UNIT("crash", test_dict_crash, "Crash test") xbt_test_add("Search my %d elements 20 times", NB_ELM); key = xbt_malloc(10); for (i = 0; i < 20; i++) { + void *data; /* if (i%10) printf("."); else printf("%d",i/10); fflush(stdout); */ for (j = 0; j < NB_ELM; j++) { diff --git a/src/xbt/dynar.c b/src/xbt/dynar.c index c630ff0796..6bf067cbe0 100644 --- a/src/xbt/dynar.c +++ b/src/xbt/dynar.c @@ -731,13 +731,13 @@ XBT_INLINE int xbt_dynar_compare(xbt_dynar_t d1, xbt_dynar_t d2, } if((d1->elmsize)!=(d2->elmsize)) { - XBT_DEBUG("Size of elmsize d1=%ld d2=%ld",d1->elmsize,d2->elmsize); + XBT_DEBUG("Size of elmsize d1=%lu d2=%lu",d1->elmsize,d2->elmsize); xbt_dynar_free(&d2); return 1; // xbt_die } if(xbt_dynar_length(d1) != xbt_dynar_length(d2)) { - XBT_DEBUG("Size of dynar d1=%ld d2=%ld",xbt_dynar_length(d1),xbt_dynar_length(d2)); + XBT_DEBUG("Size of dynar d1=%lu d2=%lu",xbt_dynar_length(d1),xbt_dynar_length(d2)); xbt_dynar_free(&d2); return 1; } @@ -798,14 +798,14 @@ XBT_TEST_UNIT("int", test_dynar_int, "Dynars of integers") for (cursor = 0; cursor < NB_ELEM; cursor++) { iptr = xbt_dynar_get_ptr(d, cursor); xbt_test_assert(cursor == *iptr, - "The retrieved value is not the same than the injected one (%d!=%d)", + "The retrieved value is not the same than the injected one (%u!=%d)", cursor, cpt); } /* 3. Traverse the dynar using the neat macro to that extend */ xbt_dynar_foreach(d, cursor, cpt) { xbt_test_assert(cursor == cpt, - "The retrieved value is not the same than the injected one (%d!=%d)", + "The retrieved value is not the same than the injected one (%u!=%d)", cursor, cpt); } /* end_of_traversal */ @@ -937,7 +937,7 @@ XBT_TEST_UNIT("insert",test_dynar_insert,"Using the xbt_dynar_insert and xbt_dyn /* 3. Traverse the dynar */ xbt_dynar_foreach(d, cursor, cpt) { xbt_test_assert(cursor == cpt, - "The retrieved value is not the same than the injected one (%d!=%d)", + "The retrieved value is not the same than the injected one (%u!=%d)", cursor, cpt); } /* end_of_traversal */ @@ -947,14 +947,14 @@ XBT_TEST_UNIT("insert",test_dynar_insert,"Using the xbt_dynar_insert and xbt_dyn xbt_dynar_set_as(d, cpt, int, cpt); xbt_dynar_foreach(d, cursor, cpt) xbt_test_assert(cursor == cpt, - "The retrieved value is not the same than the injected one (%d!=%d)", + "The retrieved value is not the same than the injected one (%u!=%d)", cursor, cpt); for (cpt = 0; cpt < NB_ELEM; cpt++) { int val; xbt_dynar_remove_at(d,0,&val); xbt_test_assert(cpt == val, - "The retrieved value is not the same than the injected one (%d!=%d)", + "The retrieved value is not the same than the injected one (%u!=%d)", cursor, cpt); } xbt_test_assert(xbt_dynar_is_empty(d), @@ -973,7 +973,7 @@ XBT_TEST_UNIT("insert",test_dynar_insert,"Using the xbt_dynar_insert and xbt_dyn /* 3. Traverse the dynar */ xbt_dynar_foreach(d, cursor, cpt) { xbt_test_assert(cursor == cpt, - "The retrieved value is not the same than the injected one (%d!=%d)", + "The retrieved value is not the same than the injected one (%u!=%d)", cursor, cpt); } /* end_of_traversal */ @@ -982,7 +982,7 @@ XBT_TEST_UNIT("insert",test_dynar_insert,"Using the xbt_dynar_insert and xbt_dyn int val; xbt_dynar_remove_at(d,xbt_dynar_length(d)-1,&val); xbt_test_assert(cpt == val, - "The retrieved value is not the same than the injected one (%d!=%d)", + "The retrieved value is not the same than the injected one (%u!=%d)", cursor, cpt); } xbt_test_assert(xbt_dynar_is_empty(d), @@ -1179,7 +1179,7 @@ XBT_TEST_UNIT("string", test_dynar_string, "Dynars of strings") } /* 2. Traverse the dynar with the macro */ xbt_dynar_foreach(d, iter, s1) { - sprintf(buf, "%d", NB_ELEM - iter - 1); + sprintf(buf, "%u", NB_ELEM - iter - 1); xbt_test_assert(!strcmp(buf, s1), "The retrieved value is not the same than the injected one (%s!=%s)", buf, s1); diff --git a/src/xbt/ex.c b/src/xbt/ex.c index 579f63d2d1..bdb3aa2d4e 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -309,7 +309,8 @@ XBT_TEST_UNIT("value", test_value, "exception value passing") XBT_TEST_UNIT("variables", test_variables, "variable value preservation") { xbt_ex_t ex; - int r1, r2; + int r1; + int _XBT_GNUC_UNUSED r2; volatile int v1, v2; r1 = r2 = v1 = v2 = 1234; diff --git a/src/xbt/graph.c b/src/xbt/graph.c index e56e413938..160a41f004 100644 --- a/src/xbt/graph.c +++ b/src/xbt/graph.c @@ -803,7 +803,7 @@ void xbt_graph_save (xbt_graph_t span, xbt_dynar_t edges = xbt_graph_get_edges (span); unsigned int cpt; xbt_node_t node; - fprintf (file, "%ld\n", xbt_dynar_length (nodes)); + fprintf (file, "%lu\n", xbt_dynar_length (nodes)); xbt_dynar_foreach (nodes, cpt, node) { if (nname){ fprintf (file, "%s\n", nname(node)); @@ -811,7 +811,7 @@ void xbt_graph_save (xbt_graph_t span, fprintf (file, "%p\n", node); } } - fprintf (file, "%ld\n", xbt_dynar_length (edges)); + fprintf (file, "%lu\n", xbt_dynar_length (edges)); xbt_edge_t edge; xbt_dynar_foreach (edges, cpt, edge) { xbt_node_t source = xbt_graph_edge_get_source (edge); diff --git a/src/xbt/mmalloc/mm_module.c b/src/xbt/mmalloc/mm_module.c index 2ba57960fd..5cb60844a5 100644 --- a/src/xbt/mmalloc/mm_module.c +++ b/src/xbt/mmalloc/mm_module.c @@ -125,7 +125,7 @@ xbt_mheap_t xbt_mheap_new(int fd, void *baseaddr) mdp = (struct mdesc *) mtemp.base; mdp->fd = fd; if(!mdp->refcount){ - sem_init(&mdp->sem, 1, 1); + sem_init(&mdp->sem, 0, 1); mdp->refcount++; } } @@ -168,10 +168,8 @@ xbt_mheap_t xbt_mheap_new(int fd, void *baseaddr) if (mdp->fd < 0){ mdp->flags |= MMALLOC_ANONYMOUS; - sem_init(&mdp->sem, 0, 1); - }else{ - sem_init(&mdp->sem, 1, 1); } + sem_init(&mdp->sem, 0, 1); /* If we have not been passed a valid open file descriptor for the file to map to, then open /dev/zero and use that to map to. */ diff --git a/src/xbt/mmalloc/mmprivate.h b/src/xbt/mmalloc/mmprivate.h index 28bb297dbe..62df14dd4d 100644 --- a/src/xbt/mmalloc/mmprivate.h +++ b/src/xbt/mmalloc/mmprivate.h @@ -156,7 +156,6 @@ struct mdesc { /* Semaphore locking the access to the heap */ sem_t sem; - char locked; /* Number of processes that attached the heap */ unsigned int refcount; @@ -252,18 +251,7 @@ extern void *mmorecore(struct mdesc *mdp, int size); * in a model-checking enabled tree. Without this protection, our malloc * implementation will not like multi-threading AT ALL. */ -#define LOCK(mdp) do { \ - if (0 && mdp->locked) { \ - fprintf(stderr,"panic! deadlock detected because %s is not reintrant.\n",__FUNCTION__); \ - abort(); \ - } \ - sem_wait(&mdp->sem); \ - mdp->locked=1; \ - } while(0) - -#define UNLOCK(mdp) do { \ - sem_post(&mdp->sem); \ - mdp->locked=0; \ - } while (0) +#define LOCK(mdp) sem_wait(&mdp->sem) +#define UNLOCK(mdp) sem_post(&mdp->sem) #endif /* __MMPRIVATE_H */ diff --git a/src/xbt/set.c b/src/xbt/set.c index 91583052ac..eb09a357fb 100644 --- a/src/xbt/set.c +++ b/src/xbt/set.c @@ -101,19 +101,19 @@ void xbt_set_add(xbt_set_t set, xbt_set_elm_t elm, elm->ID = _xbt_set_get_id(set); xbt_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func); xbt_dynar_set(set->dynar, elm->ID, &elm); - XBT_DEBUG("Insertion of key '%s' (id %d)", elm->name, elm->ID); + XBT_DEBUG("Insertion of key '%s' (id %u)", elm->name, elm->ID); xbt_ex_free(e); } if (found) { if (elm == found_in_dict) { XBT_DEBUG - ("Ignoring request to insert the same element twice (key %s ; id %d)", + ("Ignoring request to insert the same element twice (key %s ; id %u)", elm->name, elm->ID); return; } else { elm->ID = found_in_dict->ID; - XBT_DEBUG("Reinsertion of key %s (id %d)", elm->name, elm->ID); + XBT_DEBUG("Reinsertion of key %s (id %u)", elm->name, elm->ID); xbt_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func); xbt_dynar_set(set->dynar, elm->ID, &elm); @@ -380,7 +380,7 @@ static void search_name(xbt_set_t head, const char *key) xbt_test_add("Search by name %s", key); elm = (my_elem_t) xbt_set_get_by_name(head, key); - xbt_test_log(" Found %s (under ID %d)\n", + xbt_test_log(" Found %s (under ID %u)\n", elm ? elm->data : "(null)", elm ? elm->ID : -1); if (strcmp(key, elm->name)) THROWF(mismatch_error, 0, "The key (%s) is not the one expected (%s)", @@ -401,7 +401,7 @@ static void search_id(xbt_set_t head, int id, const char *key) elm ? elm->name : "(null)", elm ? elm->data : "(null)"); if (id != elm->ID) THROWF(mismatch_error, 0, - "The found ID (%d) is not the one expected (%d)", elm->ID, id); + "The found ID (%u) is not the one expected (%d)", elm->ID, id); if (strcmp(key, elm->name)) THROWF(mismatch_error, 0, "The key (%s) is not the one expected (%s)", elm->name, key); @@ -418,7 +418,7 @@ static void traverse(xbt_set_t set) xbt_set_foreach(set, cursor, elm) { xbt_test_assert(elm, "Dude ! Got a null elm during traversal!"); - xbt_test_log("Id(%d): %s->%s\n", elm->ID, elm->name, elm->data); + xbt_test_log("Id(%u): %s->%s\n", elm->ID, elm->name, elm->data); xbt_test_assert(!strcmp(elm->name, elm->data), "Key(%s) != value(%s). Abording", elm->name, elm->data); @@ -549,7 +549,7 @@ XBT_TEST_UNIT("remove", test_set_remove, "Removing some values") debuged_add(set, "12anew", "12anew"); elm = (my_elem_t) xbt_set_get_by_id(set, 1); - xbt_test_assert(elm->ID == 1, "elm->ID is %d but should be 1", elm->ID); + xbt_test_assert(elm->ID == 1, "elm->ID is %u but should be 1", elm->ID); xbt_set_free(&set); } diff --git a/src/xbt/xbt_matrix.c b/src/xbt/xbt_matrix.c index d5f041764e..89eadf13ee 100644 --- a/src/xbt/xbt_matrix.c +++ b/src/xbt/xbt_matrix.c @@ -69,13 +69,13 @@ void xbt_matrix_dump(xbt_matrix_t matrix, const char *name, int coords, { unsigned int i, j; - fprintf(stderr, ">>> Matrix %s dump (%d x %d)\n", name, matrix->lines, + fprintf(stderr, ">>> Matrix %s dump (%u x %u)\n", name, matrix->lines, matrix->rows); for (i = 0; i < matrix->lines; i++) { fprintf(stderr, " "); for (j = 0; j < matrix->rows; j++) { if (coords) - fprintf(stderr, " (%d,%d)=", i, j); + fprintf(stderr, " (%u,%u)=", i, j); else fprintf(stderr, " "); display_fun(xbt_matrix_get_ptr(matrix, i, j)); @@ -109,7 +109,7 @@ void xbt_matrix_copy_values(xbt_matrix_t dst, xbt_matrix_t src, unsigned int i, j; XBT_DEBUG - ("Copy a %dx%d submatrix from %dx%d(of %dx%d) to %dx%d (of %dx%d)", + ("Copy a %ux%u submatrix from %ux%u(of %ux%u) to %ux%u (of %ux%u)", lsize, rsize, lpos_src, rpos_src, src->lines, src->rows, lpos_dst, rpos_dst, dst->lines, dst->rows); @@ -212,7 +212,7 @@ void xbt_matrix_double_addmult(xbt_matrix_t A, xbt_matrix_t B, unsigned int i, j, k; xbt_assert(A->lines == C->lines, - "A->lines != C->lines (%d vs %d)", A->lines, C->lines); + "A->lines != C->lines (%u vs %u)", A->lines, C->lines); xbt_assert(B->rows == C->rows); for (i = 0; i < C->lines; i++) diff --git a/src/xbt/xbt_socket.c b/src/xbt/xbt_socket.c index 7587c141a8..fd4ad3f185 100644 --- a/src/xbt/xbt_socket.c +++ b/src/xbt/xbt_socket.c @@ -292,13 +292,13 @@ void xbt_socket_meas_send(xbt_socket_t peer, for (sent_sofar = 0; sent_sofar < msg_amount; sent_sofar++) { XBT_CDEBUG(xbt_trp_meas, - "Sent %lu msgs of %lu (size of each: %ld) to %s:%d", + "Sent %lu msgs of %lu (size of each: %lu) to %s:%d", sent_sofar, msg_amount, msg_size, xbt_socket_peer_name(peer), xbt_socket_peer_port(peer)); peer->plugin->raw_send(peer, chunk, msg_size); } XBT_CDEBUG(xbt_trp_meas, - "Sent %lu msgs of %lu (size of each: %ld) to %s:%d", sent_sofar, + "Sent %lu msgs of %lu (size of each: %lu) to %s:%d", sent_sofar, msg_amount, msg_size, xbt_socket_peer_name(peer), xbt_socket_peer_port(peer)); @@ -342,13 +342,13 @@ void xbt_socket_meas_recv(xbt_socket_t peer, for (got_sofar = 0; got_sofar < msg_amount; got_sofar++) { XBT_CDEBUG(xbt_trp_meas, - "Recvd %ld msgs of %lu (size of each: %ld) from %s:%d", + "Recvd %lu msgs of %lu (size of each: %lu) from %s:%d", got_sofar, msg_amount, msg_size, xbt_socket_peer_name(peer), xbt_socket_peer_port(peer)); (peer->plugin->raw_recv) (peer, chunk, msg_size); } XBT_CDEBUG(xbt_trp_meas, - "Recvd %ld msgs of %lu (size of each: %ld) from %s:%d", + "Recvd %lu msgs of %lu (size of each: %lu) from %s:%d", got_sofar, msg_amount, msg_size, xbt_socket_peer_name(peer), xbt_socket_peer_port(peer)); diff --git a/src/xbt/xbt_synchro.c b/src/xbt/xbt_synchro.c index e76bb4ee55..d72f8a6e9e 100644 --- a/src/xbt/xbt_synchro.c +++ b/src/xbt/xbt_synchro.c @@ -46,7 +46,7 @@ void xbt_dynar_dopar(xbt_dynar_t datas, void_f_int_pvoid_t function) return; } /* Start all workers */ - XBT_DEBUG("Dopar for %ld elements", xbt_dynar_length(datas)); + XBT_DEBUG("Dopar for %lu elements", xbt_dynar_length(datas)); xbt_dynar_foreach(datas, cursor, data) { worker_data_t w = xbt_new0(s_worker_data_t, 1); w->data = datas; diff --git a/src/xbt/xbt_trp_plugin_tcp.c b/src/xbt/xbt_trp_plugin_tcp.c index 3c4b38d129..bbe7f488af 100644 --- a/src/xbt/xbt_trp_plugin_tcp.c +++ b/src/xbt/xbt_trp_plugin_tcp.c @@ -326,7 +326,7 @@ static XBT_INLINE void xbt_trp_tcp_send(xbt_socket_t sock, int status = 0; status = tcp_write(sock->sd, data, (size_t) size); - XBT_DEBUG("write(%d, %p, %ld);", sock->sd, data, size); + XBT_DEBUG("write(%d, %p, %lu);", sock->sd, data, size); if (status < 0) { #ifdef EWOULDBLOCK @@ -336,7 +336,7 @@ static XBT_INLINE void xbt_trp_tcp_send(xbt_socket_t sock, #endif continue; - THROWF(system_error, 0, "write(%d,%p,%ld) failed: %s", + THROWF(system_error, 0, "write(%d,%p,%lu) failed: %s", sock->sd, data, size, sock_errstr(sock_errno)); } @@ -368,15 +368,15 @@ xbt_trp_tcp_recv_withbuffer(xbt_socket_t sock, while (size > got) { int status = 0; - XBT_DEBUG("read(%d, %p, %ld) got %d so far (%s)", + XBT_DEBUG("read(%d, %p, %lu) got %d so far (%s)", sock->sd, data + got, bufsize, got, hexa_str((unsigned char *) data, got, 0)); status = tcp_read(sock->sd, data + got, (size_t) bufsize); if (status < 0) { THROWF(system_error, 0, - "read(%d,%p,%d) from %s:%d failed: %s; got %d so far", - sock->sd, data + got, (int) size, xbt_socket_peer_name(sock), + "read(%d,%p,%lu) from %s:%d failed: %s; got %d so far", + sock->sd, data + got, size, xbt_socket_peer_name(sock), xbt_socket_peer_port(sock), sock_errstr(sock_errno), got); } XBT_DEBUG("Got %d more bytes (%s)", status, @@ -474,9 +474,9 @@ xbt_trp_buf_send(xbt_socket_t sock, /* size of the chunk to receive in that shot */ long int thissize = min(size - chunk_pos, data->buffsize - data->out_buf.size); - XBT_DEBUG("Set the chars %d..%ld into the buffer; size=%ld, ctn=(%s)", - (int) data->out_buf.size, - ((int) data->out_buf.size) + thissize - 1, size, + XBT_DEBUG("Set the chars %d..%ld into the buffer; size=%lu, ctn=(%s)", + data->out_buf.size, + data->out_buf.size + thissize - 1, size, hexa_str((unsigned char *) chunk, thissize, 0)); memcpy(data->out_buf.data + data->out_buf.size, chunk + chunk_pos, @@ -484,7 +484,7 @@ xbt_trp_buf_send(xbt_socket_t sock, data->out_buf.size += thissize; chunk_pos += thissize; - XBT_DEBUG("New pos = %d; Still to send = %ld of %ld; ctn sofar=(%s)", + XBT_DEBUG("New pos = %d; Still to send = %lu of %lu; ctn sofar=(%s)", data->out_buf.size, size - chunk_pos, size, hexa_str((unsigned char *) chunk, chunk_pos, 0)); @@ -528,7 +528,7 @@ xbt_trp_buf_recv(xbt_socket_t sock, char *chunk, unsigned long int size) data->in_buf.pos += thissize; chunk_pos += thissize; - XBT_DEBUG("New pos = %d; Still to receive = %ld of %ld. Ctn so far=(%s)", + XBT_DEBUG("New pos = %d; Still to receive = %lu of %lu. Ctn so far=(%s)", data->in_buf.pos, size - chunk_pos, size, hexa_str((unsigned char *) chunk, chunk_pos, 0)); } diff --git a/teshsuite/gras/datadesc/datadesc_usage.c b/teshsuite/gras/datadesc/datadesc_usage.c index 88d41fec67..2460d7fe56 100644 --- a/teshsuite/gras/datadesc/datadesc_usage.c +++ b/teshsuite/gras/datadesc/datadesc_usage.c @@ -245,7 +245,7 @@ static void test_hetestruct(xbt_socket_t sock, int direction) if (direction == READ || direction == COPY) { xbt_assert(i->c1 == j->c1); xbt_assert(i->c2 == j->c2); - xbt_assert(i->l1 == j->l1, "i->l1(=%ld) != j->l1(=%ld)", i->l1, + xbt_assert(i->l1 == j->l1, "i->l1(=%lu) != j->l1(=%lu)", i->l1, j->l1); xbt_assert(i->l2 == j->l2); free(j); @@ -274,7 +274,7 @@ static void test_hetestruct_array(xbt_socket_t sock, int direction) xbt_assert(p->c1 == q->c1); xbt_assert(p->c2 == q->c2); xbt_assert(p->l1 == p->l1, - "for cpt=%d i->l1(=%ld) != j->l1(=%ld)", cpt, p->l1, + "for cpt=%d i->l1(=%lu) != j->l1(=%lu)", cpt, p->l1, q->l1); xbt_assert(q->l2 == p->l2); } diff --git a/testsuite/surf/lmm_usage.c b/testsuite/surf/lmm_usage.c index 61b3ad7fb3..37bb41e52b 100644 --- a/testsuite/surf/lmm_usage.c +++ b/testsuite/surf/lmm_usage.c @@ -31,7 +31,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, typedef enum { MAXMIN, LAGRANGE_RENO, - LAGRANGE_VEGAS, + LAGRANGE_VEGAS } method_t; static double dichotomy(double func(double), double min, double max, diff --git a/testsuite/xbt/parmap_bench.c b/testsuite/xbt/parmap_bench.c index 112fbae788..cec94262e2 100644 --- a/testsuite/xbt/parmap_bench.c +++ b/testsuite/xbt/parmap_bench.c @@ -30,7 +30,7 @@ static const char *parmap_mode_name(e_xbt_parmap_mode_t mode) snprintf(name, sizeof name, "DEFAULT"); break; default: - snprintf(name, sizeof name, "UNKNOWN(%d)", mode); + snprintf(name, sizeof name, "UNKNOWN(%d)", (int)mode); break; } return name; @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) return EXIT_FAILURE; } if (argc == 3) - modes = atoi(argv[2]); + modes = strtol(argv[2], NULL, 0); printf("Parmap benchmark with %d workers (modes = %#x)...\n\n", nthreads, modes); diff --git a/tools/tesh/run_context.c b/tools/tesh/run_context.c index 26221267f8..756666d4ef 100644 --- a/tools/tesh/run_context.c +++ b/tools/tesh/run_context.c @@ -775,7 +775,7 @@ void *rctx_wait(void *r) XBT_INFO("<%s> No output before timeout", rctx->filepos); XBT_ERROR("Test suite `%s': NOK (<%s> timeout after %d sec)", testsuite_name, rctx->filepos, timeout_value); - XBT_DEBUG("<%s> Interrupted = %d", rctx->filepos, rctx->interrupted); + XBT_DEBUG("<%s> Interrupted = %d", rctx->filepos, (int)rctx->interrupted); if (!rctx->interrupted) { xbt_os_mutex_release(rctx->interruption); rctx_armageddon(rctx, 3); diff --git a/tools/tesh/signal.c b/tools/tesh/signal.c index 64e9106667..9905ad7149 100644 --- a/tools/tesh/signal.c +++ b/tools/tesh/signal.c @@ -61,5 +61,5 @@ const char *signal_name(unsigned int got, char *expected) if (signals[i].number == got) return (signals[i].name); - return bprintf("SIG UNKNOWN (%d)", got); + return bprintf("SIG UNKNOWN (%u)", got); }