diff options
author | rpj <rpj> | 2005-03-16 01:36:11 +0000 |
---|---|---|
committer | rpj <rpj> | 2005-03-16 01:36:11 +0000 |
commit | e74acb9f56d1a46ba56e007352c2170c835ecb48 (patch) | |
tree | abfbbf2f9a33a2f1192433aa5ba571bc02f9e08e /tests | |
parent | 9b477bedafd2450735b78cdedc7af5e090aa8934 (diff) |
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ChangeLog | 12 | ||||
-rw-r--r-- | tests/mutex5.c | 18 |
2 files changed, 19 insertions, 11 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog index 321adc3..7b03968 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,10 +1,14 @@ -2005-03-12 Ross Johnson <rpj@callisto.canberra.edu.au> +2005-03-16 Ross Johnson <rpj@callisto.canberra.edu.au>
- * once3.c: New test. + * mutex5.c: Prevent optimiser from removing asserts. -2005-03-08 Ross Johnson <rpj@callisto.canberra.edu.au> +2005-03-12 Ross Johnson <rpj@callisto.canberra.edu.au>
- * once2.c: New test. + * once3.c: New test.
+ +2005-03-08 Ross Johnson <rpj@callisto.canberra.edu.au>
+ + * once2.c: New test.
2004-11-19 Ross Johnson <rpj@callisto.canberra.edu.au>
diff --git a/tests/mutex5.c b/tests/mutex5.c index a597892..a71f9d8 100644 --- a/tests/mutex5.c +++ b/tests/mutex5.c @@ -41,19 +41,23 @@ static pthread_mutexattr_t mxAttr; +/* Prevent optimiser from removing dead or obvious asserts. */ +int _optimiseFoil; +#define FOIL(x) (_optimiseFoil = x) + int main() { int mxType = -1; - assert(PTHREAD_MUTEX_DEFAULT == PTHREAD_MUTEX_NORMAL); - assert(PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_ERRORCHECK); - assert(PTHREAD_MUTEX_DEFAULT != PTHREAD_MUTEX_RECURSIVE); - assert(PTHREAD_MUTEX_RECURSIVE != PTHREAD_MUTEX_ERRORCHECK); + assert(FOIL(PTHREAD_MUTEX_DEFAULT) == PTHREAD_MUTEX_NORMAL); + assert(FOIL(PTHREAD_MUTEX_DEFAULT) != PTHREAD_MUTEX_ERRORCHECK); + assert(FOIL(PTHREAD_MUTEX_DEFAULT) != PTHREAD_MUTEX_RECURSIVE); + assert(FOIL(PTHREAD_MUTEX_RECURSIVE) != PTHREAD_MUTEX_ERRORCHECK); - assert(PTHREAD_MUTEX_NORMAL == PTHREAD_MUTEX_FAST_NP); - assert(PTHREAD_MUTEX_RECURSIVE == PTHREAD_MUTEX_RECURSIVE_NP); - assert(PTHREAD_MUTEX_ERRORCHECK == PTHREAD_MUTEX_ERRORCHECK_NP); + assert(FOIL(PTHREAD_MUTEX_NORMAL) == PTHREAD_MUTEX_FAST_NP); + assert(FOIL(PTHREAD_MUTEX_RECURSIVE) == PTHREAD_MUTEX_RECURSIVE_NP); + assert(FOIL(PTHREAD_MUTEX_ERRORCHECK) == PTHREAD_MUTEX_ERRORCHECK_NP); assert(pthread_mutexattr_init(&mxAttr) == 0); assert(pthread_mutexattr_gettype(&mxAttr, &mxType) == 0); |