From: Brian Norris Date: Thu, 12 Jul 2012 20:56:15 +0000 (-0700) Subject: reformat some doxygen comments, remove newlines X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=dd0190cef49ef760f8d86a6e92dd6eeb07197854 reformat some doxygen comments, remove newlines Avoiding newlines between a comment and its function header makes it more obvious which function the comment belongs to. --- diff --git a/clockvector.cc b/clockvector.cc index 190f9216..6c6e2fa5 100644 --- a/clockvector.cc +++ b/clockvector.cc @@ -84,10 +84,7 @@ bool ClockVector::synchronized_since(const ModelAction *act) const return false; } -/** - * Gets the clock corresponding to a given thread id from the clock - * vector. */ - +/** Gets the clock corresponding to a given thread id from the clock vector. */ modelclock_t ClockVector::getClock(thread_id_t thread) { int threadid = id_to_int(thread); diff --git a/cyclegraph.cc b/cyclegraph.cc index 324e01cc..dad8b7ac 100644 --- a/cyclegraph.cc +++ b/cyclegraph.cc @@ -2,13 +2,11 @@ #include "action.h" /** Initializes a CycleGraph object. */ - CycleGraph::CycleGraph() { hasCycles=false; } /** Returns the CycleNode for a given ModelAction. */ - CycleNode * CycleGraph::getNode(ModelAction * action) { CycleNode *node=actionToNode.get(action); if (node==NULL) { @@ -19,7 +17,6 @@ CycleNode * CycleGraph::getNode(ModelAction * action) { } /** Adds an edge between two ModelActions. */ - void CycleGraph::addEdge(ModelAction *from, ModelAction *to) { CycleNode *fromnode=getNode(from); CycleNode *tonode=getNode(to); @@ -31,7 +28,6 @@ void CycleGraph::addEdge(ModelAction *from, ModelAction *to) { } /** Checks whether the first CycleNode can reach the second one. */ - bool CycleGraph::checkReachable(CycleNode *from, CycleNode *to) { std::vector queue; HashTable discovered; @@ -61,19 +57,16 @@ bool CycleGraph::checkForCycles() { } /** Constructor for a CycleNode. */ - CycleNode::CycleNode(ModelAction *modelaction) { action=modelaction; } /** Returns a vector of the edges from a CycleNode. */ - std::vector * CycleNode::getEdges() { return &edges; } /** Adds an edge to a CycleNode. */ - void CycleNode::addEdge(CycleNode * node) { edges.push_back(node); } diff --git a/datarace.cc b/datarace.cc index 5a23d82d..294b6b91 100644 --- a/datarace.cc +++ b/datarace.cc @@ -6,14 +6,12 @@ struct ShadowTable *root; /** This function initialized the data race detector. */ - void initRaceDetector() { root=(struct ShadowTable *) calloc(sizeof(struct ShadowTable),1); } -/** This function looks up the entry in the shadow table corresponding - to a given address.*/ - +/** This function looks up the entry in the shadow table corresponding to a + * given address.*/ static uint64_t * lookupAddressEntry(void * address) { struct ShadowTable *currtable=root; #ifdef BIT48 @@ -49,7 +47,6 @@ static bool clock_may_race(ClockVector *clock1, thread_id_t tid1, * Expands a record from the compact form to the full form. This is * necessary for multiple readers or for very large thread ids or time * stamps. */ - static void expandRecord(uint64_t * shadow) { uint64_t shadowval=*shadow; @@ -74,14 +71,11 @@ static void expandRecord(uint64_t * shadow) { } /** This function is called when we detect a data race.*/ - static void reportDataRace() { printf("The reportDataRace method should report useful things about this datarace!\n"); } -/** This function does race detection for a write on an expanded - * record. */ - +/** This function does race detection for a write on an expanded record. */ void fullRaceCheckWrite(thread_id_t thread, uint64_t * shadow, ClockVector *currClock) { struct RaceRecord * record=(struct RaceRecord *) (*shadow); @@ -116,9 +110,7 @@ void fullRaceCheckWrite(thread_id_t thread, uint64_t * shadow, ClockVector *curr record->writeClock=ourClock; } -/** This function does race detection on a write. - */ - +/** This function does race detection on a write. */ void raceCheckWrite(thread_id_t thread, void *location, ClockVector *currClock) { uint64_t * shadow=lookupAddressEntry(location); uint64_t shadowval=*shadow; @@ -161,9 +153,7 @@ void raceCheckWrite(thread_id_t thread, void *location, ClockVector *currClock) *shadow = ENCODEOP(0, 0, threadid, ourClock); } -/** This function does race detection on a read for an expanded - * record. */ - +/** This function does race detection on a read for an expanded record. */ void fullRaceCheckRead(thread_id_t thread, uint64_t * shadow, ClockVector *currClock) { struct RaceRecord * record=(struct RaceRecord *) (*shadow); @@ -222,7 +212,6 @@ void fullRaceCheckRead(thread_id_t thread, uint64_t * shadow, ClockVector *currC } /** This function does race detection on a read. */ - void raceCheckRead(thread_id_t thread, void *location, ClockVector *currClock) { uint64_t * shadow=lookupAddressEntry(location); uint64_t shadowval=*shadow; diff --git a/main.cc b/main.cc index c9ac1d06..339b85ef 100644 --- a/main.cc +++ b/main.cc @@ -12,11 +12,10 @@ #include "model.h" #include "snapshot-interface.h" -/** The thread_system_next function takes the next step in the - * execution. @return Returns the 1 if there is another step and 0 - * otherwise. +/** + * The thread_system_next function takes the next step in the execution. + * @return Returns the 1 if there is another step and 0 otherwise. */ - static int thread_system_next(void) { Thread *curr, *next; @@ -43,7 +42,6 @@ static int thread_system_next(void) { /** The thread_wait_finish method runs the current execution until we * have no more steps to take. */ - static void thread_wait_finish(void) { DBG(); @@ -52,7 +50,6 @@ static void thread_wait_finish(void) { /** The real_main function contains the main model checking loop. */ - static void real_main() { thrd_t user_thread; ucontext_t main_context; diff --git a/mymemory.cc b/mymemory.cc index f3464fc6..fcc98db5 100644 --- a/mymemory.cc +++ b/mymemory.cc @@ -14,7 +14,6 @@ static mspace sStaticSpace = NULL; #endif /** Non-snapshotting malloc for our use. */ - void *MYMALLOC(size_t size) { #if USE_MPROTECT_SNAPSHOT static void *(*mallocp)(size_t size); @@ -102,7 +101,6 @@ void * basemySpace = NULL; /** Adding the fix for not able to allocate through a reimplemented calloc at the beginning before instantiating our allocator A bit circumspect about adding an sbrk. linux docs say to avoid using it... */ - void * HandleEarlyAllocationRequest( size_t sz ){ if( 0 == mySpace ){ void * returnAddress = sbrk( sz ); @@ -116,7 +114,6 @@ void * HandleEarlyAllocationRequest( size_t sz ){ } /** The fact that I am not expecting more than a handful requests is implicit in my not using a binary search here*/ - bool DontFree( void * ptr ){ if( howManyFreed == nextRequest ) return false; //a minor optimization to reduce the number of instructions executed on each free call.... if( NULL == ptr ) return true; @@ -130,7 +127,6 @@ bool DontFree( void * ptr ){ } /** Snapshotting malloc implementation for user programs. */ - void *malloc( size_t size ) { void * earlyReq = HandleEarlyAllocationRequest( size ); if( earlyReq ) return earlyReq; @@ -138,20 +134,17 @@ void *malloc( size_t size ) { } /** Snapshotting free implementation for user programs. */ - void free( void * ptr ){ if( DontFree( ptr ) ) return; mspace_free( mySpace, ptr ); } /** Snapshotting realloc implementation for user programs. */ - void *realloc( void *ptr, size_t size ){ return mspace_realloc( mySpace, ptr, size ); } /** Snapshotting calloc implementation for user programs. */ - void * calloc( size_t num, size_t size ){ void * earlyReq = HandleEarlyAllocationRequest( size * num ); if( earlyReq ) { @@ -162,25 +155,21 @@ void * calloc( size_t num, size_t size ){ } /** Snapshotting new operator for user programs. */ - void * operator new(size_t size) throw(std::bad_alloc) { return malloc(size); } /** Snapshotting delete operator for user programs. */ - void operator delete(void *p) throw() { free(p); } /** Snapshotting new[] operator for user programs. */ - void * operator new[](size_t size) throw(std::bad_alloc) { return malloc(size); } /** Snapshotting delete[] operator for user programs. */ - void operator delete[](void *p, size_t size) { free(p); } diff --git a/mymemory.h b/mymemory.h index 56e69043..fb6df12c 100644 --- a/mymemory.h +++ b/mymemory.h @@ -9,7 +9,6 @@ /** MEMALLOC declares the allocators for a class to allocate * memory in the non-snapshotting heap. */ - #define MEMALLOC \ void * operator new(size_t size) { \ return MYMALLOC(size);\ @@ -26,7 +25,6 @@ /** SNAPSHOTALLOC declares the allocators for a class to allocate * memory in the snapshotting heap. */ - #define SNAPSHOTALLOC void *MYMALLOC(size_t size); @@ -45,7 +43,6 @@ void *system_malloc( size_t size ); * This software is provided "as is" without express or implied * warranty, and with no claim as to its suitability for any purpose. */ - template class MyAlloc { public: diff --git a/snapshot-interface.cc b/snapshot-interface.cc index fbbc6777..84749f1f 100644 --- a/snapshot-interface.cc +++ b/snapshot-interface.cc @@ -117,7 +117,6 @@ SnapshotStack::~SnapshotStack(){ * @param seqindex is the sequence number to rollback before. * @return is the sequence number we actually rolled back to. */ - int SnapshotStack::backTrackBeforeStep(int seqindex) { while(true) { if (stack->index<=seqindex) { @@ -131,9 +130,7 @@ int SnapshotStack::backTrackBeforeStep(int seqindex) { } } -/** This method takes a snapshot at the given sequence number. - */ - +/** This method takes a snapshot at the given sequence number. */ void SnapshotStack::snapshotStep(int seqindex) { struct stackEntry *tmp=(struct stackEntry *)MYMALLOC(sizeof(struct stackEntry)); tmp->next=stack;