From 64cfda658ffbc436445589f1a7a9afce2e41fb5a Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 22 Jun 2018 20:12:15 +0200 Subject: [PATCH 1/1] untangle a bit mc header files --- include/xbt/automaton.h | 7 +------ src/include/xbt/mmalloc.h | 4 ++-- src/mc/AddressSpace.hpp | 12 +----------- src/mc/ModelChecker.cpp | 2 +- src/mc/ModelChecker.hpp | 6 +----- src/mc/Transition.hpp | 3 ++- src/mc/mc_base.cpp | 2 ++ src/mc/mc_forward.hpp | 4 ++-- src/mc/mc_snapshot.hpp | 7 +------ src/mc/remote/Channel.hpp | 7 ++----- src/mc/remote/Client.hpp | 13 ++----------- src/mc/remote/RemoteClient.hpp | 1 - src/mc/remote/RemotePtr.hpp | 6 +----- src/mc/remote/mc_protocol.h | 2 -- src/xbt/automaton/automaton.c | 1 + src/xbt/automaton/automatonparse_promela.c | 1 + 16 files changed, 20 insertions(+), 58 deletions(-) diff --git a/include/xbt/automaton.h b/include/xbt/automaton.h index f76712c0f6..0b935ed2fb 100644 --- a/include/xbt/automaton.h +++ b/include/xbt/automaton.h @@ -1,5 +1,4 @@ -/* Copyright (c) 2011-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2011-2018. 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,10 +7,6 @@ #define XBT_AUTOMATON_H #include -#include -#include -#include -#include SG_BEGIN_DECL() diff --git a/src/include/xbt/mmalloc.h b/src/include/xbt/mmalloc.h index 54cbd1945a..fd209109a6 100644 --- a/src/include/xbt/mmalloc.h +++ b/src/include/xbt/mmalloc.h @@ -10,7 +10,6 @@ #define SIMGRID_MMALLOC_H 1 #include "src/internal_config.h" -#if HAVE_MMALLOC #include /* for NULL */ #include /* for size_t */ @@ -29,6 +28,7 @@ SG_BEGIN_DECL() typedef struct mdesc s_xbt_mheap_t; typedef s_xbt_mheap_t* xbt_mheap_t; +#if HAVE_MMALLOC /* Allocate SIZE bytes of memory (and memset it to 0). */ XBT_PUBLIC void* mmalloc(xbt_mheap_t md, size_t size); @@ -63,7 +63,7 @@ ssize_t mmalloc_get_busy_size(xbt_mheap_t, void* ptr); void* malloc_no_memset(size_t n); +#endif SG_END_DECL() -#endif #endif /* SIMGRID_MMALLOC_H */ diff --git a/src/mc/AddressSpace.hpp b/src/mc/AddressSpace.hpp index e06c61ef51..76396c1517 100644 --- a/src/mc/AddressSpace.hpp +++ b/src/mc/AddressSpace.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2008-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2008-2018. 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. */ @@ -7,15 +6,6 @@ #ifndef SIMGRID_MC_ADDRESS_SPACE_H #define SIMGRID_MC_ADDRESS_SPACE_H -#include -#include -#include -#include -#include - -#include -#include - #include "src/mc/mc_forward.hpp" #include "src/mc/remote/RemotePtr.hpp" diff --git a/src/mc/ModelChecker.cpp b/src/mc/ModelChecker.cpp index 3ca696bef4..10bee5de27 100644 --- a/src/mc/ModelChecker.cpp +++ b/src/mc/ModelChecker.cpp @@ -21,7 +21,6 @@ #include "simgrid/sg_config.hpp" -#include "src/mc/ModelChecker.hpp" #include "src/mc/ModelChecker.hpp" #include "src/mc/PageStore.hpp" #include "src/mc/Transition.hpp" @@ -29,6 +28,7 @@ #include "src/mc/mc_exit.hpp" #include "src/mc/mc_private.hpp" #include "src/mc/mc_record.hpp" +#include "src/mc/remote/RemoteClient.hpp" #include "src/mc/remote/mc_protocol.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_ModelChecker, mc, "ModelChecker"); diff --git a/src/mc/ModelChecker.hpp b/src/mc/ModelChecker.hpp index 65ad9ada5e..129685349b 100644 --- a/src/mc/ModelChecker.hpp +++ b/src/mc/ModelChecker.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -15,13 +14,10 @@ #include -#include "xbt/base.h" #include #include "src/mc/PageStore.hpp" -#include "src/mc/Transition.hpp" #include "src/mc/mc_forward.hpp" -#include "src/mc/remote/RemoteClient.hpp" #include "src/mc/remote/mc_protocol.h" namespace simgrid { diff --git a/src/mc/Transition.hpp b/src/mc/Transition.hpp index 1c3bf93b37..d8566a2221 100644 --- a/src/mc/Transition.hpp +++ b/src/mc/Transition.hpp @@ -18,7 +18,8 @@ namespace mc { * in things like waitany and for associating a given value of MC_random() * calls. */ -struct Transition { +class Transition { +public: int pid = 0; /* Which transition was executed for this simcall diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index 2ad939fb20..c1968fc35a 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -8,7 +8,9 @@ #include "mc/mc.h" #include "src/mc/mc_base.h" #include "src/mc/mc_config.hpp" +#include "src/mc/mc_forward.hpp" #include "src/mc/mc_replay.hpp" +#include "src/mc/remote/RemoteClient.hpp" #include "src/simix/smx_private.hpp" #include "src/kernel/activity/MutexImpl.hpp" diff --git a/src/mc/mc_forward.hpp b/src/mc/mc_forward.hpp index ed94bf9db9..6ab3a4b445 100644 --- a/src/mc/mc_forward.hpp +++ b/src/mc/mc_forward.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2007-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2018. 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. */ @@ -25,6 +24,7 @@ class ObjectInformation; class Member; class Type; class Variable; +class Transition; class Frame; class ActorInformation; diff --git a/src/mc/mc_snapshot.hpp b/src/mc/mc_snapshot.hpp index 62a18fea8c..d9c9107e93 100644 --- a/src/mc/mc_snapshot.hpp +++ b/src/mc/mc_snapshot.hpp @@ -6,15 +6,10 @@ #ifndef SIMGRID_MC_SNAPSHOT_HPP #define SIMGRID_MC_SNAPSHOT_HPP -#include -#include -#include -#include - #include "src/mc/ModelChecker.hpp" #include "src/mc/RegionSnapshot.hpp" -#include "src/mc/mc_forward.hpp" #include "src/mc/mc_unw.hpp" +#include "src/mc/remote/RemoteClient.hpp" // ***** Snapshot region diff --git a/src/mc/remote/Channel.hpp b/src/mc/remote/Channel.hpp index 62edf66078..69a58c06b3 100644 --- a/src/mc/remote/Channel.hpp +++ b/src/mc/remote/Channel.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2015-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2015-2018. 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. */ @@ -7,12 +6,10 @@ #ifndef SIMGRID_MC_CHANNEL_HPP #define SIMGRID_MC_CHANNEL_HPP -#include +#include "src/mc/remote/mc_protocol.h" #include -#include "src/mc/remote/mc_protocol.h" - namespace simgrid { namespace mc { diff --git a/src/mc/remote/Client.hpp b/src/mc/remote/Client.hpp index 1d4cd21ece..7e9c6dd8f7 100644 --- a/src/mc/remote/Client.hpp +++ b/src/mc/remote/Client.hpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2015-2018. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2015-2018. 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. */ @@ -7,18 +6,10 @@ #ifndef SIMGRID_MC_CLIENT_H #define SIMGRID_MC_CLIENT_H -#include "src/internal_config.h" +#include "src/mc/remote/Channel.hpp" -#include #include -#include - -#include - -#include "src/mc/remote/Channel.hpp" -#include "src/mc/remote/mc_protocol.h" - namespace simgrid { namespace mc { diff --git a/src/mc/remote/RemoteClient.hpp b/src/mc/remote/RemoteClient.hpp index e55df1a44e..5d66c58d27 100644 --- a/src/mc/remote/RemoteClient.hpp +++ b/src/mc/remote/RemoteClient.hpp @@ -8,7 +8,6 @@ #include "src/xbt/mmalloc/mmprivate.h" #include "src/mc/remote/Channel.hpp" -#include "src/simix/smx_private.hpp" #include "src/mc/ObjectInformation.hpp" #include diff --git a/src/mc/remote/RemotePtr.hpp b/src/mc/remote/RemotePtr.hpp index f8d09f78b4..bd58e1b986 100644 --- a/src/mc/remote/RemotePtr.hpp +++ b/src/mc/remote/RemotePtr.hpp @@ -6,11 +6,7 @@ #ifndef SIMGRID_MC_REMOTE_PTR_HPP #define SIMGRID_MC_REMOTE_PTR_HPP -#include -#include - -#include -#include +#include "src/simix/smx_private.hpp" namespace simgrid { namespace mc { diff --git a/src/mc/remote/mc_protocol.h b/src/mc/remote/mc_protocol.h index 6770bf0685..d6924f1ea9 100644 --- a/src/mc/remote/mc_protocol.h +++ b/src/mc/remote/mc_protocol.h @@ -9,8 +9,6 @@ #include "mc/datatypes.h" #include "simgrid/forward.h" -#include - SG_BEGIN_DECL() // ***** Environment variables for passing context to the model-checked process diff --git a/src/xbt/automaton/automaton.c b/src/xbt/automaton/automaton.c index 377992aa9b..a60182779e 100644 --- a/src/xbt/automaton/automaton.c +++ b/src/xbt/automaton/automaton.c @@ -8,6 +8,7 @@ #include "xbt/automaton.h" #include /* printf */ #include +#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_automaton, xbt, "Automaton"); diff --git a/src/xbt/automaton/automatonparse_promela.c b/src/xbt/automaton/automatonparse_promela.c index 6f59cb4d0f..9bc4586785 100644 --- a/src/xbt/automaton/automatonparse_promela.c +++ b/src/xbt/automaton/automatonparse_promela.c @@ -13,6 +13,7 @@ # include /* isatty */ #endif #include +#include XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_automaton); -- 2.20.1