From 9cca09ad88fcaeb49f2637de97df519c3920aaa4 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 10 Oct 2017 22:48:18 +0200 Subject: [PATCH] Remove useless typedef's from C++ files. --- doc/doxygen/uhood_switch.doc | 2 +- .../s4u/app-bittorrent/s4u-bittorrent.hpp | 4 +- examples/s4u/dht-chord/s4u-dht-chord.hpp | 4 +- include/simgrid/msg.h | 7 +- include/simgrid/s4u/Activity.hpp | 2 +- include/simgrid/s4u/ConditionVariable.hpp | 2 +- include/simgrid/s4u/VirtualMachine.hpp | 4 +- include/simgrid/simdag.h | 4 +- include/simgrid/simix.h | 6 +- src/bindings/lua/lua_utils.hpp | 5 +- src/include/smpi/smpi_utils.hpp | 6 +- src/include/surf/datatypes.h | 10 +- src/instr/instr_interface.cpp | 7 +- src/instr/instr_private.hpp | 24 ++- src/instr/instr_smpi.hpp | 6 +- src/kernel/activity/CommImpl.hpp | 2 +- src/kernel/routing/DijkstraZone.cpp | 6 +- src/kernel/routing/DijkstraZone.hpp | 14 +- src/mc/ModelChecker.hpp | 2 +- src/mc/RegionSnapshot.hpp | 2 +- src/mc/compare.cpp | 4 +- src/mc/mc_checkpoint.cpp | 12 +- src/mc/mc_comm_pattern.hpp | 8 +- src/mc/mc_snapshot.hpp | 25 +-- src/mc/mc_unw_vmread.cpp | 2 +- src/mc/remote/RemoteClient.cpp | 9 +- src/msg/msg_private.hpp | 12 +- src/msg/msg_synchro.cpp | 6 +- src/msg/msg_task.cpp | 2 +- src/msg/msg_vm.cpp | 11 +- src/plugins/vm/VirtualMachineImpl.hpp | 4 +- src/simdag/simdag_private.hpp | 4 +- src/simix/ActorImpl.hpp | 4 +- src/simix/popping_private.hpp | 4 +- src/simix/smx_global.cpp | 8 +- src/simix/smx_synchro.cpp | 2 +- src/simix/smx_synchro_private.hpp | 10 +- src/smpi/bindings/smpi_pmpi_request.cpp | 8 +- src/smpi/colls/allreduce/allreduce-rab2.cpp | 2 +- src/smpi/colls/allreduce/allreduce-rdb.cpp | 2 +- .../colls/allreduce/allreduce-smp-rdb.cpp | 2 +- .../colls/allreduce/allreduce-smp-rsag-lr.cpp | 2 +- .../colls/allreduce/allreduce-smp-rsag.cpp | 2 +- src/smpi/colls/coll_tuned_topo.hpp | 4 +- src/smpi/colls/reduce/reduce-rab.cpp | 32 +++- src/smpi/colls/smpi_intel_mpi_selector.cpp | 12 +- .../colls/smpi_mvapich2_selector_stampede.hpp | 72 ++++---- src/smpi/include/private.hpp | 10 +- src/smpi/include/smpi_coll.hpp | 3 +- src/smpi/include/smpi_datatype.hpp | 41 +++-- src/smpi/include/smpi_keyvals.hpp | 16 +- src/smpi/internals/smpi_dvfs.cpp | 8 +- src/smpi/internals/smpi_memory.cpp | 2 +- src/smpi/internals/smpi_static_variables.cpp | 4 +- src/surf/StorageImpl.hpp | 4 +- src/surf/maxmin.cpp | 4 +- src/surf/maxmin_private.hpp | 26 +-- src/surf/surf_interface.hpp | 4 +- src/surf/surf_private.hpp | 4 +- src/surf/trace_mgr.hpp | 6 +- src/surf/xml/platf_private.hpp | 34 ++-- src/surf/xml/surfxml_sax_cb.cpp | 161 ++++++++---------- src/xbt/backtrace_linux.cpp | 5 +- src/xbt/cunit.cpp | 20 ++- teshsuite/mc/dwarf/dwarf.cpp | 6 +- teshsuite/surf/lmm_usage/lmm_usage.cpp | 6 +- 66 files changed, 366 insertions(+), 382 deletions(-) diff --git a/doc/doxygen/uhood_switch.doc b/doc/doxygen/uhood_switch.doc index ccb9e72bc3..684eacbb20 100644 --- a/doc/doxygen/uhood_switch.doc +++ b/doc/doxygen/uhood_switch.doc @@ -629,7 +629,7 @@ which can be exposed using the same API as `std::condition_variable`: @code{cpp} class ConditionVariable { private: - friend s_smx_cond; + friend s_smx_cond_t; smx_cond_t cond_; ConditionVariable(smx_cond_t cond) : cond_(cond) {} public: diff --git a/examples/s4u/app-bittorrent/s4u-bittorrent.hpp b/examples/s4u/app-bittorrent/s4u-bittorrent.hpp index a3b296a2af..61e64bda80 100644 --- a/examples/s4u/app-bittorrent/s4u-bittorrent.hpp +++ b/examples/s4u/app-bittorrent/s4u-bittorrent.hpp @@ -44,7 +44,7 @@ #define MESSAGE_CANCEL_SIZE 17 /** Types of messages exchanged between two peers. */ -typedef enum { +enum e_message_type { MESSAGE_HANDSHAKE, MESSAGE_CHOKE, MESSAGE_UNCHOKE, @@ -55,7 +55,7 @@ typedef enum { MESSAGE_REQUEST, MESSAGE_PIECE, MESSAGE_CANCEL -} e_message_type; +}; class Message { public: diff --git a/examples/s4u/dht-chord/s4u-dht-chord.hpp b/examples/s4u/dht-chord/s4u-dht-chord.hpp index 4c44d8fc98..ff05252d82 100644 --- a/examples/s4u/dht-chord/s4u-dht-chord.hpp +++ b/examples/s4u/dht-chord/s4u-dht-chord.hpp @@ -42,7 +42,7 @@ public: }; /* Types of tasks exchanged between nodes. */ -typedef enum { +enum e_message_type_t { FIND_SUCCESSOR, FIND_SUCCESSOR_ANSWER, GET_PREDECESSOR, @@ -52,7 +52,7 @@ typedef enum { PREDECESSOR_LEAVING, PREDECESSOR_ALIVE, PREDECESSOR_ALIVE_ANSWER -} e_message_type_t; +}; class ChordMessage { public: diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index c6217599bb..8ee47ab40d 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -51,7 +51,7 @@ typedef sg_host_t msg_host_t; XBT_PUBLIC_DATA(int) sg_storage_max_file_descriptors; /* ******************************** Task ************************************ */ -typedef struct simdata_task *simdata_task_t; +typedef struct s_simdata_task_t* simdata_task_t; typedef struct msg_task { char *name; /**< @brief task name if any */ @@ -449,7 +449,8 @@ XBT_PUBLIC(void) MSG_action_exit(); * @ingroup msg_synchro * @hideinitializer */ -typedef struct s_smx_sem *msg_sem_t; // Yeah that's a rename of the smx_sem_t which doesnt require smx_sem_t to be declared here +typedef struct s_smx_sem_t* msg_sem_t; // Yeah that's a rename of the smx_sem_t which doesnt require smx_sem_t to be + // declared here XBT_PUBLIC(msg_sem_t) MSG_sem_init(int initial_value); XBT_PUBLIC(void) MSG_sem_acquire(msg_sem_t sem); XBT_PUBLIC(msg_error_t) MSG_sem_acquire_timeout(msg_sem_t sem, double timeout); @@ -464,7 +465,7 @@ XBT_PUBLIC(int) MSG_sem_would_block(msg_sem_t sem); */ #define MSG_BARRIER_SERIAL_PROCESS -1 -typedef struct s_msg_bar* msg_bar_t; +typedef struct s_msg_bar_t* msg_bar_t; XBT_PUBLIC(msg_bar_t) MSG_barrier_init( unsigned int count); XBT_PUBLIC(void) MSG_barrier_destroy(msg_bar_t bar); XBT_PUBLIC(int) MSG_barrier_wait(msg_bar_t bar); diff --git a/include/simgrid/s4u/Activity.hpp b/include/simgrid/s4u/Activity.hpp index d0c8b548fc..4568e529ad 100644 --- a/include/simgrid/s4u/Activity.hpp +++ b/include/simgrid/s4u/Activity.hpp @@ -9,7 +9,7 @@ #include #include -typedef enum { inited = 0, started, canceled, errored, finished } e_s4u_activity_state_t; +enum e_s4u_activity_state_t { inited = 0, started, canceled, errored, finished }; namespace simgrid { namespace s4u { diff --git a/include/simgrid/s4u/ConditionVariable.hpp b/include/simgrid/s4u/ConditionVariable.hpp index 5af34467d6..25d1dcfb22 100644 --- a/include/simgrid/s4u/ConditionVariable.hpp +++ b/include/simgrid/s4u/ConditionVariable.hpp @@ -33,7 +33,7 @@ namespace s4u { XBT_PUBLIC_CLASS ConditionVariable { private: - friend s_smx_cond; + friend s_smx_cond_t; smx_cond_t cond_; explicit ConditionVariable(smx_cond_t cond) : cond_(cond) {} public: diff --git a/include/simgrid/s4u/VirtualMachine.hpp b/include/simgrid/s4u/VirtualMachine.hpp index 4453039929..0d6023d321 100644 --- a/include/simgrid/s4u/VirtualMachine.hpp +++ b/include/simgrid/s4u/VirtualMachine.hpp @@ -10,12 +10,12 @@ #include "simgrid/s4u/Host.hpp" #include "simgrid/s4u/forward.hpp" -typedef enum { +enum e_surf_vm_state_t { SURF_VM_STATE_CREATED, /**< created, but not yet started */ SURF_VM_STATE_RUNNING, SURF_VM_STATE_SUSPENDED, /**< Suspend/resume does not involve disk I/O, so we assume there is no transition states. */ SURF_VM_STATE_DESTROYED -} e_surf_vm_state_t; +}; namespace simgrid { namespace vm { diff --git a/include/simgrid/simdag.h b/include/simgrid/simdag.h index 55f8ba04e4..8f64ea326a 100644 --- a/include/simgrid/simdag.h +++ b/include/simgrid/simdag.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2010, 2012-2016. The SimGrid Team. +/* Copyright (c) 2006-2010, 2012-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ typedef sg_link_t SD_link_t; Each task has a \ref e_SD_task_state_t "state" indicating whether the task is scheduled, running, done, ... */ -typedef struct SD_task *SD_task_t; +typedef struct s_SD_task_t* SD_task_t; /** @brief Task states @ingroup SD_task_api */ diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 976487a897..8d2729174a 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -49,11 +49,11 @@ typedef enum { /** * \ingroup simix_synchro_management */ -typedef struct s_smx_cond *smx_cond_t; +typedef struct s_smx_cond_t* smx_cond_t; /** * \ingroup simix_synchro_management */ -typedef struct s_smx_sem *smx_sem_t; +typedef struct s_smx_sem_t* smx_sem_t; /* ****************************** Process *********************************** */ @@ -106,7 +106,7 @@ XBT_PUBLIC(void) SIMIX_run(); XBT_PUBLIC(double) SIMIX_get_clock(); /* Timer functions FIXME: should these be public? */ -typedef struct s_smx_timer* smx_timer_t; +typedef struct s_smx_timer_t* smx_timer_t; XBT_PUBLIC(smx_timer_t) SIMIX_timer_set(double date, void (*function)(void*), void *arg); XBT_PUBLIC(void) SIMIX_timer_remove(smx_timer_t timer); diff --git a/src/bindings/lua/lua_utils.hpp b/src/bindings/lua/lua_utils.hpp index cbf83e74ab..acc134b0ea 100644 --- a/src/bindings/lua/lua_utils.hpp +++ b/src/bindings/lua/lua_utils.hpp @@ -17,11 +17,12 @@ extern "C" { * * This structure is used as the userdata parameter of lua_Writer. */ -typedef struct s_sglua_buffer { +struct s_sglua_buffer_t { char* data; size_t size; size_t capacity; -} s_sglua_buffer_t, *sglua_buffer_t; +}; +typedef s_sglua_buffer_t* sglua_buffer_t; const char* sglua_tostring(lua_State* L, int index); const char* sglua_keyvalue_tostring(lua_State* L, int key_index, int value_index); diff --git a/src/include/smpi/smpi_utils.hpp b/src/include/smpi/smpi_utils.hpp index 8af0b0adc7..9b991fd779 100644 --- a/src/include/smpi/smpi_utils.hpp +++ b/src/include/smpi/smpi_utils.hpp @@ -12,11 +12,11 @@ extern "C" { // Methods used to parse and store the values for timing injections in smpi -typedef struct s_smpi_factor *smpi_os_factor_t; -typedef struct s_smpi_factor{ +struct s_smpi_factor_t { size_t factor=0; std::vector values; -} s_smpi_factor_t; +}; +typedef s_smpi_factor_t* smpi_os_factor_t; } XBT_PUBLIC(std::vector) parse_factor(const char *smpi_coef_string); diff --git a/src/include/surf/datatypes.h b/src/include/surf/datatypes.h index 1ce9da6501..445ddc1c60 100644 --- a/src/include/surf/datatypes.h +++ b/src/include/surf/datatypes.h @@ -6,10 +6,10 @@ #ifndef MAXMIN_DATATYPES_H #define MAXMIN_DATATYPES_H -typedef struct lmm_element *lmm_element_t; -typedef struct lmm_variable *lmm_variable_t; -typedef struct lmm_constraint *lmm_constraint_t; -typedef struct lmm_constraint_light *lmm_constraint_light_t; -typedef struct lmm_system *lmm_system_t; +typedef struct s_lmm_element_t* lmm_element_t; +typedef struct s_lmm_variable_t* lmm_variable_t; +typedef struct s_lmm_constraint_t* lmm_constraint_t; +typedef struct s_lmm_constraint_light_t* lmm_constraint_light_t; +typedef struct s_lmm_system_t* lmm_system_t; #endif diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index bad197099a..61b1891b93 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -12,12 +12,7 @@ #include "surf/surf.h" #include -typedef enum { - INSTR_US_DECLARE, - INSTR_US_SET, - INSTR_US_ADD, - INSTR_US_SUB -} InstrUserVariable; +enum InstrUserVariable { INSTR_US_DECLARE, INSTR_US_SET, INSTR_US_ADD, INSTR_US_SUB }; XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API"); diff --git a/src/instr/instr_private.hpp b/src/instr/instr_private.hpp index b158f63d2d..09823441ac 100644 --- a/src/instr/instr_private.hpp +++ b/src/instr/instr_private.hpp @@ -29,7 +29,7 @@ namespace simgrid { namespace instr { -typedef enum { +enum e_event_type { PAJE_DefineContainerType, PAJE_DefineVariableType, PAJE_DefineStateType, @@ -48,9 +48,9 @@ typedef enum { PAJE_StartLink, PAJE_EndLink, PAJE_NewEvent -} e_event_type; +}; -typedef enum { TYPE_VARIABLE, TYPE_LINK, TYPE_CONTAINER, TYPE_STATE, TYPE_EVENT } e_entity_types; +enum e_entity_types { TYPE_VARIABLE, TYPE_LINK, TYPE_CONTAINER, TYPE_STATE, TYPE_EVENT }; //-------------------------------------------------- @@ -97,7 +97,7 @@ public: }; //-------------------------------------------------- -typedef enum { +enum e_container_types { INSTR_HOST, INSTR_LINK, INSTR_ROUTER, @@ -106,7 +106,7 @@ typedef enum { INSTR_MSG_VM, INSTR_MSG_PROCESS, INSTR_MSG_TASK -} e_container_types; +}; //-------------------------------------------------- @@ -318,10 +318,7 @@ XBT_PRIVATE void TRACE_paje_dump_buffer(int force); XBT_PRIVATE void dump_comment_file(const char* filename); XBT_PRIVATE void dump_comment(const char* comment); -struct s_instr_extra_data; -typedef struct s_instr_extra_data* instr_extra_data; - -typedef enum { +enum e_caller_type { TRACING_INIT, TRACING_FINALIZE, TRACING_COMM_SIZE, @@ -355,9 +352,9 @@ typedef enum { TRACING_SLEEPING, TRACING_SCAN, TRACING_EXSCAN -} e_caller_type; +}; -typedef struct s_instr_extra_data { +struct s_instr_extra_data_t { e_caller_type type; int send_size; int recv_size; @@ -371,7 +368,8 @@ typedef struct s_instr_extra_data { int* sendcounts; int* recvcounts; int num_processes; -} s_instr_extra_data_t; +}; +typedef s_instr_extra_data_t* instr_extra_data; /* Format of TRACING output. * - paje is the regular format, that we all know @@ -379,7 +377,7 @@ typedef struct s_instr_extra_data { * trace can easily be replayed with smpi_replay afterward. This trick should be removed and replaced by some code * using the signal that we will create to cleanup the TRACING */ -typedef enum { instr_fmt_paje, instr_fmt_TI } instr_fmt_type_t; +enum instr_fmt_type_t { instr_fmt_paje, instr_fmt_TI }; extern instr_fmt_type_t instr_fmt_type; } diff --git a/src/instr/instr_smpi.hpp b/src/instr/instr_smpi.hpp index 9b01f6f3ae..8b08e923cd 100644 --- a/src/instr/instr_smpi.hpp +++ b/src/instr/instr_smpi.hpp @@ -36,7 +36,8 @@ XBT_PRIVATE char* smpi_container(int rank, char* container, int n); XBT_PRIVATE const char* encode_datatype(MPI_Datatype datatype, int* known); -typedef struct smpi_trace_call_location { +class smpi_trace_call_location_t { +public: const char* filename; int linenumber; @@ -48,8 +49,7 @@ typedef struct smpi_trace_call_location { return std::string(previous_filename) + ':' + std::to_string(previous_linenumber) + ':' + filename + ':' + std::to_string(linenumber); } - -} smpi_trace_call_location_t; +}; } #endif diff --git a/src/kernel/activity/CommImpl.hpp b/src/kernel/activity/CommImpl.hpp index fb60e05189..2eecc69263 100644 --- a/src/kernel/activity/CommImpl.hpp +++ b/src/kernel/activity/CommImpl.hpp @@ -9,7 +9,7 @@ #include "src/kernel/activity/ActivityImpl.hpp" #include "surf/surf.h" -typedef enum { SIMIX_COMM_SEND, SIMIX_COMM_RECEIVE, SIMIX_COMM_READY, SIMIX_COMM_DONE } e_smx_comm_type_t; +enum e_smx_comm_type_t { SIMIX_COMM_SEND, SIMIX_COMM_RECEIVE, SIMIX_COMM_READY, SIMIX_COMM_DONE }; namespace simgrid { namespace kernel { diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index 2d978c90bf..0c40a07be0 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -87,12 +87,12 @@ void DijkstraZone::seal() xbt_node_t DijkstraZone::routeGraphNewNode(int id, int graph_id) { - graph_node_data_t data = xbt_new0(struct graph_node_data, 1); + graph_node_data_t data = xbt_new0(s_graph_node_data_t, 1); data->id = id; data->graph_id = graph_id; xbt_node_t node = xbt_graph_new_node(routeGraph_, data); - graph_node_map_element_t elm = xbt_new0(struct graph_node_map_element, 1); + graph_node_map_element_t elm = xbt_new0(s_graph_node_map_element_t, 1); elm->node = node; xbt_dict_set_ext(graphNodeMap_, (char*)(&id), sizeof(int), (xbt_dictelm_t)elm, nullptr); @@ -288,7 +288,7 @@ void DijkstraZone::getLocalRoute(NetPoint* src, NetPoint* dst, sg_platf_route_cb if (routeCache_ && elm == nullptr) { /* add to predecessor list of the current src-host to cache */ - elm = xbt_new0(struct route_cache_element, 1); + elm = xbt_new0(s_route_cache_element_t, 1); elm->pred_arr = pred_arr; elm->size = size; xbt_dict_set_ext(routeCache_, (char*)(&src_id), sizeof(int), (xbt_dictelm_t)elm, nullptr); diff --git a/src/kernel/routing/DijkstraZone.hpp b/src/kernel/routing/DijkstraZone.hpp index 29e8b90c79..f595e6667a 100644 --- a/src/kernel/routing/DijkstraZone.hpp +++ b/src/kernel/routing/DijkstraZone.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2013-2016. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2013-2017. 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. */ @@ -8,21 +8,21 @@ #include "src/kernel/routing/RoutedZone.hpp" -typedef struct graph_node_data { +struct s_graph_node_data_t { int id; int graph_id; /* used for caching internal graph id's */ -} s_graph_node_data_t; +}; typedef s_graph_node_data_t* graph_node_data_t; -typedef struct graph_node_map_element { +struct s_graph_node_map_element_t { xbt_node_t node; -} s_graph_node_map_element_t; +}; typedef s_graph_node_map_element_t* graph_node_map_element_t; -typedef struct route_cache_element { +struct s_route_cache_element_t { int* pred_arr; int size; -} s_route_cache_element_t; +}; typedef s_route_cache_element_t* route_cache_element_t; namespace simgrid { diff --git a/src/mc/ModelChecker.hpp b/src/mc/ModelChecker.hpp index bb733e3e61..fc33672b55 100644 --- a/src/mc/ModelChecker.hpp +++ b/src/mc/ModelChecker.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2015. The SimGrid Team. +/* Copyright (c) 2007-2017. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it diff --git a/src/mc/RegionSnapshot.hpp b/src/mc/RegionSnapshot.hpp index 52deff2007..cb941273cd 100644 --- a/src/mc/RegionSnapshot.hpp +++ b/src/mc/RegionSnapshot.hpp @@ -276,6 +276,6 @@ simgrid::mc::RegionSnapshot region( } } -typedef class simgrid::mc::RegionSnapshot s_mc_mem_region_t; +typedef simgrid::mc::RegionSnapshot s_mc_mem_region_t; typedef s_mc_mem_region_t* mc_mem_region_t; #endif diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index 6516f895a3..fdc2afc43d 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -128,8 +128,8 @@ template class hash> { public: std::size_t operator()(std::pairconst& x) const { - struct hash h1; - struct hash h2; + hash h1; + hash h2; return h1(x.first) ^ h2(x.second); } }; diff --git a/src/mc/mc_checkpoint.cpp b/src/mc/mc_checkpoint.cpp index d5a334f480..dcea47eb6e 100644 --- a/src/mc/mc_checkpoint.cpp +++ b/src/mc/mc_checkpoint.cpp @@ -278,10 +278,8 @@ static bool valid_variable(simgrid::mc::Variable* var, return true; } -static void fill_local_variables_values(mc_stack_frame_t stack_frame, - simgrid::mc::Frame* scope, - int process_index, - std::vector& result) +static void fill_local_variables_values(mc_stack_frame_t stack_frame, simgrid::mc::Frame* scope, int process_index, + std::vector& result) { simgrid::mc::RemoteClient* process = &mc_model_checker->process(); @@ -335,10 +333,10 @@ static void fill_local_variables_values(mc_stack_frame_t stack_frame, stack_frame, &nested_scope, process_index, result); } -static std::vector get_local_variables_values( - std::vector& stack_frames, int process_index) +static std::vector get_local_variables_values(std::vector& stack_frames, + int process_index) { - std::vector variables; + std::vector variables; for (s_mc_stack_frame_t& stack_frame : stack_frames) fill_local_variables_values(&stack_frame, stack_frame.frame, process_index, variables); return variables; diff --git a/src/mc/mc_comm_pattern.hpp b/src/mc/mc_comm_pattern.hpp index feac5b4b47..cc189d7ae4 100644 --- a/src/mc/mc_comm_pattern.hpp +++ b/src/mc/mc_comm_pattern.hpp @@ -35,15 +35,15 @@ extern XBT_PRIVATE xbt_dynar_t initial_communications_pattern; */ extern XBT_PRIVATE xbt_dynar_t incomplete_communications_pattern; -typedef enum { +enum e_mc_call_type_t { MC_CALL_TYPE_NONE, MC_CALL_TYPE_SEND, MC_CALL_TYPE_RECV, MC_CALL_TYPE_WAIT, MC_CALL_TYPE_WAITANY, -} e_mc_call_type_t; +}; -typedef enum { +enum e_mc_comm_pattern_difference_t { NONE_DIFF, TYPE_DIFF, RDV_DIFF, @@ -52,7 +52,7 @@ typedef enum { DST_PROC_DIFF, DATA_SIZE_DIFF, DATA_DIFF, -} e_mc_comm_pattern_difference_t; +}; static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req) { diff --git a/src/mc/mc_snapshot.hpp b/src/mc/mc_snapshot.hpp index 8c97902ecf..686019f94b 100644 --- a/src/mc/mc_snapshot.hpp +++ b/src/mc/mc_snapshot.hpp @@ -63,20 +63,20 @@ XBT_PRIVATE mc_mem_region_t mc_get_snapshot_region(const void* addr, const simgr * Some parts of the snapshot are ignored by zeroing them out: the real * values is stored here. * */ -typedef struct s_mc_snapshot_ignored_data { +struct s_mc_snapshot_ignored_data_t { void* start; std::vector data; -} s_mc_snapshot_ignored_data_t; +}; -typedef struct s_fd_infos { +struct s_fd_infos_t { std::string filename; int number; off_t current_position; int flags; -} s_fd_infos_t; +}; /** Information about a given stack frame */ -typedef struct s_mc_stack_frame { +struct s_mc_stack_frame_t { /** Instruction pointer */ unw_word_t ip; /** Stack pointer */ @@ -85,25 +85,26 @@ typedef struct s_mc_stack_frame { simgrid::mc::Frame* frame; std::string frame_name; unw_cursor_t unw_cursor; -} s_mc_stack_frame_t; +}; typedef s_mc_stack_frame_t* mc_stack_frame_t; -typedef struct s_local_variable { +struct s_local_variable_t { simgrid::mc::Frame* subprogram; unsigned long ip; std::string name; simgrid::mc::Type* type; void* address; int region; -} s_local_variable_t; +}; typedef s_local_variable_t* local_variable_t; -typedef struct XBT_PRIVATE s_mc_snapshot_stack { - std::vector local_variables; +struct XBT_PRIVATE s_mc_snapshot_stack_t { + std::vector local_variables; simgrid::mc::UnwindContext context; std::vector stack_frames; int process_index; -} s_mc_snapshot_stack_t, *mc_snapshot_stack_t; +}; +typedef s_mc_snapshot_stack_t* mc_snapshot_stack_t; namespace simgrid { namespace mc { @@ -125,7 +126,7 @@ public: std::vector stacks; std::vector to_ignore; std::uint64_t hash; - std::vector ignored_data; + std::vector ignored_data; std::vector current_fds; }; } diff --git a/src/mc/mc_unw_vmread.cpp b/src/mc/mc_unw_vmread.cpp index 2777a0c56f..3614cc3532 100644 --- a/src/mc/mc_unw_vmread.cpp +++ b/src/mc/mc_unw_vmread.cpp @@ -36,7 +36,7 @@ struct _UPT_info { static inline pid_t _UPT_getpid(void* arg) { - struct _UPT_info* info = static_cast<_UPT_info*>(arg); + _UPT_info* info = static_cast<_UPT_info*>(arg); return info->pid; } diff --git a/src/mc/remote/RemoteClient.cpp b/src/mc/remote/RemoteClient.cpp index b2ac880b8a..37abc50b98 100644 --- a/src/mc/remote/RemoteClient.cpp +++ b/src/mc/remote/RemoteClient.cpp @@ -116,7 +116,7 @@ struct s_mc_memory_map_re { regex_t version_re; }; -static char* get_lib_name(const char* pathname, struct s_mc_memory_map_re* res) +static char* get_lib_name(const char* pathname, s_mc_memory_map_re* res) { char* map_basename = xbt_basename(pathname); @@ -227,7 +227,7 @@ void RemoteClient::init() xbt_die("No heap information in the target process"); if (not std_heap_var->address) xbt_die("No constant address for this variable"); - this->read_bytes(&this->heap_address, sizeof(struct mdesc*), remote(std_heap_var->address), + this->read_bytes(&this->heap_address, sizeof(mdesc*), remote(std_heap_var->address), simgrid::mc::ProcessIndexDisabled); this->smx_actors_infos.clear(); @@ -262,8 +262,7 @@ void RemoteClient::refresh_heap() // Read/dereference/refresh the std_heap pointer: if (not this->heap) this->heap = std::unique_ptr(new s_xbt_mheap_t()); - this->read_bytes(this->heap.get(), sizeof(struct mdesc), remote(this->heap_address), - simgrid::mc::ProcessIndexDisabled); + this->read_bytes(this->heap.get(), sizeof(mdesc), remote(this->heap_address), simgrid::mc::ProcessIndexDisabled); this->cache_flags_ |= RemoteClient::cache_heap; } @@ -295,7 +294,7 @@ void RemoteClient::init_memory_map_info() this->binary_info = nullptr; this->libsimgrid_info = nullptr; - struct s_mc_memory_map_re res; + s_mc_memory_map_re res; if (regcomp(&res.so_re, SO_RE, 0) || regcomp(&res.version_re, VERSION_RE, 0)) xbt_die(".so regexp did not compile"); diff --git a/src/msg/msg_private.hpp b/src/msg/msg_private.hpp index e7d1ef9953..b30226e7ff 100644 --- a/src/msg/msg_private.hpp +++ b/src/msg/msg_private.hpp @@ -27,8 +27,8 @@ public: } /********************************* Task **************************************/ -typedef struct simdata_task { - ~simdata_task() +struct s_simdata_task_t { + ~s_simdata_task_t() { /* parallel tasks only */ xbt_free(this->host_list); @@ -57,7 +57,7 @@ typedef struct simdata_task { private: void reportMultipleUse() const; -} s_simdata_task_t; +}; /******************************* Process *************************************/ @@ -85,12 +85,12 @@ public: } /************************** Global variables ********************************/ -typedef struct MSG_Global { +struct s_MSG_Global_t { int debug_multiple_use; /* whether we want an error message when reusing the same Task for 2 things */ std::atomic_int_fast32_t sent_msg; /* Total amount of messages sent during the simulation */ void (*task_copy_callback)(msg_task_t task, msg_process_t src, msg_process_t dst); void_f_pvoid_t process_data_cleanup; -} s_MSG_Global_t; +}; typedef s_MSG_Global_t* MSG_Global_t; extern "C" { @@ -132,7 +132,7 @@ XBT_PRIVATE void TRACE_msg_process_sleep_in(msg_process_t process); // called fr XBT_PRIVATE void TRACE_msg_process_sleep_out(msg_process_t process); } -inline void simdata_task::setUsed() +inline void s_simdata_task_t::setUsed() { if (this->isused) this->reportMultipleUse(); diff --git a/src/msg/msg_synchro.cpp b/src/msg/msg_synchro.cpp index 703fbee4a3..b475b9dad7 100644 --- a/src/msg/msg_synchro.cpp +++ b/src/msg/msg_synchro.cpp @@ -63,16 +63,16 @@ int MSG_sem_would_block(msg_sem_t sem) { } /*-**** barrier related functions ****-*/ -typedef struct s_msg_bar { +struct s_msg_bar_t { xbt_mutex_t mutex; xbt_cond_t cond; unsigned int arrived_processes; unsigned int expected_processes; -} s_msg_bar_t; +}; /** @brief Initializes a barrier, with count elements */ msg_bar_t MSG_barrier_init(unsigned int count) { - msg_bar_t bar = xbt_new0(s_msg_bar, 1); + msg_bar_t bar = xbt_new0(s_msg_bar_t, 1); bar->expected_processes = count; bar->arrived_processes = 0; bar->mutex = xbt_mutex_init(); diff --git a/src/msg/msg_task.cpp b/src/msg/msg_task.cpp index 814282ba9f..c9b9fda0f0 100644 --- a/src/msg/msg_task.cpp +++ b/src/msg/msg_task.cpp @@ -18,7 +18,7 @@ extern "C" { XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_task, msg, "Logging specific to MSG (task)"); -void simdata_task::reportMultipleUse() const +void s_simdata_task_t::reportMultipleUse() const { if (msg_global->debug_multiple_use){ XBT_ERROR("This task is already used in there:"); diff --git a/src/msg/msg_vm.cpp b/src/msg/msg_vm.cpp index 14ac69da68..c6449bbe7f 100644 --- a/src/msg/msg_vm.cpp +++ b/src/msg/msg_vm.cpp @@ -21,13 +21,12 @@ extern "C" { -struct dirty_page { +struct s_dirty_page { double prev_clock; double prev_remaining; msg_task_t task; }; -typedef struct dirty_page s_dirty_page; -typedef struct dirty_page* dirty_page_t; +typedef s_dirty_page* dirty_page_t; XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_vm, msg, "Cloud-oriented parts of the MSG API"); @@ -242,7 +241,7 @@ static int migration_rx_fun(int argc, char *argv[]) XBT_DEBUG("mig: rx_start"); // The structure has been created in the do_migration function and should only be freed in the same place ;) - struct migration_session* ms = static_cast(MSG_process_get_data(MSG_process_self())); + migration_session* ms = static_cast(MSG_process_get_data(MSG_process_self())); bool received_finalize = false; @@ -507,7 +506,7 @@ static int migration_tx_fun(int argc, char *argv[]) XBT_DEBUG("mig: tx_start"); // Note that the ms structure has been allocated in do_migration and hence should be freed in the same function ;) - migration_session *ms = static_cast(MSG_process_get_data(MSG_process_self())); + migration_session* ms = static_cast(MSG_process_get_data(MSG_process_self())); double host_speed = ms->vm->pimpl_vm_->getPm()->getSpeed(); s_vm_params_t params; @@ -706,7 +705,7 @@ void MSG_vm_migrate(msg_vm_t vm, msg_host_t dst_pm) vm->pimpl_vm_->isMigrating = true; - struct migration_session *ms = xbt_new(struct migration_session, 1); + migration_session* ms = xbt_new(migration_session, 1); ms->vm = vm; ms->src_pm = src_pm; ms->dst_pm = dst_pm; diff --git a/src/plugins/vm/VirtualMachineImpl.hpp b/src/plugins/vm/VirtualMachineImpl.hpp index 79c3affb1d..fbc0483632 100644 --- a/src/plugins/vm/VirtualMachineImpl.hpp +++ b/src/plugins/vm/VirtualMachineImpl.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2004-2016. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2004-2017. 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. */ @@ -16,7 +16,7 @@ #define GUESTOS_NOISE 100 // This value corresponds to the cost of the global action associated to the VM // It corresponds to the cost of a VM running no tasks. -typedef struct dirty_page* dirty_page_t; +typedef struct s_dirty_page* dirty_page_t; namespace simgrid { namespace vm { diff --git a/src/simdag/simdag_private.hpp b/src/simdag/simdag_private.hpp index 84cb5ee8b8..6b14965fc2 100644 --- a/src/simdag/simdag_private.hpp +++ b/src/simdag/simdag_private.hpp @@ -38,7 +38,7 @@ extern "C" { extern XBT_PRIVATE simgrid::sd::Global *sd_global; /* Task */ -typedef struct SD_task { +struct s_SD_task_t { e_SD_task_state_t state; void *data; /* user data */ char *name; @@ -63,7 +63,7 @@ typedef struct SD_task { double *flops_amount; double *bytes_amount; double rate; -} s_SD_task_t; +}; /* SimDag private functions */ XBT_PRIVATE void SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state); diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index 5e9b5c27c8..7682fbd91b 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -13,10 +13,10 @@ #include #include -typedef struct s_smx_process_exit_fun { +struct s_smx_process_exit_fun_t { int_f_pvoid_pvoid_t fun; void *arg; -} s_smx_process_exit_fun_t; +}; typedef s_smx_process_exit_fun_t* smx_process_exit_fun_t; namespace simgrid { diff --git a/src/simix/popping_private.hpp b/src/simix/popping_private.hpp index d6c0a5c354..8dbbec1ba9 100644 --- a/src/simix/popping_private.hpp +++ b/src/simix/popping_private.hpp @@ -52,8 +52,8 @@ struct s_smx_simcall { smx_actor_t issuer; smx_timer_t timer; int mc_value; - union u_smx_scalar args[11]; - union u_smx_scalar result; + u_smx_scalar args[11]; + u_smx_scalar result; }; #define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value)) diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index d01e0f8cb3..4abd6389c3 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -53,15 +53,15 @@ std::unique_ptr simix_global; static xbt_heap_t simix_timers = nullptr; /** @brief Timer datatype */ -typedef class s_smx_timer { +class s_smx_timer_t { double date = 0.0; - s_smx_timer() = default; + s_smx_timer_t() = default; public: simgrid::xbt::Task callback; double getDate() { return date; } - s_smx_timer(double date, simgrid::xbt::Task callback) : date(date), callback(std::move(callback)) {} -} s_smx_timer_t; + s_smx_timer_t(double date, simgrid::xbt::Task callback) : date(date), callback(std::move(callback)) {} +}; void (*SMPI_switch_data_segment)(int) = nullptr; diff --git a/src/simix/smx_synchro.cpp b/src/simix/smx_synchro.cpp index be7ca2fbbe..27def86496 100644 --- a/src/simix/smx_synchro.cpp +++ b/src/simix/smx_synchro.cpp @@ -232,7 +232,7 @@ smx_cond_t SIMIX_cond_init() { XBT_IN("()"); simgrid::simix::ActorImpl p; - smx_cond_t cond = new s_smx_cond(); + smx_cond_t cond = new s_smx_cond_t(); cond->sleeping = xbt_swag_new(xbt_swag_offset(p, synchro_hookup)); cond->refcount_ = 1; XBT_OUT(); diff --git a/src/simix/smx_synchro_private.hpp b/src/simix/smx_synchro_private.hpp index 8eb66a5bcb..734998207d 100644 --- a/src/simix/smx_synchro_private.hpp +++ b/src/simix/smx_synchro_private.hpp @@ -52,19 +52,19 @@ private: } } -typedef struct s_smx_cond { - s_smx_cond() : cond_(this) {} +struct s_smx_cond_t { + s_smx_cond_t() : cond_(this) {} std::atomic_int_fast32_t refcount_{1}; smx_mutex_t mutex = nullptr; xbt_swag_t sleeping = nullptr; /* list of sleeping process */ simgrid::s4u::ConditionVariable cond_; -} s_smx_cond_t; +}; -typedef struct s_smx_sem { +struct s_smx_sem_t { unsigned int value; xbt_swag_t sleeping; /* list of sleeping process */ -} s_smx_sem_t; +}; XBT_PRIVATE void SIMIX_post_synchro(smx_activity_t synchro); XBT_PRIVATE void SIMIX_synchro_stop_waiting(smx_actor_t process, smx_simcall_t simcall); diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index ac91c2d200..81dbe1baa5 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -650,13 +650,13 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta smpi_bench_end(); //save requests information for tracing - typedef struct { + struct savedvalstype { int src; int dst; int recv; int tag; MPI_Comm comm; - } savedvalstype; + }; savedvalstype* savedvals = xbt_new0(savedvalstype, count); for (int i = 0; i < count; i++) { @@ -696,14 +696,14 @@ int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[]) { smpi_bench_end(); //save information from requests - typedef struct { + struct savedvalstype { int src; int dst; int recv; int tag; int valid; MPI_Comm comm; - } savedvalstype; + }; savedvalstype* savedvals=xbt_new0(savedvalstype, count); for (int i = 0; i < count; i++) { diff --git a/src/smpi/colls/allreduce/allreduce-rab2.cpp b/src/smpi/colls/allreduce/allreduce-rab2.cpp index 487854c724..6978a46f7d 100644 --- a/src/smpi/colls/allreduce/allreduce-rab2.cpp +++ b/src/smpi/colls/allreduce/allreduce-rab2.cpp @@ -23,7 +23,7 @@ int Coll_allreduce_rab2::allreduce(void *sbuff, void *rbuff, MPI_User_function * uop = MPIR_Op_table[op % 16 - 1]; #else MPI_User_function *uop; - struct MPIR_OP *op_ptr; + MPIR_OP *op_ptr; op_ptr = MPIR_ToPointer(op); uop = op_ptr->op; #endif diff --git a/src/smpi/colls/allreduce/allreduce-rdb.cpp b/src/smpi/colls/allreduce/allreduce-rdb.cpp index e1f85a758b..a7ee1d169d 100644 --- a/src/smpi/colls/allreduce/allreduce-rdb.cpp +++ b/src/smpi/colls/allreduce/allreduce-rdb.cpp @@ -21,7 +21,7 @@ int Coll_allreduce_rdb::allreduce(void *sbuff, void *rbuff, int count, MPI_User_function * uop = MPIR_Op_table[op % 16 - 1]; #else MPI_User_function *uop; - struct MPIR_OP *op_ptr; + MPIR_OP *op_ptr; op_ptr = MPIR_ToPointer(op); uop = op_ptr->op; #endif diff --git a/src/smpi/colls/allreduce/allreduce-smp-rdb.cpp b/src/smpi/colls/allreduce/allreduce-smp-rdb.cpp index 5c96b6296a..e94211af5d 100644 --- a/src/smpi/colls/allreduce/allreduce-smp-rdb.cpp +++ b/src/smpi/colls/allreduce/allreduce-smp-rdb.cpp @@ -49,7 +49,7 @@ int Coll_allreduce_smp_rdb::allreduce(void *send_buf, void *recv_buf, int count, MPI_User_function * uop = MPIR_Op_table[op % 16 - 1]; #else MPI_User_function *uop; - struct MPIR_OP *op_ptr; + MPIR_OP *op_ptr; op_ptr = MPIR_ToPointer(op); uop = op_ptr->op; #endif diff --git a/src/smpi/colls/allreduce/allreduce-smp-rsag-lr.cpp b/src/smpi/colls/allreduce/allreduce-smp-rsag-lr.cpp index 72eba89448..4b9b0cff29 100644 --- a/src/smpi/colls/allreduce/allreduce-smp-rsag-lr.cpp +++ b/src/smpi/colls/allreduce/allreduce-smp-rsag-lr.cpp @@ -37,7 +37,7 @@ int Coll_allreduce_smp_rsag_lr::allreduce(void *send_buf, void *recv_buf, MPI_User_function * uop = MPIR_Op_table[op % 16 - 1]; #else MPI_User_function *uop; - struct MPIR_OP *op_ptr; + MPIR_OP *op_ptr; op_ptr = MPIR_ToPointer(op); uop = op_ptr->op; #endif diff --git a/src/smpi/colls/allreduce/allreduce-smp-rsag.cpp b/src/smpi/colls/allreduce/allreduce-smp-rsag.cpp index 7176495459..c86b16abc4 100644 --- a/src/smpi/colls/allreduce/allreduce-smp-rsag.cpp +++ b/src/smpi/colls/allreduce/allreduce-smp-rsag.cpp @@ -36,7 +36,7 @@ int Coll_allreduce_smp_rsag::allreduce(void *send_buf, void *recv_buf, MPI_User_function * uop = MPIR_Op_table[op % 16 - 1]; #else MPI_User_function *uop; - struct MPIR_OP *op_ptr; + MPIR_OP *op_ptr; op_ptr = MPIR_ToPointer(op); uop = op_ptr->op; #endif diff --git a/src/smpi/colls/coll_tuned_topo.hpp b/src/smpi/colls/coll_tuned_topo.hpp index 82718230d8..e6ff4b409c 100644 --- a/src/smpi/colls/coll_tuned_topo.hpp +++ b/src/smpi/colls/coll_tuned_topo.hpp @@ -34,14 +34,14 @@ (SEGCOUNT)++; \ } -typedef struct ompi_coll_tree_t { +struct ompi_coll_tree_t { int32_t tree_root; int32_t tree_fanout; int32_t tree_bmtree; int32_t tree_prev; int32_t tree_next[MAXTREEFANOUT]; int32_t tree_nextsize; -} ompi_coll_tree_t; +}; ompi_coll_tree_t* ompi_coll_tuned_topo_build_tree(int fanout, MPI_Comm com, int root); ompi_coll_tree_t* ompi_coll_tuned_topo_build_in_order_bintree(MPI_Comm comm); diff --git a/src/smpi/colls/reduce/reduce-rab.cpp b/src/smpi/colls/reduce/reduce-rab.cpp index 394544c106..b399292eeb 100644 --- a/src/smpi/colls/reduce/reduce-rab.cpp +++ b/src/smpi/colls/reduce/reduce-rab.cpp @@ -409,13 +409,31 @@ Benchmark results on CRAY T3E #endif #endif -typedef enum {MPIM_SHORT, MPIM_INT, MPIM_LONG, MPIM_UNSIGNED_SHORT, - MPIM_UNSIGNED, MPIM_UNSIGNED_LONG, MPIM_UNSIGNED_LONG_LONG, MPIM_FLOAT, - MPIM_DOUBLE, MPIM_BYTE} MPIM_Datatype; - -typedef enum {MPIM_MAX, MPIM_MIN, MPIM_SUM, MPIM_PROD, - MPIM_LAND, MPIM_BAND, MPIM_LOR, MPIM_BOR, - MPIM_LXOR, MPIM_BXOR} MPIM_Op; +enum MPIM_Datatype { + MPIM_SHORT, + MPIM_INT, + MPIM_LONG, + MPIM_UNSIGNED_SHORT, + MPIM_UNSIGNED, + MPIM_UNSIGNED_LONG, + MPIM_UNSIGNED_LONG_LONG, + MPIM_FLOAT, + MPIM_DOUBLE, + MPIM_BYTE +}; + +enum MPIM_Op { + MPIM_MAX, + MPIM_MIN, + MPIM_SUM, + MPIM_PROD, + MPIM_LAND, + MPIM_BAND, + MPIM_LOR, + MPIM_BOR, + MPIM_LXOR, + MPIM_BXOR +}; #define MPI_I_DO_OP_C_INTEGER(MPI_I_do_op_TYPE,TYPE) \ static void MPI_I_do_op_TYPE(TYPE* b1,TYPE* b2,TYPE* rslt, int cnt,MPIM_Op op)\ { int i; \ diff --git a/src/smpi/colls/smpi_intel_mpi_selector.cpp b/src/smpi/colls/smpi_intel_mpi_selector.cpp index 53bf9cdc3e..8c6630bf31 100644 --- a/src/smpi/colls/smpi_intel_mpi_selector.cpp +++ b/src/smpi/colls/smpi_intel_mpi_selector.cpp @@ -14,21 +14,21 @@ #define INTEL_MAX_NB_NUMPROCS 12 #define INTEL_MAX_NB_PPN 5 /* 1 2 4 8 16 ppn */ -typedef struct { +struct intel_tuning_table_size_element { unsigned int max_size; int algo; -} intel_tuning_table_size_element; +}; -typedef struct { +struct intel_tuning_table_numproc_element { int max_num_proc; int num_elems; intel_tuning_table_size_element elems[INTEL_MAX_NB_THRESHOLDS]; -} intel_tuning_table_numproc_element; +}; -typedef struct { +struct intel_tuning_table_element { int ppn; intel_tuning_table_numproc_element elems[INTEL_MAX_NB_NUMPROCS]; -} intel_tuning_table_element; +}; /* I_MPI_ADJUST_ALLREDUCE diff --git a/src/smpi/colls/smpi_mvapich2_selector_stampede.hpp b/src/smpi/colls/smpi_mvapich2_selector_stampede.hpp index 7f69d1c550..a922738a50 100644 --- a/src/smpi/colls/smpi_mvapich2_selector_stampede.hpp +++ b/src/smpi/colls/smpi_mvapich2_selector_stampede.hpp @@ -13,19 +13,19 @@ XBT_PUBLIC(void) smpi_coll_cleanup_mvapich2(void); -typedef struct { +struct mv2_alltoall_tuning_element { int min; int max; int (*MV2_pt_Alltoall_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm_ptr); -} mv2_alltoall_tuning_element; +}; -typedef struct { +struct mv2_alltoall_tuning_table { int numproc; int size_table; mv2_alltoall_tuning_element algo_table[MV2_MAX_NB_THRESHOLDS]; mv2_alltoall_tuning_element in_place_algo_table[MV2_MAX_NB_THRESHOLDS]; -} mv2_alltoall_tuning_table; +}; int (*MV2_Alltoall_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm_ptr) = NULL; @@ -331,19 +331,19 @@ static void init_mv2_alltoall_tables_stampede() /************ Allgather variables and initializers */ -typedef struct { +struct mv2_allgather_tuning_element { int min; int max; int (*MV2_pt_Allgatherction)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm_ptr); -} mv2_allgather_tuning_element; +}; -typedef struct { +struct mv2_allgather_tuning_table { int numproc; int two_level[MV2_MAX_NB_THRESHOLDS]; int size_inter_table; mv2_allgather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS]; -} mv2_allgather_tuning_table; +}; int (*MV2_Allgatherction)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm); @@ -567,20 +567,20 @@ static void init_mv2_allgather_tables_stampede() /************ Gather variables and initializers */ -typedef struct { +struct mv2_gather_tuning_element { int min; int max; int (*MV2_pt_Gather_function)(void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt, MPI_Datatype recvtype, int root, MPI_Comm comm_ptr); -} mv2_gather_tuning_element; +}; -typedef struct { +struct mv2_gather_tuning_table { int numproc; int size_inter_table; mv2_gather_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS]; int size_intra_table; mv2_gather_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS]; -} mv2_gather_tuning_table; +}; int mv2_size_gather_tuning_table = 7; mv2_gather_tuning_table* mv2_gather_thresholds_table = NULL; @@ -659,18 +659,18 @@ static void init_mv2_gather_tables_stampede() /************ Allgatherv variables and initializers */ -typedef struct { +struct mv2_allgatherv_tuning_element { int min; int max; int (*MV2_pt_Allgatherv_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, int* displs, MPI_Datatype recvtype, MPI_Comm commg); -} mv2_allgatherv_tuning_element; +}; -typedef struct { +struct mv2_allgatherv_tuning_table { int numproc; int size_inter_table; mv2_allgatherv_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS]; -} mv2_allgatherv_tuning_table; +}; int (*MV2_Allgatherv_function)(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int* recvcounts, int* displs, MPI_Datatype recvtype, MPI_Comm comm); @@ -740,14 +740,14 @@ static void init_mv2_allgatherv_tables_stampede() /************ Allreduce variables and initializers */ -typedef struct { +struct mv2_allreduce_tuning_element { int min; int max; int (*MV2_pt_Allreducection)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm); -} mv2_allreduce_tuning_element; +}; -typedef struct { +struct mv2_allreduce_tuning_table { int numproc; int mcast_enabled; int is_two_level_allreduce[MV2_MAX_NB_THRESHOLDS]; @@ -755,7 +755,7 @@ typedef struct { mv2_allreduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS]; int size_intra_table; mv2_allreduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS]; -} mv2_allreduce_tuning_table; +}; int (*MV2_Allreducection)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) = NULL; @@ -931,14 +931,14 @@ static void init_mv2_allreduce_tables_stampede() mv2_size_allreduce_tuning_table * sizeof(mv2_allreduce_tuning_table)); } -typedef struct { +struct mv2_bcast_tuning_element { int min; int max; int (*MV2_pt_Bcast_function)(void* buf, int count, MPI_Datatype datatype, int root, MPI_Comm comm_ptr); int zcpy_pipelined_knomial_factor; -} mv2_bcast_tuning_element; +}; -typedef struct { +struct mv2_bcast_tuning_table { int numproc; int bcast_segment_size; int intra_node_knomial_factor; @@ -948,7 +948,7 @@ typedef struct { mv2_bcast_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS]; int size_intra_table; mv2_bcast_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS]; -} mv2_bcast_tuning_table; +}; int mv2_size_bcast_tuning_table = 0; mv2_bcast_tuning_table* mv2_bcast_thresholds_table = NULL; @@ -1162,14 +1162,14 @@ static void init_mv2_bcast_tables_stampede() /************ Reduce variables and initializers */ -typedef struct { +struct mv2_reduce_tuning_element { int min; int max; int (*MV2_pt_Reduce_function)(void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm_ptr); -} mv2_reduce_tuning_element; +}; -typedef struct { +struct mv2_reduce_tuning_table { int numproc; int inter_k_degree; int intra_k_degree; @@ -1178,7 +1178,7 @@ typedef struct { mv2_reduce_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS]; int size_intra_table; mv2_reduce_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS]; -} mv2_reduce_tuning_table; +}; int mv2_size_reduce_tuning_table = 0; mv2_reduce_tuning_table* mv2_reduce_thresholds_table = NULL; @@ -1396,18 +1396,18 @@ static void init_mv2_reduce_tables_stampede() /************ Reduce scatter variables and initializers */ -typedef struct { +struct mv2_red_scat_tuning_element { int min; int max; int (*MV2_pt_Red_scat_function)(void* sendbuf, void* recvbuf, int* recvcnts, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm_ptr); -} mv2_red_scat_tuning_element; +}; -typedef struct { +struct mv2_red_scat_tuning_table { int numproc; int size_inter_table; mv2_red_scat_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS]; -} mv2_red_scat_tuning_table; +}; int mv2_size_red_scat_tuning_table = 0; mv2_red_scat_tuning_table* mv2_red_scat_thresholds_table = NULL; @@ -1490,20 +1490,20 @@ static void init_mv2_reduce_scatter_tables_stampede() /************ Scatter variables and initializers */ -typedef struct { +struct mv2_scatter_tuning_element { int min; int max; int (*MV2_pt_Scatter_function)(void* sendbuf, int sendcnt, MPI_Datatype sendtype, void* recvbuf, int recvcnt, MPI_Datatype recvtype, int root, MPI_Comm comm); -} mv2_scatter_tuning_element; +}; -typedef struct { +struct mv2_scatter_tuning_table { int numproc; int size_inter_table; mv2_scatter_tuning_element inter_leader[MV2_MAX_NB_THRESHOLDS]; int size_intra_table; mv2_scatter_tuning_element intra_node[MV2_MAX_NB_THRESHOLDS]; -} mv2_scatter_tuning_table; +}; int* mv2_scatter_table_ppn_conf = NULL; int mv2_scatter_num_ppn_conf = 1; diff --git a/src/smpi/include/private.hpp b/src/smpi/include/private.hpp index 9504e94524..4f0ca5705b 100644 --- a/src/smpi/include/private.hpp +++ b/src/smpi/include/private.hpp @@ -85,7 +85,7 @@ extern XBT_PRIVATE double smpi_host_speed; extern XBT_PRIVATE char* smpi_data_exe_start; // start of the data+bss segment of the executable extern XBT_PRIVATE int smpi_data_exe_size; // size of the data+bss segment of the executable -typedef enum { shmalloc_none, shmalloc_local, shmalloc_global } shared_malloc_type; +enum shared_malloc_type { shmalloc_none, shmalloc_local, shmalloc_global }; extern XBT_PRIVATE shared_malloc_type smpi_cfg_shared_malloc; // Whether to activate shared malloc XBT_PRIVATE void smpi_switch_data_segment(int dest); @@ -404,10 +404,10 @@ void mpi_file_write_(int* fh, void* buf, int* count, int* datatype, MPI_Status* // TODO, make this static and expose it more cleanly -typedef struct s_smpi_privatization_region { +struct s_smpi_privatization_region_t { void* address; int file_descriptor; -} s_smpi_privatization_region_t; +}; typedef s_smpi_privatization_region_t* smpi_privatization_region_t; extern XBT_PRIVATE smpi_privatization_region_t smpi_privatization_regions; @@ -437,12 +437,12 @@ XBT_PUBLIC(smpi_trace_call_location_t*) smpi_process_get_call_location(); XBT_PUBLIC(smpi_trace_call_location_t*) smpi_trace_get_call_location(); } -typedef enum { +enum smpi_priv_strategies { SMPI_PRIVATIZE_NONE = 0, SMPI_PRIVATIZE_MMAP = 1, SMPI_PRIVATIZE_DLOPEN = 2, SMPI_PRIVATIZE_DEFAULT = SMPI_PRIVATIZE_MMAP -} smpi_priv_strategies; +}; extern XBT_PRIVATE int smpi_privatize_global_variables; diff --git a/src/smpi/include/smpi_coll.hpp b/src/smpi/include/smpi_coll.hpp index f9356eae7d..399377488e 100644 --- a/src/smpi/include/smpi_coll.hpp +++ b/src/smpi/include/smpi_coll.hpp @@ -82,12 +82,11 @@ static ret cat (COLL_UNPAREN args); \ namespace simgrid{ namespace smpi{ -struct mpi_coll_description { +struct s_mpi_coll_description_t { const char *name; const char *description; void *coll; }; -typedef struct mpi_coll_description s_mpi_coll_description_t; class Colls{ public: diff --git a/src/smpi/include/smpi_datatype.hpp b/src/smpi/include/smpi_datatype.hpp index 3b1fd7dab9..2fc90cf185 100644 --- a/src/smpi/include/smpi_datatype.hpp +++ b/src/smpi/include/smpi_datatype.hpp @@ -30,47 +30,46 @@ extern const MPI_Datatype MPI_PTR; //The following are datatypes for the MPI functions MPI_MAXLOC and MPI_MINLOC. -typedef struct { +struct float_int { float value; int index; -} float_int; -typedef struct { +}; +struct float_float { float value; float index; -} float_float; -typedef struct { +}; +struct long_long { long value; long index; -} long_long; -typedef struct { +}; +struct double_double { double value; double index; -} double_double; -typedef struct { +}; +struct long_int { long value; int index; -} long_int; -typedef struct { +}; +struct double_int { double value; int index; -} double_int; -typedef struct { +}; +struct short_int { short value; int index; -} short_int; -typedef struct { +}; +struct int_int { int value; int index; -} int_int; -typedef struct { +}; +struct long_double_int { long double value; int index; -} long_double_int; -typedef struct { +}; +struct integer128_t { int64_t value; int64_t index; -} integer128_t; - +}; namespace simgrid{ namespace smpi{ diff --git a/src/smpi/include/smpi_keyvals.hpp b/src/smpi/include/smpi_keyvals.hpp index c0ee39515a..bd4dd80fdf 100644 --- a/src/smpi/include/smpi_keyvals.hpp +++ b/src/smpi/include/smpi_keyvals.hpp @@ -11,25 +11,25 @@ #include -typedef struct smpi_delete_fn{ +struct smpi_delete_fn { MPI_Comm_delete_attr_function *comm_delete_fn; MPI_Type_delete_attr_function *type_delete_fn; MPI_Win_delete_attr_function *win_delete_fn; -} smpi_delete_fn; +}; -typedef struct smpi_copy_fn{ +struct smpi_copy_fn { MPI_Comm_copy_attr_function *comm_copy_fn; MPI_Type_copy_attr_function *type_copy_fn; MPI_Win_copy_attr_function *win_copy_fn; -} smpi_copy_fn; +}; -typedef struct s_smpi_key_elem { +struct s_smpi_key_elem_t { smpi_copy_fn copy_fn; smpi_delete_fn delete_fn; int refcount; -} s_smpi_mpi_key_elem_t; +}; -typedef struct s_smpi_key_elem *smpi_key_elem; +typedef s_smpi_key_elem_t* smpi_key_elem; namespace simgrid{ namespace smpi{ @@ -54,7 +54,7 @@ class Keyval{ template int Keyval::keyval_create(smpi_copy_fn copy_fn, smpi_delete_fn delete_fn, int* keyval, void* extra_state){ - smpi_key_elem value = (smpi_key_elem) xbt_new0(s_smpi_mpi_key_elem_t,1); + smpi_key_elem value = (smpi_key_elem)xbt_new0(s_smpi_key_elem_t, 1); value->copy_fn=copy_fn; value->delete_fn=delete_fn; diff --git a/src/smpi/internals/smpi_dvfs.cpp b/src/smpi/internals/smpi_dvfs.cpp index f83165f541..69e8a08892 100644 --- a/src/smpi/internals/smpi_dvfs.cpp +++ b/src/smpi/internals/smpi_dvfs.cpp @@ -79,14 +79,14 @@ typedef char *address; typedef short int shortint; typedef float real; typedef double doublereal; -typedef struct { +struct complex { real r; real i; -} complex; -typedef struct { +}; +struct doublecomplex { doublereal r; doublereal i; -} doublecomplex; +}; extern "C" XBT_PUBLIC(doublereal) smpi_get_host_power_peak_at_(integer *pstate_index); doublereal smpi_get_host_power_peak_at_(integer *pstate_index) diff --git a/src/smpi/internals/smpi_memory.cpp b/src/smpi/internals/smpi_memory.cpp index dbdb570a69..7811d9570a 100644 --- a/src/smpi/internals/smpi_memory.cpp +++ b/src/smpi/internals/smpi_memory.cpp @@ -147,7 +147,7 @@ void smpi_initialize_global_memory_segments() } smpi_privatization_regions = static_cast( - xbt_malloc(smpi_process_count() * sizeof(struct s_smpi_privatization_region))); + xbt_malloc(smpi_process_count() * sizeof(s_smpi_privatization_region_t))); for (int i=0; i< smpi_process_count(); i++){ // create SIMIX_process_count() mappings of this size with the same data inside diff --git a/src/smpi/internals/smpi_static_variables.cpp b/src/smpi/internals/smpi_static_variables.cpp index af3ecbb7c2..0d504c455d 100644 --- a/src/smpi/internals/smpi_static_variables.cpp +++ b/src/smpi/internals/smpi_static_variables.cpp @@ -6,10 +6,10 @@ #include "private.hpp" #include -typedef struct s_smpi_static { +struct s_smpi_static_t { void *ptr; void_f_pvoid_t free_fn; -} s_smpi_static_t; +}; /** * \brief Holds a reference to all static variables that were registered diff --git a/src/surf/StorageImpl.hpp b/src/surf/StorageImpl.hpp index b74d624435..b5f52e1f93 100644 --- a/src/surf/StorageImpl.hpp +++ b/src/surf/StorageImpl.hpp @@ -165,10 +165,10 @@ private: /** @ingroup SURF_storage_interface * @brief The possible type of action for the storage component */ -typedef enum { +enum e_surf_action_storage_type_t { READ = 0, /**< Read a file */ WRITE /**< Write in a file */ -} e_surf_action_storage_type_t; +}; /** @ingroup SURF_storage_interface * @brief SURF storage action interface class diff --git a/src/surf/maxmin.cpp b/src/surf/maxmin.cpp index 23ca2252d2..017e6f4e76 100644 --- a/src/surf/maxmin.cpp +++ b/src/surf/maxmin.cpp @@ -16,11 +16,11 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_maxmin, surf, "Logging specific to SURF (maxmin)"); -typedef struct s_dyn_light { +struct s_dyn_light_t { int *data; int pos; int size; -} s_dyn_light_t; +}; typedef s_dyn_light_t* dyn_light_t; double sg_maxmin_precision = 0.00001; /* Change this with --cfg=maxmin/precision:VALUE */ diff --git a/src/surf/maxmin_private.hpp b/src/surf/maxmin_private.hpp index 15de20fffc..976caa0308 100644 --- a/src/surf/maxmin_private.hpp +++ b/src/surf/maxmin_private.hpp @@ -17,7 +17,7 @@ * Basically, each variable will have a set of elements, one for each constraint where it is involved. * Then, it is used to list all variables involved in constraint through constraint's xxx_element_set lists, or vice-versa list all constraints for a given variable. */ -typedef struct lmm_element { +struct s_lmm_element_t { /* hookup to constraint */ s_xbt_swag_hookup_t enabled_element_set_hookup; s_xbt_swag_hookup_t disabled_element_set_hookup; @@ -30,14 +30,14 @@ typedef struct lmm_element { // - if CPU, then probably 1. // - If network, then 1 in forward direction and 0.05 backward for the ACKs double consumption_weight; -} s_lmm_element_t; +}; #define make_elem_active(elem) xbt_swag_insert_at_head(elem,&(elem->constraint->active_element_set)) #define make_elem_inactive(elem) xbt_swag_remove(elem,&(elem->constraint->active_element_set)) -typedef struct lmm_constraint_light { +struct s_lmm_constraint_light_t { double remaining_over_usage; lmm_constraint_t cnst; -} s_lmm_constraint_light_t; +}; /** @ingroup SURF_lmm * @brief LMM constraint @@ -47,7 +47,7 @@ typedef struct lmm_constraint_light { * \li Active elements which variable's weight is non-zero (i.e. it is enabled) AND its element value is non-zero. LMM_solve iterates over active elements during resolution, dynamically making them active or unactive. * */ -typedef struct lmm_constraint { +struct s_lmm_constraint_t { /* hookup to system */ s_xbt_swag_hookup_t constraint_set_hookup; s_xbt_swag_hookup_t active_constraint_set_hookup; @@ -71,14 +71,14 @@ typedef struct lmm_constraint { double lambda; double new_lambda; lmm_constraint_light_t cnst_light; -} s_lmm_constraint_t; +}; /** @ingroup SURF_lmm * @brief LMM variable * * When something prevents us from enabling a variable, we "stage" the weight that we would have like to set, so that as soon as possible we enable the variable with desired weight */ -typedef struct lmm_variable { +struct s_lmm_variable_t { /* hookup to system */ s_xbt_swag_hookup_t variable_set_hookup; s_xbt_swag_hookup_t saturated_variable_set_hookup; @@ -103,16 +103,16 @@ typedef struct lmm_variable { /* \begin{For Lagrange only} */ double mu; double new_mu; - double (*func_f) (struct lmm_variable * var, double x); /* (f) */ - double (*func_fp) (struct lmm_variable * var, double x); /* (f') */ - double (*func_fpi) (struct lmm_variable * var, double x); /* (f')^{-1} */ + double (*func_f)(s_lmm_variable_t* var, double x); /* (f) */ + double (*func_fp)(s_lmm_variable_t* var, double x); /* (f') */ + double (*func_fpi)(s_lmm_variable_t* var, double x); /* (f')^{-1} */ /* \end{For Lagrange only} */ -} s_lmm_variable_t; +}; /** @ingroup SURF_lmm * @brief LMM system */ -typedef struct lmm_system { +struct s_lmm_system_t { int modified; bool selective_update_active; /* flag to update partially the system only selecting changed portions */ unsigned visited_counter; /* used by lmm_update_modified_set and lmm_remove_modified_set to cleverly (un-)flag the constraints (more details in these functions)*/ @@ -130,7 +130,7 @@ typedef struct lmm_system { xbt_mallocator_t variable_mallocator; void (*solve_fun)(lmm_system_t self); -} s_lmm_system_t; +}; #define extract_variable(sys) xbt_swag_extract(&(sys->variable_set)) #define extract_constraint(sys) xbt_swag_extract(&(sys->constraint_set)) diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index a481159120..93cbaf9500 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -345,11 +345,11 @@ private: /** @ingroup SURF_interface * @brief Resource which have a metric handled by a maxmin system */ -typedef struct { +struct s_surf_metric_t { double peak; /**< The peak of the metric, ie its max value */ double scale; /**< Current availability of the metric according to the traces, in [0,1] */ tmgr_trace_event_t event; /**< The associated trace event associated to the metric */ -} s_surf_metric_t; +}; namespace simgrid { namespace surf { diff --git a/src/surf/surf_private.hpp b/src/surf/surf_private.hpp index 0e9fec31bd..3e8d90c2d8 100644 --- a/src/surf/surf_private.hpp +++ b/src/surf/surf_private.hpp @@ -19,14 +19,14 @@ extern XBT_PRIVATE const char* surf_action_state_names[6]; /** @ingroup SURF_interface * @brief Possible update mechanisms */ -typedef enum { +enum e_UM_t { UM_FULL, /**< Full update mechanism: the remaining time of every action is recomputed at each step */ UM_LAZY, /**< Lazy update mechanism: only the modified actions get recomputed. It may be slower than full if your system is tightly coupled to the point where every action gets recomputed anyway. In that case, you'd better not try to be cleaver with lazy and go for a simple full update. */ UM_UNDEFINED /**< Mechanism not defined */ -} e_UM_t; +}; /* Generic functions common to all models */ diff --git a/src/surf/trace_mgr.hpp b/src/surf/trace_mgr.hpp index 625db0422b..b6877723b2 100644 --- a/src/surf/trace_mgr.hpp +++ b/src/surf/trace_mgr.hpp @@ -14,13 +14,13 @@ extern "C" { /* Iterator within a trace */ -typedef struct tmgr_trace_event { +struct s_tmgr_trace_event_t { tmgr_trace_t trace; unsigned int idx; sg_resource_t resource; int free_me; -} s_tmgr_trace_event_t; -typedef struct tmgr_trace_event* tmgr_trace_event_t; +}; +typedef s_tmgr_trace_event_t* tmgr_trace_event_t; /** * \brief Free a trace event structure diff --git a/src/surf/xml/platf_private.hpp b/src/surf/xml/platf_private.hpp index a4f9047321..93b710ea36 100644 --- a/src/surf/xml/platf_private.hpp +++ b/src/surf/xml/platf_private.hpp @@ -23,12 +23,12 @@ extern "C" { typedef size_t yy_size_t; #endif -typedef enum { - SURF_CLUSTER_DRAGONFLY=3, - SURF_CLUSTER_FAT_TREE=2, - SURF_CLUSTER_FLAT = 1, - SURF_CLUSTER_TORUS = 0 -} e_surf_cluster_topology_t; +enum e_surf_cluster_topology_t { + SURF_CLUSTER_DRAGONFLY = 3, + SURF_CLUSTER_FAT_TREE = 2, + SURF_CLUSTER_FLAT = 1, + SURF_CLUSTER_TORUS = 0 +}; /* ***************************************** */ /* @@ -41,7 +41,7 @@ typedef enum { * used, instead of malloced structures. */ -typedef struct { +struct s_sg_platf_host_cbarg_t { const char* id; std::vector speed_per_pstate; int pstate; @@ -50,7 +50,7 @@ typedef struct { tmgr_trace_t state_trace; const char* coord; std::map* properties; -} s_sg_platf_host_cbarg_t; +}; typedef s_sg_platf_host_cbarg_t* sg_platf_host_cbarg_t; class HostLinkCreationArgs { @@ -83,15 +83,15 @@ public: tmgr_trace_t state_trace; }; -typedef struct s_sg_platf_route_cbarg *sg_platf_route_cbarg_t; -typedef struct s_sg_platf_route_cbarg { +struct s_sg_platf_route_cbarg_t { bool symmetrical; sg_netpoint_t src; sg_netpoint_t dst; sg_netpoint_t gw_src; sg_netpoint_t gw_dst; std::vector* link_list; -} s_sg_platf_route_cbarg_t; +}; +typedef s_sg_platf_route_cbarg_t* sg_platf_route_cbarg_t; class ClusterCreationArgs { public: @@ -152,11 +152,11 @@ public: std::string name; }; -typedef struct s_sg_platf_prop_cbarg *sg_platf_prop_cbarg_t; -typedef struct s_sg_platf_prop_cbarg { +struct s_sg_platf_prop_cbarg_t { const char *id; const char *value; -} s_sg_platf_prop_cbarg_t; +}; +typedef s_sg_platf_prop_cbarg_t* sg_platf_prop_cbarg_t; class TraceCreationArgs { public: @@ -173,8 +173,7 @@ public: std::string element; }; -typedef struct s_sg_platf_process_cbarg *sg_platf_process_cbarg_t; -typedef struct s_sg_platf_process_cbarg { +struct s_sg_platf_process_cbarg_t { const char **argv; int argc; std::map* properties; @@ -183,7 +182,8 @@ typedef struct s_sg_platf_process_cbarg { double start_time; double kill_time; e_surf_process_on_failure_t on_failure; -} s_sg_platf_process_cbarg_t; +}; +typedef s_sg_platf_process_cbarg_t* sg_platf_process_cbarg_t; class ZoneCreationArgs { public: diff --git a/src/surf/xml/surfxml_sax_cb.cpp b/src/surf/xml/surfxml_sax_cb.cpp index 2b16c03ebc..a84649f4b2 100644 --- a/src/surf/xml/surfxml_sax_cb.cpp +++ b/src/surf/xml/surfxml_sax_cb.cpp @@ -144,9 +144,8 @@ struct unit_scale { }; /* Note: field `unit' for the last element of parameter `units' should be nullptr. */ -static double surf_parse_get_value_with_unit(const char* string, const struct unit_scale* units, - const char* entity_kind, std::string name, const char* error_msg, - const char* default_unit) +static double surf_parse_get_value_with_unit(const char* string, const unit_scale* units, const char* entity_kind, + std::string name, const char* error_msg, const char* default_unit) { char* ptr; int i; @@ -174,113 +173,91 @@ static double surf_parse_get_value_with_unit(const char* string, const struct un double surf_parse_get_time(const char* string, const char* entity_kind, std::string name) { - const struct unit_scale units[] = { - { "w", 7 * 24 * 60 * 60 }, - { "d", 24 * 60 * 60 }, - { "h", 60 * 60 }, - { "m", 60 }, - { "s", 1.0 }, - { "ms", 1e-3 }, - { "us", 1e-6 }, - { "ns", 1e-9 }, - { "ps", 1e-12 }, - { nullptr, 0 } - }; + const unit_scale units[] = {{"w", 7 * 24 * 60 * 60}, + {"d", 24 * 60 * 60}, + {"h", 60 * 60}, + {"m", 60}, + {"s", 1.0}, + {"ms", 1e-3}, + {"us", 1e-6}, + {"ns", 1e-9}, + {"ps", 1e-12}, + {nullptr, 0}}; return surf_parse_get_value_with_unit(string, units, entity_kind, name, "Append 's' to your time to get seconds", "s"); } double surf_parse_get_size(const char* string, const char* entity_kind, std::string name) { - const struct unit_scale units[] = { - { "EiB", pow(1024, 6) }, - { "PiB", pow(1024, 5) }, - { "TiB", pow(1024, 4) }, - { "GiB", pow(1024, 3) }, - { "MiB", pow(1024, 2) }, - { "KiB", 1024 }, - { "EB", 1e18 }, - { "PB", 1e15 }, - { "TB", 1e12 }, - { "GB", 1e9 }, - { "MB", 1e6 }, - { "kB", 1e3 }, - { "B", 1.0 }, - { "Eib", 0.125 * pow(1024, 6) }, - { "Pib", 0.125 * pow(1024, 5) }, - { "Tib", 0.125 * pow(1024, 4) }, - { "Gib", 0.125 * pow(1024, 3) }, - { "Mib", 0.125 * pow(1024, 2) }, - { "Kib", 0.125 * 1024 }, - { "Eb", 0.125 * 1e18 }, - { "Pb", 0.125 * 1e15 }, - { "Tb", 0.125 * 1e12 }, - { "Gb", 0.125 * 1e9 }, - { "Mb", 0.125 * 1e6 }, - { "kb", 0.125 * 1e3 }, - { "b", 0.125 }, - { nullptr, 0 } - }; + const unit_scale units[] = {{"EiB", pow(1024, 6)}, + {"PiB", pow(1024, 5)}, + {"TiB", pow(1024, 4)}, + {"GiB", pow(1024, 3)}, + {"MiB", pow(1024, 2)}, + {"KiB", 1024}, + {"EB", 1e18}, + {"PB", 1e15}, + {"TB", 1e12}, + {"GB", 1e9}, + {"MB", 1e6}, + {"kB", 1e3}, + {"B", 1.0}, + {"Eib", 0.125 * pow(1024, 6)}, + {"Pib", 0.125 * pow(1024, 5)}, + {"Tib", 0.125 * pow(1024, 4)}, + {"Gib", 0.125 * pow(1024, 3)}, + {"Mib", 0.125 * pow(1024, 2)}, + {"Kib", 0.125 * 1024}, + {"Eb", 0.125 * 1e18}, + {"Pb", 0.125 * 1e15}, + {"Tb", 0.125 * 1e12}, + {"Gb", 0.125 * 1e9}, + {"Mb", 0.125 * 1e6}, + {"kb", 0.125 * 1e3}, + {"b", 0.125}, + {nullptr, 0}}; return surf_parse_get_value_with_unit(string, units, entity_kind, name, "Append 'B' to get bytes (or 'b' for bits but 1B = 8b).", "B"); } double surf_parse_get_bandwidth(const char* string, const char* entity_kind, std::string name) { - const struct unit_scale units[] = { - { "EiBps", pow(1024, 6) }, - { "PiBps", pow(1024, 5) }, - { "TiBps", pow(1024, 4) }, - { "GiBps", pow(1024, 3) }, - { "MiBps", pow(1024, 2) }, - { "KiBps", 1024 }, - { "EBps", 1e18 }, - { "PBps", 1e15 }, - { "TBps", 1e12 }, - { "GBps", 1e9 }, - { "MBps", 1e6 }, - { "kBps", 1e3 }, - { "Bps", 1.0 }, - { "Eibps", 0.125 * pow(1024, 6) }, - { "Pibps", 0.125 * pow(1024, 5) }, - { "Tibps", 0.125 * pow(1024, 4) }, - { "Gibps", 0.125 * pow(1024, 3) }, - { "Mibps", 0.125 * pow(1024, 2) }, - { "Kibps", 0.125 * 1024 }, - { "Tbps", 0.125 * 1e12 }, - { "Gbps", 0.125 * 1e9 }, - { "Mbps", 0.125 * 1e6 }, - { "kbps", 0.125 * 1e3 }, - { "bps", 0.125 }, - { nullptr, 0 } - }; + const unit_scale units[] = {{"EiBps", pow(1024, 6)}, + {"PiBps", pow(1024, 5)}, + {"TiBps", pow(1024, 4)}, + {"GiBps", pow(1024, 3)}, + {"MiBps", pow(1024, 2)}, + {"KiBps", 1024}, + {"EBps", 1e18}, + {"PBps", 1e15}, + {"TBps", 1e12}, + {"GBps", 1e9}, + {"MBps", 1e6}, + {"kBps", 1e3}, + {"Bps", 1.0}, + {"Eibps", 0.125 * pow(1024, 6)}, + {"Pibps", 0.125 * pow(1024, 5)}, + {"Tibps", 0.125 * pow(1024, 4)}, + {"Gibps", 0.125 * pow(1024, 3)}, + {"Mibps", 0.125 * pow(1024, 2)}, + {"Kibps", 0.125 * 1024}, + {"Tbps", 0.125 * 1e12}, + {"Gbps", 0.125 * 1e9}, + {"Mbps", 0.125 * 1e6}, + {"kbps", 0.125 * 1e3}, + {"bps", 0.125}, + {nullptr, 0}}; return surf_parse_get_value_with_unit(string, units, entity_kind, name, "Append 'Bps' to get bytes per second (or 'bps' for bits but 1Bps = 8bps)", "Bps"); } double surf_parse_get_speed(const char* string, const char* entity_kind, std::string name) { - const struct unit_scale units[] = { - { "yottaflops", 1e24 }, - { "Yf", 1e24 }, - { "zettaflops", 1e21 }, - { "Zf", 1e21 }, - { "exaflops", 1e18 }, - { "Ef", 1e18 }, - { "petaflops", 1e15 }, - { "Pf", 1e15 }, - { "teraflops", 1e12 }, - { "Tf", 1e12 }, - { "gigaflops", 1e9 }, - { "Gf", 1e9 }, - { "megaflops", 1e6 }, - { "Mf", 1e6 }, - { "kiloflops", 1e3 }, - { "kf", 1e3 }, - { "flops", 1.0 }, - { "f", 1.0 }, - { nullptr, 0 } - }; + const unit_scale units[] = {{"yottaflops", 1e24}, {"Yf", 1e24}, {"zettaflops", 1e21}, {"Zf", 1e21}, + {"exaflops", 1e18}, {"Ef", 1e18}, {"petaflops", 1e15}, {"Pf", 1e15}, + {"teraflops", 1e12}, {"Tf", 1e12}, {"gigaflops", 1e9}, {"Gf", 1e9}, + {"megaflops", 1e6}, {"Mf", 1e6}, {"kiloflops", 1e3}, {"kf", 1e3}, + {"flops", 1.0}, {"f", 1.0}, {nullptr, 0}}; return surf_parse_get_value_with_unit(string, units, entity_kind, name, "Append 'f' or 'flops' to your speed to get flop per second", "f"); } diff --git a/src/xbt/backtrace_linux.cpp b/src/xbt/backtrace_linux.cpp index 097519cb5b..5b23cb1974 100644 --- a/src/xbt/backtrace_linux.cpp +++ b/src/xbt/backtrace_linux.cpp @@ -38,10 +38,9 @@ struct trace_arg { int size; }; -static _Unwind_Reason_Code -backtrace_helper (struct _Unwind_Context *ctx, void *a) +static _Unwind_Reason_Code backtrace_helper(_Unwind_Context* ctx, void* a) { - struct trace_arg *arg = (struct trace_arg *) a; + trace_arg* arg = static_cast(a); /* We are first called with address in the __backtrace function. Skip it. */ diff --git a/src/xbt/cunit.cpp b/src/xbt/cunit.cpp index 87c869c4f4..cde26d96a9 100644 --- a/src/xbt/cunit.cpp +++ b/src/xbt/cunit.cpp @@ -40,11 +40,12 @@ static int _xbt_test_suite_disabled = 0; xbt_test_unit_t _xbt_test_current_unit = nullptr; /* test suite test log */ -typedef struct s_xbt_test_log { +struct s_xbt_test_log { char *text; const char *file; int line; -} *xbt_test_log_t; +}; +typedef s_xbt_test_log* xbt_test_log_t; static void xbt_test_log_dump(xbt_test_log_t log) { @@ -55,7 +56,7 @@ static void xbt_test_log_dump(xbt_test_log_t log) } /* test suite test check */ -typedef struct s_xbt_test_test { +struct s_xbt_test_test { char *title; int failed; int expected_failure; @@ -63,7 +64,8 @@ typedef struct s_xbt_test_test { const char *file; int line; xbt_dynar_t logs; -} *xbt_test_test_t; +}; +typedef s_xbt_test_test* xbt_test_test_t; static void xbt_test_test_dump(xbt_test_test_t test) { @@ -165,7 +167,7 @@ static void xbt_test_log_free(void *log) /** @brief create test suite */ xbt_test_suite_t xbt_test_suite_new(const char *name, const char *fmt, ...) { - xbt_test_suite_t suite = xbt_new0(struct s_xbt_test_suite, 1); + xbt_test_suite_t suite = xbt_new0(s_xbt_test_suite, 1); va_list ap; if (_xbt_test_suites == nullptr) @@ -231,7 +233,7 @@ void xbt_test_suite_push(xbt_test_suite_t suite, const char *name, ts_test_cb_t xbt_assert(func); xbt_assert(fmt); - unit = xbt_new0(struct s_xbt_test_unit, 1); + unit = xbt_new0(s_xbt_test_unit, 1); va_start(ap, fmt); unit->title = bvprintf(fmt, ap); va_end(ap); @@ -646,7 +648,7 @@ void _xbt_test_add(const char *file, int line, const char *fmt, ...) xbt_assert(unit); va_list ap; - xbt_test_test_t test = xbt_new0(struct s_xbt_test_test, 1); + xbt_test_test_t test = xbt_new0(s_xbt_test_test, 1); va_start(ap, fmt); test->title = bvprintf(fmt, ap); va_end(ap); @@ -668,7 +670,7 @@ void _xbt_test_fail(const char *file, int line, const char *fmt, ...) "Test failed even before being declared (broken unit: %s)", unit->title); va_list ap; - xbt_test_log_t log = xbt_new(struct s_xbt_test_log, 1); + xbt_test_log_t log = xbt_new(s_xbt_test_log, 1); va_start(ap, fmt); log->text = bvprintf(fmt, ap); va_end(ap); @@ -711,7 +713,7 @@ void _xbt_test_log(const char *file, int line, const char *fmt, ...) "Test logged into even before being declared (broken test unit: %s)", unit->title); va_list ap; - xbt_test_log_t log = xbt_new(struct s_xbt_test_log, 1); + xbt_test_log_t log = xbt_new(s_xbt_test_log, 1); va_start(ap, fmt); log->text = bvprintf(fmt, ap); va_end(ap); diff --git a/teshsuite/mc/dwarf/dwarf.cpp b/teshsuite/mc/dwarf/dwarf.cpp index 16ad053fc8..0bc60e6893 100644 --- a/teshsuite/mc/dwarf/dwarf.cpp +++ b/teshsuite/mc/dwarf/dwarf.cpp @@ -105,11 +105,13 @@ static simgrid::mc::Member* find_member(simgrid::mc::Type& type, const char* nam int some_local_variable = 0; -typedef struct foo {int i;} s_foo; +struct s_foo { + int i; +}; static void test_type_by_name(simgrid::mc::RemoteClient& process, s_foo my_foo) { - assert(process.binary_info->full_types_by_name.find("struct foo") != process.binary_info->full_types_by_name.end()); + assert(process.binary_info->full_types_by_name.find("struct s_foo") != process.binary_info->full_types_by_name.end()); } int main(int argc, char** argv) diff --git a/teshsuite/surf/lmm_usage/lmm_usage.cpp b/teshsuite/surf/lmm_usage/lmm_usage.cpp index 3a57290ef4..73c34dae81 100644 --- a/teshsuite/surf/lmm_usage/lmm_usage.cpp +++ b/teshsuite/surf/lmm_usage/lmm_usage.cpp @@ -23,11 +23,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(surf_test, "Messages specific for surf example"); /* ==l1== L2 ==L3== */ /* ------ */ -typedef enum { - MAXMIN, - LAGRANGE_RENO, - LAGRANGE_VEGAS -} method_t; +enum method_t { MAXMIN, LAGRANGE_RENO, LAGRANGE_VEGAS }; static double dichotomy(double func(double), double min, double max, double min_error) { -- 2.20.1