David Evans <[EMAIL PROTECTED]> writes: > The workaround I use is to define a dummy function that just marks a > parameter as defined: > > extern void assertSet (/*@special@*/ /*@sef@*/ /*@unused@*/ void *p_x) > /*@sets p_x, *p_x@*/ ; > # define assertSet(x) ; > > and then call assertSet(result) after the loop in case 3.
Thanks, that works nicely. I needed to hide the #define from splint like this: #ifdef S_SPLINT_S extern void assertSet(/*@special@*/ /*@sef@*/ /*@unused@*/ void *p_x) /*@sets p_x, *p_x@*/ ; #else # define assertSet(x) ; #endif Which makes a kind of sense. Any ideas on the second problem, or do I just need to disable the check for this function? [...] >> I think I have a similar situation (similar because I think I want to >> make a declaration about a variable in one branch) where a function is >> mostly returning structure elements, but on one branch it returns the >> static string "". It does this kind of thing: >> >> case MDT_ATTR: >> ns_uri = node_data->d.attr->ename->ns_uri; >> break; >> } >> >> if (ns_uri == NULL) >> ns_uri = ""; >> return (ns_uri); >> >> This produces the warning: >> >> mdoctree.c:669:2: Clauses exit with ns_uri referencing unqualified static >> storage in true branch, local storage in continuation >> The state of a variable is different depending on which branch is taken. This >> means no annotation can sensibly be applied to the storage. (Use -branchstate >> to inhibit warning) >> mdoctree.c:669:2: Storage ns_uri becomes unqualified static >> >> So how do I fix this? It feels like /*@observer@*/ is almost the >> right thing: if the function were only returning mysterious pointers >> which the callers shouldn't fiddle with, then declaring the result as >> /*@observer@*/ ought to work. But in thise case, the warning seems >> before that, so something else is required. -- Bruce Stephens [EMAIL PROTECTED] ACI Worldwide/MessagingDirect <URL:http://www.MessagingDirect.com/>