diff options
author | 2008-12-23 10:59:22 +0100 | |
---|---|---|
committer | 2008-12-24 02:34:41 -0800 | |
commit | 2479d0f7819bdc4328f28c317248f1a6f78e3e9f (patch) | |
tree | 7ae003d227abc6db5215c9762e25a11fae6ecf9f /sparse.1 | |
parent | Let void have sizeof 1 (diff) | |
download | sparse-2479d0f7819bdc4328f28c317248f1a6f78e3e9f.tar.gz sparse-2479d0f7819bdc4328f28c317248f1a6f78e3e9f.tar.bz2 sparse-2479d0f7819bdc4328f28c317248f1a6f78e3e9f.zip |
Revert the context tracking code
> Do you want to resend your change which revert the context changes?
> Make it base on Josh's git's tree and I will merge your changes in my
> branch.
Below. Or I can give it to you in git if you prefer. I still think we
should redo this in some form so that annotations with different
contexts can work properly, but I don't have time to take care of it
right now.
johannes
>From ca95b62edf1600a2b55ed9ca0515d049807a84fc Mon Sep 17 00:00:00 2001
From: Johannes Berg <johannes@sipsolutions.net>
Date: Tue, 23 Dec 2008 10:53:19 +0100
Subject: [PATCH] Revert context tracking code
Diffstat (limited to 'sparse.1')
-rw-r--r-- | sparse.1 | 43 |
1 files changed, 10 insertions, 33 deletions
@@ -73,43 +73,20 @@ Warn about potential errors in synchronization or other delimited contexts. Sparse supports several means of designating functions or statements that delimit contexts, such as synchronization. Functions with the extended attribute -.BI __attribute__((context( [expression ,] in_context , out_context )) -require the context \fIexpression\fR (for instance, a lock) to have at least the value +.BI __attribute__((context( expression , in_context , out_context )) +require the context \fIexpression\fR (for instance, a lock) to have the value \fIin_context\fR (a constant nonnegative integer) when called, and return with -the value adjusted by \fIout_context - in_context\fR (where -\fIout_context\fR is a constant nonnegative integer). To change the value -of a context (for example in macros), use the statement -.BI __context__( [expression , ]adjust_value[ , required] ) -where \fIadjust_value\fR is a constant integer and \fIrequired\fR is a -constant nonnegative integer. Not giving \fIrequired\fR is equivalent to -giving zero and means that the statement does not need the context as a -precondition, when given it means that the context must at least have the -value of \fIrequired\fR. - -To indicate that a function requires -.BI exactly -a certain lock context (not "at least" as above), use the form -.BI __attribute__((exact_context( [expression ,] in_context , out_context )) -There currently is no corresponding -.BI __exact_context__( [expression , ]adjust_value[ , required] ) -statement. - -To indicate that a certain function acquires a context depending on its -return value, use -.BI __attribute__((conditional_context( [expression ,] in_context , out_success , out_failure )) -where \fIout_success\fR and \fIout_failure\fR indicate the context change -done depending on success (non-zero) or failure (zero) return of the -function. Note that currently, using this attribute on a function means that -the function itself won't be checked for context handling at all. See the -testsuite for examples. - -Sparse will warn when it sees a function change a -context without indicating this with a \fBcontext\fR or \fBexact_context\fR attribute, either by +the value \fIout_context\fR (a constant nonnegative integer). For APIs +defined via macros, use the statement form +.BI __context__( expression , in_value , out_value ) +in the body of the macro. + +With \fB-Wcontext\fR Sparse will warn when it sees a function change the +context without indicating this with a \fBcontext\fR attribute, either by decreasing a context below zero (such as by releasing a lock without acquiring it), or returning with a changed context (such as by acquiring a lock without releasing it). Sparse will also warn about blocks of code which may -potentially execute with different contexts and about functions that are -executed without a lock they require. +potentially execute with different contexts. Sparse issues these warnings by default. To turn them off, use \fB\-Wno\-context\fR. |