From: Brian Norris Date: Wed, 3 Oct 2012 20:17:47 +0000 (-0700) Subject: modeltypes: move small typedefs to own header X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=12b1a10eeff58161619bafcfd8e288b3e2c76621 modeltypes: move small typedefs to own header To prevent some unnecessary inter-header dependencies, we can move some simple typedefs to a modeltypes.h header. --- diff --git a/action.cc b/action.cc index f80de7b3..c5912ff2 100644 --- a/action.cc +++ b/action.cc @@ -7,6 +7,7 @@ #include "action.h" #include "clockvector.h" #include "common.h" +#include "threads.h" #define ACTION_INITIAL_CLOCK 0 diff --git a/action.h b/action.h index f6fb0623..8dc88430 100644 --- a/action.h +++ b/action.h @@ -7,11 +7,13 @@ #include #include +#include -#include "threads.h" #include "mymemory.h" -#include "clockvector.h" #include "memoryorder.h" +#include "modeltypes.h" + +class ClockVector; using std::memory_order; using std::memory_order_relaxed; diff --git a/clockvector.cc b/clockvector.cc index c5bf0770..2b6a4cc6 100644 --- a/clockvector.cc +++ b/clockvector.cc @@ -6,6 +6,7 @@ #include "action.h" #include "clockvector.h" #include "common.h" +#include "threads.h" /** * Constructs a new ClockVector, given a parent ClockVector and a first diff --git a/clockvector.h b/clockvector.h index 739a336e..6a902c52 100644 --- a/clockvector.h +++ b/clockvector.h @@ -5,10 +5,9 @@ #ifndef __CLOCKVECTOR_H__ #define __CLOCKVECTOR_H__ -#include "threads.h" #include "mymemory.h" +#include "modeltypes.h" -typedef unsigned int modelclock_t; /* Forward declaration */ class ModelAction; diff --git a/cmodelint.cc b/cmodelint.cc index 228c40f9..6b20c2cc 100644 --- a/cmodelint.cc +++ b/cmodelint.cc @@ -1,5 +1,6 @@ #include "model.h" #include "cmodelint.h" +#include "threads.h" /** Performs a read action.*/ uint64_t model_read_action(void * obj, memory_order ord) { diff --git a/datarace.cc b/datarace.cc index 29374305..d6e0875c 100644 --- a/datarace.cc +++ b/datarace.cc @@ -4,6 +4,7 @@ #include #include #include "mymemory.h" +#include "clockvector.h" struct ShadowTable *root; std::vector unrealizedraces; diff --git a/datarace.h b/datarace.h index 5bfcb8ad..627b8cc8 100644 --- a/datarace.h +++ b/datarace.h @@ -5,8 +5,12 @@ #ifndef DATARACE_H #include "config.h" #include -#include "clockvector.h" #include +#include "modeltypes.h" + +/* Forward declaration */ +class ClockVector; +class ModelAction; struct ShadowTable { void * array[65536]; diff --git a/impatomic.cc b/impatomic.cc index df11202d..0a35b4b6 100644 --- a/impatomic.cc +++ b/impatomic.cc @@ -1,6 +1,7 @@ #include "impatomic.h" #include "common.h" #include "model.h" +#include "threads.h" namespace std { diff --git a/librace.cc b/librace.cc index 38434de7..bdd6093a 100644 --- a/librace.cc +++ b/librace.cc @@ -5,6 +5,7 @@ #include "common.h" #include "datarace.h" #include "model.h" +#include "threads.h" void store_8(void *addr, uint8_t val) { diff --git a/model.cc b/model.cc index b5843ed6..73d212d0 100644 --- a/model.cc +++ b/model.cc @@ -12,6 +12,7 @@ #include "promise.h" #include "datarace.h" #include "mutex.h" +#include "threads.h" #define INITIAL_THREAD_ID 0 diff --git a/model.h b/model.h index 23c42ebb..62c76271 100644 --- a/model.h +++ b/model.h @@ -11,19 +11,18 @@ #include #include "mymemory.h" -#include "libthreads.h" -#include "threads.h" #include "action.h" -#include "clockvector.h" #include "hashtable.h" #include "workqueue.h" #include "config.h" +#include "modeltypes.h" /* Forward declaration */ class NodeStack; class CycleGraph; class Promise; class Scheduler; +class Thread; /** @brief Shorthand for a list of release sequence heads */ typedef std::vector< const ModelAction *, ModelAlloc > rel_heads_list_t; diff --git a/modeltypes.h b/modeltypes.h new file mode 100644 index 00000000..22221cb5 --- /dev/null +++ b/modeltypes.h @@ -0,0 +1,10 @@ +#ifndef __MODELTYPES_H__ +#define __MODELTYPES_H__ + +typedef int thread_id_t; + +#define THREAD_ID_T_NONE -1 + +typedef unsigned int modelclock_t; + +#endif /* __MODELTYPES_H__ */ diff --git a/mutex.cc b/mutex.cc index 51315d94..6ef297a5 100644 --- a/mutex.cc +++ b/mutex.cc @@ -1,5 +1,7 @@ #include "mutex.h" #include "model.h" +#include "threads.h" +#include "clockvector.h" namespace std { mutex::mutex() { diff --git a/mutex.h b/mutex.h index 828aae53..53fccb2b 100644 --- a/mutex.h +++ b/mutex.h @@ -1,7 +1,7 @@ #ifndef MUTEX_H #define MUTEX_H -#include "threads.h" -#include "clockvector.h" + +#include "modeltypes.h" namespace std { struct mutex_state { diff --git a/nodestack.cc b/nodestack.cc index c6ca076d..a7376532 100644 --- a/nodestack.cc +++ b/nodestack.cc @@ -4,6 +4,7 @@ #include "action.h" #include "common.h" #include "model.h" +#include "threads.h" /** * @brief Node constructor diff --git a/nodestack.h b/nodestack.h index 421890f4..fca063e7 100644 --- a/nodestack.h +++ b/nodestack.h @@ -8,11 +8,13 @@ #include #include #include -#include "threads.h" +#include + #include "mymemory.h" -#include "clockvector.h" +#include "modeltypes.h" class ModelAction; +class Thread; /** * A flag used for the promise counting/combination problem within a node, diff --git a/threads.h b/threads.h index 9456a22f..b69f4265 100644 --- a/threads.h +++ b/threads.h @@ -11,10 +11,7 @@ #include "mymemory.h" #include "libthreads.h" - -typedef int thread_id_t; - -#define THREAD_ID_T_NONE -1 +#include "modeltypes.h" /** @brief Represents the state of a user Thread */ typedef enum thread_state {