modeltypes: move small typedefs to own header
authorBrian Norris <banorris@uci.edu>
Wed, 3 Oct 2012 20:17:47 +0000 (13:17 -0700)
committerBrian Norris <banorris@uci.edu>
Wed, 3 Oct 2012 20:53:02 +0000 (13:53 -0700)
To prevent some unnecessary inter-header dependencies, we can move some
simple typedefs to a modeltypes.h header.

17 files changed:
action.cc
action.h
clockvector.cc
clockvector.h
cmodelint.cc
datarace.cc
datarace.h
impatomic.cc
librace.cc
model.cc
model.h
modeltypes.h [new file with mode: 0644]
mutex.cc
mutex.h
nodestack.cc
nodestack.h
threads.h

index f80de7b..c5912ff 100644 (file)
--- 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
 
index f6fb062..8dc8843 100644 (file)
--- a/action.h
+++ b/action.h
@@ -7,11 +7,13 @@
 
 #include <list>
 #include <cstddef>
+#include <inttypes.h>
 
-#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;
index c5bf077..2b6a4cc 100644 (file)
@@ -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
index 739a336..6a902c5 100644 (file)
@@ -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;
 
index 228c40f..6b20c2c 100644 (file)
@@ -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) {
index 2937430..d6e0875 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdio.h>
 #include <cstring>
 #include "mymemory.h"
+#include "clockvector.h"
 
 struct ShadowTable *root;
 std::vector<struct DataRace *> unrealizedraces;
index 5bfcb8a..627b8cc 100644 (file)
@@ -5,8 +5,12 @@
 #ifndef DATARACE_H
 #include "config.h"
 #include <stdint.h>
-#include "clockvector.h"
 #include <vector>
+#include "modeltypes.h"
+
+/* Forward declaration */
+class ClockVector;
+class ModelAction;
 
 struct ShadowTable {
        void * array[65536];
index df11202..0a35b4b 100644 (file)
@@ -1,6 +1,7 @@
 #include "impatomic.h"
 #include "common.h"
 #include "model.h"
+#include "threads.h"
 
 namespace std {
 
index 38434de..bdd6093 100644 (file)
@@ -5,6 +5,7 @@
 #include "common.h"
 #include "datarace.h"
 #include "model.h"
+#include "threads.h"
 
 void store_8(void *addr, uint8_t val)
 {
index b5843ed..73d212d 100644 (file)
--- 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 23c42eb..62c7627 100644 (file)
--- a/model.h
+++ b/model.h
 #include <ucontext.h>
 
 #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<const ModelAction *> > rel_heads_list_t;
diff --git a/modeltypes.h b/modeltypes.h
new file mode 100644 (file)
index 0000000..22221cb
--- /dev/null
@@ -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__ */
index 51315d9..6ef297a 100644 (file)
--- 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 828aae5..53fccb2 100644 (file)
--- 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 {
index c6ca076..a737653 100644 (file)
@@ -4,6 +4,7 @@
 #include "action.h"
 #include "common.h"
 #include "model.h"
+#include "threads.h"
 
 /**
  * @brief Node constructor
index 421890f..fca063e 100644 (file)
@@ -8,11 +8,13 @@
 #include <list>
 #include <vector>
 #include <cstddef>
-#include "threads.h"
+#include <inttypes.h>
+
 #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,
index 9456a22..b69f426 100644 (file)
--- a/threads.h
+++ b/threads.h
 
 #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 {