diff options
| author | Josh Triplett <josh@freedesktop.org> | 2006-10-24 12:50:55 -0700 |
|---|---|---|
| committer | Josh Triplett <josh@freedesktop.org> | 2006-10-24 12:50:55 -0700 |
| commit | 89e5b02c6b360d7bd5f10c8edb979c5a7e57947c (patch) | |
| tree | 5450f468f43a6b67a1c6b735abbe1c6028a73efb | |
| parent | 758c8a83cebba4e7e762792719d26246a8cf8ac2 (diff) | |
| parent | d730502c200ec1e8de13699c51c83313552a4fc3 (diff) | |
| download | sparse-dev-89e5b02c6b360d7bd5f10c8edb979c5a7e57947c.tar.gz | |
Merge branch 'context-test-cases-for-cond-lock' into josh
| -rw-r--r-- | validation/context.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/validation/context.c b/validation/context.c index 165d4f63..c3527dae 100644 --- a/validation/context.c +++ b/validation/context.c @@ -1,3 +1,5 @@ +#define __cond_lock(c) ((c) ? ({ __context__(1); 1; }) : 0) + void a(void) __attribute__((context(0,1))) { __context__(1); @@ -8,6 +10,9 @@ void r(void) __attribute__((context(1,0))) __context__(-1); } +extern void _ca(int fail); +#define ca(fail) __cond_lock(_ca(fail)) + void good_paired1(void) { a(); @@ -294,3 +299,18 @@ void warn_goto3(void) label: r(); } + +void good_cond_lock1(void) +{ + if(ca(condition)) { + condition2 = 1; /* do stuff */ + r(); + } +} + +void warn_cond_lock1(void) +{ + if(ca(condition)) + condition2 = 1; /* do stuff */ + r(); +} |
