From 12459ed00fdc525ec6e524555dfe80ce7737bab7 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 18 Nov 2020 16:11:29 +0100 Subject: [PATCH] Prefer "using" to "typedef". --- include/simgrid/Exception.hpp | 4 +- include/simgrid/forward.h | 70 +++++++++---------- include/simgrid/jedule/jedule.hpp | 2 +- include/simgrid/jedule/jedule_events.hpp | 2 +- include/simgrid/jedule/jedule_platform.hpp | 2 +- include/simgrid/kernel/future.hpp | 2 +- include/simgrid/kernel/resource/Action.hpp | 19 +++-- include/simgrid/msg.h | 4 +- include/simgrid/simix.hpp | 5 +- include/simgrid/simix/blocking_simcall.hpp | 4 +- include/smpi/forward.hpp | 26 +++---- include/xbt/config.h | 2 +- include/xbt/functional.hpp | 16 ++--- include/xbt/replay.hpp | 4 +- include/xbt/signal.hpp | 2 +- include/xbt/string.hpp | 10 +-- src/kernel/actor/ActorImpl.hpp | 6 +- src/kernel/context/Context.hpp | 2 +- src/kernel/context/ContextBoost.hpp | 4 +- src/kernel/context/ContextRaw.cpp | 4 +- src/kernel/lmm/maxmin.cpp | 2 +- src/kernel/lmm/maxmin.hpp | 4 +- src/kernel/resource/profile/FutureEvtSet.hpp | 2 +- src/kernel/routing/DijkstraZone.cpp | 2 +- src/mc/compare.cpp | 4 +- src/mc/inspect/DwarfExpression.hpp | 4 +- src/mc/inspect/LocationList.hpp | 4 +- src/mc/inspect/ObjectInformation.cpp | 4 +- src/mc/inspect/Type.hpp | 2 +- src/mc/mc_hash.hpp | 2 +- src/mc/mc_record.hpp | 2 +- src/mc/remote/RemoteSimulation.cpp | 4 +- src/mc/sosp/PageStore.hpp | 6 +- src/mc/sosp/Snapshot.hpp | 10 +-- src/simix/popping_private.hpp | 8 +-- src/smpi/include/private.hpp | 12 ++-- src/smpi/include/smpi_keyvals.hpp | 2 +- src/smpi/include/smpi_request.hpp | 7 +- src/smpi/include/smpi_topo.hpp | 2 +- src/smpi/internals/smpi_config.cpp | 2 +- src/smpi/internals/smpi_global.cpp | 10 ++- src/smpi/internals/smpi_replay.cpp | 4 +- src/smpi/internals/smpi_shared.cpp | 2 +- src/smpi/internals/smpi_utils.cpp | 2 +- src/smpi/mpi/smpi_request.cpp | 2 +- .../plugins/load_balancer/LoadBalancer.cpp | 2 +- .../plugins/load_balancer/load_balancer.hpp | 2 +- src/surf/HostImpl.hpp | 5 +- src/surf/cpu_ti.hpp | 10 +-- src/xbt/xbt_log_appender_file.cpp | 2 +- 50 files changed, 153 insertions(+), 163 deletions(-) diff --git a/include/simgrid/Exception.hpp b/include/simgrid/Exception.hpp index a030f0b812..23695038ab 100644 --- a/include/simgrid/Exception.hpp +++ b/include/simgrid/Exception.hpp @@ -113,7 +113,7 @@ public: ~TimeoutException() override; }; -XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::TimeoutException") typedef TimeoutException TimeoutError; +using TimeoutError XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::TimeoutException") = TimeoutException; /** Exception raised when a host fails */ class HostFailureException : public Exception { @@ -239,6 +239,6 @@ private: } // namespace simgrid -XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::Exception") typedef simgrid::Exception xbt_ex; +using xbt_ex XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::Exception") = simgrid::Exception; #endif diff --git a/include/simgrid/forward.h b/include/simgrid/forward.h index 4d450ab9d7..73212dcc67 100644 --- a/include/simgrid/forward.h +++ b/include/simgrid/forward.h @@ -101,37 +101,37 @@ namespace kernel { class EngineImpl; namespace actor { class ActorImpl; -typedef boost::intrusive_ptr ActorImplPtr; +using ActorImplPtr = boost::intrusive_ptr; // What's executed as an actor code: -typedef std::function ActorCode; +using ActorCode = std::function; // Create an ActorCode from the parameters parsed in the XML file (or elsewhere) -typedef std::function args)> ActorCodeFactory; +using ActorCodeFactory = std::function args)>; } // namespace actor namespace activity { class ActivityImpl; enum class State; - typedef boost::intrusive_ptr ActivityImplPtr; + using ActivityImplPtr = boost::intrusive_ptr; XBT_PUBLIC void intrusive_ptr_add_ref(ActivityImpl* activity); XBT_PUBLIC void intrusive_ptr_release(ActivityImpl* activity); class ConditionVariableImpl; class CommImpl; - typedef boost::intrusive_ptr CommImplPtr; + using CommImplPtr = boost::intrusive_ptr; class ExecImpl; - typedef boost::intrusive_ptr ExecImplPtr; + using ExecImplPtr = boost::intrusive_ptr; class IoImpl; - typedef boost::intrusive_ptr IoImplPtr; + using IoImplPtr = boost::intrusive_ptr; class MutexImpl; - typedef boost::intrusive_ptr MutexImplPtr; + using MutexImplPtr = boost::intrusive_ptr; class RawImpl; - typedef boost::intrusive_ptr RawImplPtr; + using RawImplPtr = boost::intrusive_ptr; class SemaphoreImpl; - typedef boost::intrusive_ptr SemaphoreImplPtr; + using SemaphoreImplPtr = boost::intrusive_ptr; class SleepImpl; - typedef boost::intrusive_ptr SleepImplPtr; + using SleepImplPtr = boost::intrusive_ptr; class MailboxImpl; } @@ -192,30 +192,30 @@ class VirtualMachineImpl; } // namespace vm } // namespace simgrid -typedef simgrid::s4u::Actor s4u_Actor; -typedef simgrid::s4u::Barrier s4u_Barrier; -typedef simgrid::s4u::Comm s4u_Comm; -typedef simgrid::s4u::Exec s4u_Exec; -typedef simgrid::s4u::Host s4u_Host; -typedef simgrid::s4u::Link s4u_Link; -typedef simgrid::s4u::File s4u_File; -typedef simgrid::s4u::ConditionVariable s4u_ConditionVariable; -typedef simgrid::s4u::Mailbox s4u_Mailbox; -typedef simgrid::s4u::Mutex s4u_Mutex; -typedef simgrid::s4u::Semaphore s4u_Semaphore; -typedef simgrid::s4u::Disk s4u_Disk; -typedef simgrid::s4u::Storage s4u_Storage; -typedef simgrid::s4u::NetZone s4u_NetZone; -typedef simgrid::s4u::VirtualMachine s4u_VM; - -typedef simgrid::simix::Timer* smx_timer_t; -typedef simgrid::kernel::actor::ActorImpl* smx_actor_t; -typedef simgrid::kernel::activity::ActivityImpl* smx_activity_t; -typedef simgrid::kernel::activity::ConditionVariableImpl* smx_cond_t; -typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t; -typedef simgrid::kernel::activity::MutexImpl* smx_mutex_t; -typedef simgrid::kernel::activity::SemaphoreImpl* smx_sem_t; -XBT_ATTRIB_DEPRECATED_v330("Please use kernel::activity::State") typedef simgrid::kernel::activity::State e_smx_state_t; +using s4u_Actor = simgrid::s4u::Actor; +using s4u_Barrier = simgrid::s4u::Barrier; +using s4u_Comm = simgrid::s4u::Comm; +using s4u_Exec = simgrid::s4u::Exec; +using s4u_Host = simgrid::s4u::Host; +using s4u_Link = simgrid::s4u::Link; +using s4u_File = simgrid::s4u::File; +using s4u_ConditionVariable = simgrid::s4u::ConditionVariable; +using s4u_Mailbox = simgrid::s4u::Mailbox; +using s4u_Mutex = simgrid::s4u::Mutex; +using s4u_Semaphore = simgrid::s4u::Semaphore; +using s4u_Disk = simgrid::s4u::Disk; +using s4u_Storage = simgrid::s4u::Storage; +using s4u_NetZone = simgrid::s4u::NetZone; +using s4u_VM = simgrid::s4u::VirtualMachine; + +using smx_timer_t = simgrid::simix::Timer*; +using smx_actor_t = simgrid::kernel::actor::ActorImpl*; +using smx_activity_t = simgrid::kernel::activity::ActivityImpl*; +using smx_cond_t = simgrid::kernel::activity::ConditionVariableImpl*; +using smx_mailbox_t = simgrid::kernel::activity::MailboxImpl*; +using smx_mutex_t = simgrid::kernel::activity::MutexImpl*; +using smx_sem_t = simgrid::kernel::activity::SemaphoreImpl*; +using e_smx_state_t XBT_ATTRIB_DEPRECATED_v330("Please use kernel::activity::State") = simgrid::kernel::activity::State; #else typedef struct s4u_Actor s4u_Actor; diff --git a/include/simgrid/jedule/jedule.hpp b/include/simgrid/jedule/jedule.hpp index 55b84eba46..06893ce10c 100644 --- a/include/simgrid/jedule/jedule.hpp +++ b/include/simgrid/jedule/jedule.hpp @@ -34,6 +34,6 @@ public: } // namespace jedule } // namespace simgrid -typedef simgrid::jedule::Jedule *jedule_t; +using jedule_t = simgrid::jedule::Jedule*; #endif /* JEDULE_HPP_ */ diff --git a/include/simgrid/jedule/jedule_events.hpp b/include/simgrid/jedule/jedule_events.hpp index e7987cb486..e6992e5c03 100644 --- a/include/simgrid/jedule/jedule_events.hpp +++ b/include/simgrid/jedule/jedule_events.hpp @@ -40,6 +40,6 @@ private: } } -typedef simgrid::jedule::Event* jed_event_t; +using jed_event_t = simgrid::jedule::Event*; #endif /* JEDULE_EVENTS_H_ */ diff --git a/include/simgrid/jedule/jedule_platform.hpp b/include/simgrid/jedule/jedule_platform.hpp index 8097776b16..a63279e16c 100644 --- a/include/simgrid/jedule/jedule_platform.hpp +++ b/include/simgrid/jedule/jedule_platform.hpp @@ -53,7 +53,7 @@ public: } // namespace jedule } // namespace simgrid -typedef simgrid::jedule::Container * jed_container_t; +using jed_container_t = simgrid::jedule::Container*; void get_resource_selection_by_hosts(std::vector& subset_list, const std::vector& host_list); diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index b41008eb64..4428b6e46a 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -329,7 +329,7 @@ public: */ template auto then_no_unwrap(F continuation) -> Future { - typedef decltype(continuation(std::move(*this))) R; + using R = decltype(continuation(std::move(*this))); if (state_ == nullptr) throw std::future_error(std::future_errc::no_state); auto state = std::move(state_); diff --git a/include/simgrid/kernel/resource/Action.hpp b/include/simgrid/kernel/resource/Action.hpp index a74f944faf..7d1db42250 100644 --- a/include/simgrid/kernel/resource/Action.hpp +++ b/include/simgrid/kernel/resource/Action.hpp @@ -20,12 +20,11 @@ namespace simgrid { namespace kernel { namespace resource { -typedef std::pair heap_element_type; -typedef boost::heap::pairing_heap, boost::heap::stable, - boost::heap::compare>> - heap_type; +using heap_element_type = std::pair; +using heap_type = + boost::heap::pairing_heap, boost::heap::stable, + boost::heap::compare>>; -typedef std::pair heap_element_type; class XBT_PUBLIC ActionHeap : public heap_type { friend Action; @@ -63,14 +62,12 @@ public: /* Lazy update needs this Set hook to maintain a list of the tracked actions */ boost::intrusive::list_member_hook<> modified_set_hook_; bool is_within_modified_set() const { return modified_set_hook_.is_linked(); } - typedef boost::intrusive::list< - Action, boost::intrusive::member_hook, &Action::modified_set_hook_>> - ModifiedSet; + using ModifiedSet = boost::intrusive::list< + Action, boost::intrusive::member_hook, &Action::modified_set_hook_>>; boost::intrusive::list_member_hook<> state_set_hook_; - typedef boost::intrusive::list< - Action, boost::intrusive::member_hook, &Action::state_set_hook_>> - StateSet; + using StateSet = boost::intrusive::list< + Action, boost::intrusive::member_hook, &Action::state_set_hook_>>; enum class State { INITED, /**< Created, but not started yet */ diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index b39a6723d0..a0e5a84b05 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -38,8 +38,8 @@ class Comm; class Task; } } -typedef simgrid::msg::Comm sg_msg_Comm; -typedef simgrid::msg::Task sg_msg_Task; +using sg_msg_Comm = simgrid::msg::Comm; +using sg_msg_Task = simgrid::msg::Task; #else typedef struct msg_Comm sg_msg_Comm; typedef struct msg_Task sg_msg_Task; diff --git a/include/simgrid/simix.hpp b/include/simgrid/simix.hpp index db2d157f27..5f61cb1080 100644 --- a/include/simgrid/simix.hpp +++ b/include/simgrid/simix.hpp @@ -53,7 +53,7 @@ template typename std::result_of::type simcall(F&& code, mc::Simc // If we are in the application, pass the code to the maestro which // executes it for us and reports the result. We use a std::future which // conveniently handles the success/failure value for us. - typedef typename std::result_of::type R; + using R = typename std::result_of::type; simgrid::xbt::Result result; simcall_run_kernel([&result, &code] { simgrid::xbt::fulfill_promise(result, std::forward(code)); }, t); return result.get(); @@ -96,8 +96,7 @@ template R simcall_blocking(F&& code, mc::SimcallInspector* t namespace simgrid { namespace simix { - -typedef std::pair TimerQelt; +using TimerQelt = std::pair; static boost::heap::fibonacci_heap>> simix_timers; /** @brief Timer datatype */ diff --git a/include/simgrid/simix/blocking_simcall.hpp b/include/simgrid/simix/blocking_simcall.hpp index c95e63f09f..fd9797f9d8 100644 --- a/include/simgrid/simix/blocking_simcall.hpp +++ b/include/simgrid/simix/blocking_simcall.hpp @@ -45,7 +45,7 @@ XBT_PUBLIC void unblock(smx_actor_t process); */ template auto kernel_sync(F code) -> decltype(code().get()) { - typedef decltype(code().get()) T; + using T = decltype(code().get()); if (SIMIX_is_maestro()) xbt_die("Can't execute blocking call in kernel mode"); @@ -150,7 +150,7 @@ private: */ template auto kernel_async(F code) -> Future { - typedef decltype(code().get()) T; + using T = decltype(code().get()); // Execute the code in the kernel and get the kernel future: simgrid::kernel::Future future = simgrid::kernel::actor::simcall(std::move(code)); diff --git a/include/smpi/forward.hpp b/include/smpi/forward.hpp index 515b34f290..69c26ee5d3 100644 --- a/include/smpi/forward.hpp +++ b/include/smpi/forward.hpp @@ -34,19 +34,19 @@ class Win; } } -typedef simgrid::smpi::Comm SMPI_Comm; -typedef simgrid::smpi::Datatype SMPI_Datatype; -typedef simgrid::smpi::Errhandler SMPI_Errhandler; -typedef simgrid::smpi::File SMPI_File; -typedef simgrid::smpi::Group SMPI_Group; -typedef simgrid::smpi::Info SMPI_Info; -typedef simgrid::smpi::Op SMPI_Op; -typedef simgrid::smpi::Request SMPI_Request; -typedef simgrid::smpi::Topo SMPI_Topology; -typedef simgrid::smpi::Topo_Cart SMPI_Cart_topology; -typedef simgrid::smpi::Topo_Dist_Graph SMPI_Dist_Graph_topology; -typedef simgrid::smpi::Topo_Graph SMPI_Graph_topology; -typedef simgrid::smpi::Win SMPI_Win; +using SMPI_Comm = simgrid::smpi::Comm; +using SMPI_Datatype = simgrid::smpi::Datatype; +using SMPI_Errhandler = simgrid::smpi::Errhandler; +using SMPI_File = simgrid::smpi::File; +using SMPI_Group = simgrid::smpi::Group; +using SMPI_Info = simgrid::smpi::Info; +using SMPI_Op = simgrid::smpi::Op; +using SMPI_Request = simgrid::smpi::Request; +using SMPI_Topology = simgrid::smpi::Topo; +using SMPI_Cart_topology = simgrid::smpi::Topo_Cart; +using SMPI_Dist_Graph_topology = simgrid::smpi::Topo_Dist_Graph; +using SMPI_Graph_topology = simgrid::smpi::Topo_Graph; +using SMPI_Win = simgrid::smpi::Win; #else diff --git a/include/xbt/config.h b/include/xbt/config.h index 2fde39a4d7..e9cb3ad219 100644 --- a/include/xbt/config.h +++ b/include/xbt/config.h @@ -56,7 +56,7 @@ /** @brief Configuration set's data type is opaque. */ #ifdef __cplusplus #include -typedef simgrid::config::Config* xbt_cfg_t; +using xbt_cfg_t = simgrid::config::Config*; #else typedef void* xbt_cfg_t; #endif diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index cc053a56a2..b8695631a1 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -99,11 +99,8 @@ class Task { struct whatever {}; // Union used for storage: - typedef typename std::aligned_union<0, - void*, - std::pair, - std::pair - >::type TaskUnion; + using TaskUnion = typename std::aligned_union<0, void*, std::pair, + std::pair>::type; // Is F suitable for small buffer optimization? template @@ -117,11 +114,11 @@ class Task { "SBO not working for reference_wrapper"); // Call (and possibly destroy) the function: - typedef R (*call_function)(TaskUnion&, Args...); + using call_function = R (*)(TaskUnion&, Args...); // Destroy the function (of needed): - typedef void (*destroy_function)(TaskUnion&); + using destroy_function = void (*)(TaskUnion&); // Move the function (otherwise memcpy): - typedef void (*move_function)(TaskUnion& dest, TaskUnion& src); + using move_function = void (*)(TaskUnion& dest, TaskUnion& src); // Vtable of functions for manipulating whatever is in the TaskUnion: struct TaskVtable { @@ -248,7 +245,8 @@ template class TaskImpl { F code_; std::tuple args_; - typedef decltype(simgrid::xbt::apply(std::move(code_), std::move(args_))) result_type; + using result_type = decltype(simgrid::xbt::apply(std::move(code_), std::move(args_))); + public: TaskImpl(F code, std::tuple args) : code_(std::move(code)), diff --git a/include/xbt/replay.hpp b/include/xbt/replay.hpp index bb8c27e599..d1596e5a5f 100644 --- a/include/xbt/replay.hpp +++ b/include/xbt/replay.hpp @@ -18,14 +18,14 @@ namespace simgrid { namespace xbt { /* To split the file if a unique one is given (specific variable for the other case live in runner()) */ -typedef std::vector ReplayAction; +using ReplayAction = std::vector; XBT_PUBLIC_DATA std::ifstream* action_fs; XBT_PUBLIC int replay_runner(const char* actor_name, const char* trace_filename); } } -typedef std::function action_fun; +using action_fun = std::function; XBT_PUBLIC void xbt_replay_action_register(const char* action_name, const action_fun& function); XBT_PUBLIC action_fun xbt_replay_action_get(const char* action_name); diff --git a/include/xbt/signal.hpp b/include/xbt/signal.hpp index 4289edd0f6..36bd87f2dc 100644 --- a/include/xbt/signal.hpp +++ b/include/xbt/signal.hpp @@ -23,7 +23,7 @@ namespace xbt { */ template class signal { - typedef std::function callback_type; + using callback_type = std::function; std::map handlers_; unsigned int callback_sequence_id = 0; diff --git a/include/xbt/string.hpp b/include/xbt/string.hpp index 527892905c..8ae6756303 100644 --- a/include/xbt/string.hpp +++ b/include/xbt/string.hpp @@ -72,11 +72,11 @@ class XBT_PUBLIC string { public: // Types - typedef std::size_t size_type; - typedef char& reference; - typedef const char& const_reference; - typedef char* iterator; - typedef const char* const_iterator; + using size_type = std::size_t; + using reference = char&; + using const_reference = const char&; + using iterator = char*; + using const_iterator = const char*; // Dtor ~string() diff --git a/src/kernel/actor/ActorImpl.hpp b/src/kernel/actor/ActorImpl.hpp index 1b2e6fb46d..71230189cd 100644 --- a/src/kernel/actor/ActorImpl.hpp +++ b/src/kernel/actor/ActorImpl.hpp @@ -189,9 +189,9 @@ public: }; /* Used to keep the list of actors blocked on a synchro */ -typedef boost::intrusive::list, - &ActorImpl::smx_synchro_hook>> - SynchroList; +using SynchroList = + boost::intrusive::list, + &ActorImpl::smx_synchro_hook>>; XBT_PUBLIC void create_maestro(const std::function& code); XBT_PUBLIC int get_maxpid(); diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index e9bea4bc42..dc747a1d26 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -95,7 +95,7 @@ public: /* This allows Java to hijack the context factory (Java induces factories of factory :) */ -typedef ContextFactory* (*ContextFactoryInitializer)(); +using ContextFactoryInitializer = ContextFactory* (*)(); XBT_PUBLIC_DATA ContextFactoryInitializer factory_initializer; XBT_PRIVATE ContextFactory* thread_factory(); diff --git a/src/kernel/context/ContextBoost.hpp b/src/kernel/context/ContextBoost.hpp index 8284fc9835..0eaf6c42ad 100644 --- a/src/kernel/context/ContextBoost.hpp +++ b/src/kernel/context/ContextBoost.hpp @@ -37,10 +37,10 @@ public: private: #if BOOST_VERSION < 106100 boost::context::fcontext_t fc_; - typedef intptr_t arg_type; + using arg_type = intptr_t; #else boost::context::detail::fcontext_t fc_; - typedef boost::context::detail::transfer_t arg_type; + using arg_type = boost::context::detail::transfer_t; #endif XBT_ATTRIB_NORETURN static void wrapper(arg_type arg); diff --git a/src/kernel/context/ContextRaw.cpp b/src/kernel/context/ContextRaw.cpp index 3b36adaa82..443c37f770 100644 --- a/src/kernel/context/ContextRaw.cpp +++ b/src/kernel/context/ContextRaw.cpp @@ -12,9 +12,9 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context); // Raw context routines -typedef void (*rawctx_entry_point_t)(simgrid::kernel::context::SwappedContext*); +using rawctx_entry_point_t = void (*)(simgrid::kernel::context::SwappedContext*); -typedef void* raw_stack_t; +using raw_stack_t = void*; extern "C" raw_stack_t raw_makecontext(void* malloced_stack, int stack_size, rawctx_entry_point_t entry_point, simgrid::kernel::context::SwappedContext* arg); extern "C" void raw_swapcontext(raw_stack_t* old, raw_stack_t new_context); diff --git a/src/kernel/lmm/maxmin.cpp b/src/kernel/lmm/maxmin.cpp index 88c40cf43a..b78013167b 100644 --- a/src/kernel/lmm/maxmin.cpp +++ b/src/kernel/lmm/maxmin.cpp @@ -16,7 +16,7 @@ namespace simgrid { namespace kernel { namespace lmm { -typedef std::vector dyn_light_t; +using dyn_light_t = std::vector; int Variable::next_rank_ = 1; int Constraint::next_rank_ = 1; diff --git a/src/kernel/lmm/maxmin.hpp b/src/kernel/lmm/maxmin.hpp index 5aef06ad2b..f525dfa55b 100644 --- a/src/kernel/lmm/maxmin.hpp +++ b/src/kernel/lmm/maxmin.hpp @@ -532,8 +532,8 @@ public: resource::Action::ModifiedSet* modified_set_ = nullptr; private: - typedef std::vector dyn_light_t; - + using dyn_light_t = std::vector; + //Data used in lmm::solve std::vector cnst_light_vec; dyn_light_t saturated_constraints; diff --git a/src/kernel/resource/profile/FutureEvtSet.hpp b/src/kernel/resource/profile/FutureEvtSet.hpp index 96d000850e..9ef271e485 100644 --- a/src/kernel/resource/profile/FutureEvtSet.hpp +++ b/src/kernel/resource/profile/FutureEvtSet.hpp @@ -26,7 +26,7 @@ public: void add_event(double date, Event* evt); private: - typedef std::pair Qelt; + using Qelt = std::pair; std::priority_queue, std::greater<>> heap_; }; diff --git a/src/kernel/routing/DijkstraZone.cpp b/src/kernel/routing/DijkstraZone.cpp index cebdab7000..5c8026815b 100644 --- a/src/kernel/routing/DijkstraZone.cpp +++ b/src/kernel/routing/DijkstraZone.cpp @@ -129,7 +129,7 @@ void DijkstraZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationAr int nr_nodes = xbt_dynar_length(nodes); std::vector cost_arr(nr_nodes); /* link cost from src to other hosts */ pred_arr.resize(nr_nodes); /* predecessors in path from src */ - typedef std::pair Qelt; + using Qelt = std::pair; std::priority_queue, std::greater<>> pqueue; /* initialize */ diff --git a/src/mc/compare.cpp b/src/mc/compare.cpp index 6baf980d9d..4a0f4191b2 100644 --- a/src/mc/compare.cpp +++ b/src/mc/compare.cpp @@ -38,8 +38,8 @@ public: } }; -typedef std::array HeapLocationPair; -typedef std::set HeapLocationPairs; +using HeapLocationPair = std::array; +using HeapLocationPairs = std::set; class HeapArea : public HeapLocation { public: diff --git a/src/mc/inspect/DwarfExpression.hpp b/src/mc/inspect/DwarfExpression.hpp index 797f66143e..c6258b302f 100644 --- a/src/mc/inspect/DwarfExpression.hpp +++ b/src/mc/inspect/DwarfExpression.hpp @@ -34,7 +34,7 @@ namespace dwarf { * just a sequence of dwarf instructions. We currently directly use * `Dwarf_Op` from `dwarf.h` for dwarf instructions. */ -typedef std::vector DwarfExpression; +using DwarfExpression = std::vector; /** Context of evaluation of a DWARF expression * @@ -62,7 +62,7 @@ public: */ class ExpressionStack { public: - typedef std::uintptr_t value_type; + using value_type = std::uintptr_t; static const std::size_t max_size = 64; private: diff --git a/src/mc/inspect/LocationList.hpp b/src/mc/inspect/LocationList.hpp index ea30d9059a..461a4993e8 100644 --- a/src/mc/inspect/LocationList.hpp +++ b/src/mc/inspect/LocationList.hpp @@ -22,7 +22,7 @@ namespace dwarf { /** A DWARF expression with optional validity constraints */ class LocationListEntry { public: - typedef simgrid::xbt::Range range_type; + using range_type = simgrid::xbt::Range; private: DwarfExpression expression_; @@ -41,7 +41,7 @@ public: bool valid_for_ip(unw_word_t ip) const { return range_.contain(ip); } }; -typedef std::vector LocationList; +using LocationList = std::vector; /** Location of some variable in memory * diff --git a/src/mc/inspect/ObjectInformation.cpp b/src/mc/inspect/ObjectInformation.cpp index c18536f04c..a1c090cb62 100644 --- a/src/mc/inspect/ObjectInformation.cpp +++ b/src/mc/inspect/ObjectInformation.cpp @@ -89,7 +89,7 @@ const Variable* ObjectInformation::find_variable(const char* name) const void ObjectInformation::remove_global_variable(const char* name) { - typedef std::vector::size_type size_type; + using size_type = std::vector::size_type; if (this->global_variables.empty()) return; @@ -139,7 +139,7 @@ void ObjectInformation::remove_global_variable(const char* name) static void remove_local_variable(Frame& scope, const char* var_name, const char* subprogram_name, Frame const& subprogram) { - typedef std::vector::size_type size_type; + using size_type = std::vector::size_type; // If the current subprogram matches the given name: if ((subprogram_name == nullptr || (not subprogram.name.empty() && subprogram.name == subprogram_name)) && diff --git a/src/mc/inspect/Type.hpp b/src/mc/inspect/Type.hpp index e7d4cac544..14454d4d14 100644 --- a/src/mc/inspect/Type.hpp +++ b/src/mc/inspect/Type.hpp @@ -29,7 +29,7 @@ namespace mc { */ class Member { public: - typedef int flags_type; + using flags_type = int; static constexpr flags_type INHERITANCE_FLAG = 1; static constexpr flags_type VIRTUAL_POINTER_FLAG = 2; diff --git a/src/mc/mc_hash.hpp b/src/mc/mc_hash.hpp index 7e4e97d311..9fb828fbb4 100644 --- a/src/mc/mc_hash.hpp +++ b/src/mc/mc_hash.hpp @@ -12,7 +12,7 @@ namespace simgrid { namespace mc { -typedef std::uint64_t hash_type; +using hash_type = std::uint64_t; XBT_PRIVATE hash_type hash(simgrid::mc::Snapshot const& snapshot); diff --git a/src/mc/mc_record.hpp b/src/mc/mc_record.hpp index b52aee4053..39d960e40b 100644 --- a/src/mc/mc_record.hpp +++ b/src/mc/mc_record.hpp @@ -25,7 +25,7 @@ namespace simgrid { namespace mc { -typedef std::vector RecordTrace; +using RecordTrace = std::vector; /** Convert a string representation of the path into an array of `simgrid::mc::Transition` */ diff --git a/src/mc/remote/RemoteSimulation.cpp b/src/mc/remote/RemoteSimulation.cpp index 385bd6c71e..294d641ba0 100644 --- a/src/mc/remote/RemoteSimulation.cpp +++ b/src/mc/remote/RemoteSimulation.cpp @@ -539,7 +539,7 @@ void RemoteSimulation::ignore_heap(IgnoredHeapRegion const& region) return; } - typedef std::vector::size_type size_type; + using size_type = std::vector::size_type; size_type start = 0; size_type end = ignored_heap_.size() - 1; @@ -568,7 +568,7 @@ void RemoteSimulation::ignore_heap(IgnoredHeapRegion const& region) void RemoteSimulation::unignore_heap(void* address, size_t size) { - typedef std::vector::size_type size_type; + using size_type = std::vector::size_type; size_type start = 0; size_type end = ignored_heap_.size() - 1; diff --git a/src/mc/sosp/PageStore.hpp b/src/mc/sosp/PageStore.hpp index 702fc15d39..e43be427b6 100644 --- a/src/mc/sosp/PageStore.hpp +++ b/src/mc/sosp/PageStore.hpp @@ -73,15 +73,15 @@ namespace mc { */ class PageStore { public: // Types - typedef std::uint64_t hash_type; + using hash_type = std::uint64_t; private: // Types // We are using a cheap hash to index a page. // We should expect collision and we need to associate multiple page indices // to the same hash. - typedef std::unordered_set page_set_type; - typedef std::unordered_map pages_map_type; + using page_set_type = std::unordered_set; + using pages_map_type = std::unordered_map; // Fields: /** First page */ diff --git a/src/mc/sosp/Snapshot.hpp b/src/mc/sosp/Snapshot.hpp index c0531b522b..11bc6d222c 100644 --- a/src/mc/sosp/Snapshot.hpp +++ b/src/mc/sosp/Snapshot.hpp @@ -34,7 +34,7 @@ struct s_mc_stack_frame_t { std::string frame_name; unw_cursor_t unw_cursor; }; -typedef s_mc_stack_frame_t* mc_stack_frame_t; +using mc_stack_frame_t = s_mc_stack_frame_t*; struct s_local_variable_t { simgrid::mc::Frame* subprogram; @@ -43,16 +43,16 @@ struct s_local_variable_t { simgrid::mc::Type* type; void* address; }; -typedef s_local_variable_t* local_variable_t; -typedef const s_local_variable_t* const_local_variable_t; +using local_variable_t = s_local_variable_t*; +using const_local_variable_t = const s_local_variable_t*; struct XBT_PRIVATE s_mc_snapshot_stack_t { std::vector local_variables; simgrid::mc::UnwindContext context; std::vector stack_frames; }; -typedef s_mc_snapshot_stack_t* mc_snapshot_stack_t; -typedef const s_mc_snapshot_stack_t* const_mc_snapshot_stack_t; +using mc_snapshot_stack_t = s_mc_snapshot_stack_t*; +using const_mc_snapshot_stack_t = const s_mc_snapshot_stack_t*; namespace simgrid { namespace mc { diff --git a/src/simix/popping_private.hpp b/src/simix/popping_private.hpp index d5e918abf1..d0079a6047 100644 --- a/src/simix/popping_private.hpp +++ b/src/simix/popping_private.hpp @@ -17,10 +17,10 @@ XBT_PUBLIC_DATA const std::array simcall_names; /* Name of each simcall */ -typedef bool (*simix_match_func_t)(void*, void*, simgrid::kernel::activity::CommImpl*); -typedef void (*simix_copy_data_func_t)(simgrid::kernel::activity::CommImpl*, void*, size_t); -typedef void (*simix_clean_func_t)(void*); -typedef void (*FPtr)(); // Hide the ugliness +using simix_match_func_t = bool (*)(void*, void*, simgrid::kernel::activity::CommImpl*); +using simix_copy_data_func_t = void (*)(simgrid::kernel::activity::CommImpl*, void*, size_t); +using simix_clean_func_t = void (*)(void*); +using FPtr = void (*)(); // Hide the ugliness /* Pack all possible scalar types in an union */ union u_smx_scalar { diff --git a/src/smpi/include/private.hpp b/src/smpi/include/private.hpp index ceb544fd56..c2bc1082d9 100644 --- a/src/smpi/include/private.hpp +++ b/src/smpi/include/private.hpp @@ -67,11 +67,9 @@ extern XBT_PUBLIC int mpi_statuses_ignore_; extern XBT_PRIVATE MPI_Comm MPI_COMM_UNINITIALIZED; -typedef SMPI_Cart_topology* MPIR_Cart_Topology; - -typedef SMPI_Graph_topology* MPIR_Graph_Topology; - -typedef SMPI_Dist_Graph_topology* MPIR_Dist_Graph_Topology; +using MPIR_Cart_Topology = SMPI_Cart_topology*; +using MPIR_Graph_Topology = SMPI_Graph_topology*; +using MPIR_Dist_Graph_Topology = SMPI_Dist_Graph_topology*; XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process(); XBT_PRIVATE simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor); @@ -489,7 +487,7 @@ struct s_smpi_privatization_region_t { void* address; int file_descriptor; }; -typedef s_smpi_privatization_region_t* smpi_privatization_region_t; +using smpi_privatization_region_t = s_smpi_privatization_region_t*; extern XBT_PRIVATE int smpi_loaded_page; XBT_PRIVATE smpi_privatization_region_t smpi_init_global_memory_segment_process(); @@ -503,7 +501,7 @@ XBT_PRIVATE smpi_privatization_region_t smpi_init_global_memory_segment_process( #define TOPAGE(addr) (void*)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize) /** Used only if PAPI is compiled in, but integrated anyway so that this file does not depend on internal_config.h (to speed builds) */ -typedef std::vector> papi_counter_t; +using papi_counter_t = std::vector>; struct papi_process_data { papi_counter_t counter_data; int event_set; diff --git a/src/smpi/include/smpi_keyvals.hpp b/src/smpi/include/smpi_keyvals.hpp index 4526b03643..5352b42d76 100644 --- a/src/smpi/include/smpi_keyvals.hpp +++ b/src/smpi/include/smpi_keyvals.hpp @@ -35,7 +35,7 @@ struct s_smpi_key_elem_t { int refcount; }; -typedef s_smpi_key_elem_t* smpi_key_elem; +using smpi_key_elem = s_smpi_key_elem_t*; namespace simgrid{ namespace smpi{ diff --git a/src/smpi/include/smpi_request.hpp b/src/smpi/include/smpi_request.hpp index 091219edfa..9e6bb4572a 100644 --- a/src/smpi/include/smpi_request.hpp +++ b/src/smpi/include/smpi_request.hpp @@ -12,15 +12,14 @@ namespace simgrid{ namespace smpi{ -typedef struct s_smpi_mpi_generalized_request_funcs { +struct smpi_mpi_generalized_request_funcs_t { MPI_Grequest_query_function *query_fn; MPI_Grequest_free_function *free_fn; MPI_Grequest_cancel_function *cancel_fn; void* extra_state; s4u::ConditionVariablePtr cond; s4u::MutexPtr mutex; -} s_smpi_mpi_generalized_request_funcs_t; -typedef struct s_smpi_mpi_generalized_request_funcs *smpi_mpi_generalized_request_funcs; +}; class Request : public F2C { void* buf_; @@ -48,7 +47,7 @@ class Request : public F2C { int refcount_; MPI_Op op_; int cancelled_; // tri-state - smpi_mpi_generalized_request_funcs generalized_funcs; + smpi_mpi_generalized_request_funcs_t* generalized_funcs; MPI_Request* nbc_requests_; int nbc_requests_size_; static bool match_common(MPI_Request req, MPI_Request sender, MPI_Request receiver); diff --git a/src/smpi/include/smpi_topo.hpp b/src/smpi/include/smpi_topo.hpp index e7354c6fa8..88d27c9015 100644 --- a/src/smpi/include/smpi_topo.hpp +++ b/src/smpi/include/smpi_topo.hpp @@ -10,7 +10,7 @@ #include "smpi_status.hpp" #include -typedef std::shared_ptr MPI_Topology; +using MPI_Topology = std::shared_ptr; namespace simgrid{ namespace smpi{ diff --git a/src/smpi/internals/smpi_config.cpp b/src/smpi/internals/smpi_config.cpp index f9c3c31fbf..5aa6b92c58 100644 --- a/src/smpi/internals/smpi_config.cpp +++ b/src/smpi/internals/smpi_config.cpp @@ -99,7 +99,7 @@ simgrid::config::Flag _smpi_cfg_comp_adjustment_file{"smpi/comp-adj std::ifstream fstream(filename); xbt_assert(fstream.is_open(), "Could not open file %s. Does it exist?", filename.c_str()); std::string line; - typedef boost::tokenizer> Tokenizer; + using Tokenizer = boost::tokenizer>; std::getline(fstream, line); // Skip the header line while (std::getline(fstream, line)) { Tokenizer tok(line); diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 9aed93b882..590aada22f 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -236,7 +236,7 @@ static void smpi_init_papi() XBT_ERROR("Could not initialize PAPI library; is it correctly installed and linked?" " Expected version is %u", PAPI_VER_CURRENT); - typedef boost::tokenizer> Tokenizer; + using Tokenizer = boost::tokenizer>; boost::char_separator separator_units(";"); std::string str = smpi_cfg_papi_events_file(); Tokenizer tokens(str, separator_units); @@ -288,11 +288,9 @@ static void smpi_init_papi() #endif } - - -typedef std::function smpi_entry_point_type; -typedef int (* smpi_c_entry_point_type)(int argc, char **argv); -typedef void (*smpi_fortran_entry_point_type)(); +using smpi_entry_point_type = std::function; +using smpi_c_entry_point_type = int (*)(int argc, char** argv); +using smpi_fortran_entry_point_type = void (*)(); template static int smpi_run_entry_point(const F& entry_point, const std::string& executable_path, std::vector args) diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index 9bdb30ae2a..749fed9fcd 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -61,8 +61,8 @@ public: }; } -typedef std::tuple req_key_t; -typedef std::unordered_map>> req_storage_t; +using req_key_t = std::tuple; +using req_storage_t = std::unordered_map>>; void log_timed_action(const simgrid::xbt::ReplayAction& action, double clock) { diff --git a/src/smpi/internals/smpi_shared.cpp b/src/smpi/internals/smpi_shared.cpp index efd249d8c0..766ee46aad 100644 --- a/src/smpi/internals/smpi_shared.cpp +++ b/src/smpi/internals/smpi_shared.cpp @@ -79,7 +79,7 @@ struct shared_data_t { }; std::unordered_map> allocs; -typedef decltype(allocs)::value_type shared_data_key_type; +using shared_data_key_type = decltype(allocs)::value_type; struct shared_metadata_t { size_t size; diff --git a/src/smpi/internals/smpi_utils.cpp b/src/smpi/internals/smpi_utils.cpp index c5bf7ff9b9..f15557a9ae 100644 --- a/src/smpi/internals/smpi_utils.cpp +++ b/src/smpi/internals/smpi_utils.cpp @@ -22,7 +22,7 @@ std::vector parse_factor(const std::string& smpi_coef_string) std::vector smpi_factor; /** Setup the tokenizer that parses the string **/ - typedef boost::tokenizer> Tokenizer; + using Tokenizer = boost::tokenizer>; boost::char_separator sep(";"); boost::char_separator factor_separator(":"); Tokenizer tokens(smpi_coef_string, sep); diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index 31fe56ff2a..5dd26dcdf4 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -1164,7 +1164,7 @@ int Request::grequest_start(MPI_Grequest_query_function* query_fn, MPI_Grequest_ (*request)->flags_ |= MPI_REQ_GENERALIZED; (*request)->flags_ |= MPI_REQ_PERSISTENT; (*request)->refcount_ = 1; - ((*request)->generalized_funcs) = new s_smpi_mpi_generalized_request_funcs_t; + ((*request)->generalized_funcs) = new smpi_mpi_generalized_request_funcs_t; ((*request)->generalized_funcs)->query_fn=query_fn; ((*request)->generalized_funcs)->free_fn=free_fn; ((*request)->generalized_funcs)->cancel_fn=cancel_fn; diff --git a/src/smpi/plugins/load_balancer/LoadBalancer.cpp b/src/smpi/plugins/load_balancer/LoadBalancer.cpp index 1e9866c34a..23d4587e8b 100644 --- a/src/smpi/plugins/load_balancer/LoadBalancer.cpp +++ b/src/smpi/plugins/load_balancer/LoadBalancer.cpp @@ -23,7 +23,7 @@ public: bool operator()(s4u::Host* const a, s4u::Host* const b) const; }; -typedef boost::heap::fibonacci_heap>::handle_type heap_handle; +using heap_handle = boost::heap::fibonacci_heap>::handle_type; /** Structure that imitates a std::pair, but it allows us to use meaningful names instead of .first and .second */ struct XBT_PRIVATE pair_handle_load diff --git a/src/smpi/plugins/load_balancer/load_balancer.hpp b/src/smpi/plugins/load_balancer/load_balancer.hpp index 50e03b4319..9d457b4909 100644 --- a/src/smpi/plugins/load_balancer/load_balancer.hpp +++ b/src/smpi/plugins/load_balancer/load_balancer.hpp @@ -15,7 +15,7 @@ namespace loadbalancer { class XBT_PRIVATE Mapping { public: /** Each host can have an arbitrary number of actors -> multimap **/ - typedef std::unordered_multimap host_to_actors_map_t; + using host_to_actors_map_t = std::unordered_multimap; host_to_actors_map_t host_to_actors; /** Each actor gets assigned to exactly one host -> map **/ diff --git a/src/surf/HostImpl.hpp b/src/surf/HostImpl.hpp index 1106b4c999..08ae367bfb 100644 --- a/src/surf/HostImpl.hpp +++ b/src/surf/HostImpl.hpp @@ -73,11 +73,10 @@ public: void remove_actor(kernel::actor::ActorImpl* actor) { xbt::intrusive_erase(actor_list_, *actor); } void add_actor_at_boot(kernel::actor::ProcessArg* arg) { actors_at_boot_.emplace_back(arg); } - typedef boost::intrusive::list< + using ActorList = boost::intrusive::list< kernel::actor::ActorImpl, boost::intrusive::member_hook, - &kernel::actor::ActorImpl::host_actor_list_hook>> - ActorList; + &kernel::actor::ActorImpl::host_actor_list_hook>>; // FIXME: make these private ActorList actor_list_; diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index 860b5a9967..34c1b9b671 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -91,8 +91,9 @@ public: boost::intrusive::list_member_hook<> action_ti_hook; }; -typedef boost::intrusive::member_hook, &CpuTiAction::action_ti_hook> ActionTiListOptions; -typedef boost::intrusive::list ActionTiList; +using ActionTiListOptions = + boost::intrusive::member_hook, &CpuTiAction::action_ti_hook>; +using ActionTiList = boost::intrusive::list; /************ * Resource * @@ -130,8 +131,9 @@ public: boost::intrusive::list_member_hook<> cpu_ti_hook; }; -typedef boost::intrusive::member_hook, &CpuTi::cpu_ti_hook> CpuTiListOptions; -typedef boost::intrusive::list CpuTiList; +using CpuTiListOptions = + boost::intrusive::member_hook, &CpuTi::cpu_ti_hook>; +using CpuTiList = boost::intrusive::list; /********* * Model * diff --git a/src/xbt/xbt_log_appender_file.cpp b/src/xbt/xbt_log_appender_file.cpp index 577e934c80..adcd1c17ad 100644 --- a/src/xbt/xbt_log_appender_file.cpp +++ b/src/xbt/xbt_log_appender_file.cpp @@ -51,7 +51,7 @@ struct xbt_log_append2_file_s { int count; //negative for roll long int limit; }; -typedef struct xbt_log_append2_file_s* xbt_log_append2_file_t; +using xbt_log_append2_file_t = xbt_log_append2_file_s*; static constexpr const char* APPEND2_END_TOKEN = "\n[End of log]\n"; static constexpr const char* APPEND2_END_TOKEN_CLEAR = "\n "; -- 2.20.1