> A parameter list is something that comes after the name of a function in
> the function header.  Something like int x, int y, in foo (int x, int y) {
> ... }.  Probably you want an expression list.

* How do you call the list usually that is used for the definition before
  the function body?

* Did I get inappropriate expectations from a description around a 
"parameter-list-declarator"?
  http://en.cppreference.com/w/c/language/function_definition

* The following SmPL script variant seems to work better.


@checking_function_calls_directly@
identifier checker, retval, work;
expression list el;
statement is, es;
type rt;
@@
 rt checker(...)
 {
  <+...
-retval = work(el);
 if (
-    retval
+    work(el)
    )
    is
 else
    es
  ...+>
 }


elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch.opt -sp-file 
checking_function_calls_directly2.cocci 
~/Projekte/Linux/next-patched/drivers/staging/ks7010/ks7010_sdio.c
init_defs_builtins: /usr/local/lib64/coccinelle/standard.h
HANDLING: 
/home/elfring/Projekte/Linux/next-patched/drivers/staging/ks7010/ks7010_sdio.c
diff = 
--- 
/home/elfring/Projekte/Linux/next-patched/drivers/staging/ks7010/ks7010_sdio.c
+++ /tmp/cocci-output-1578-3a5e93-ks7010_sdio.c
@@ -99,9 +99,7 @@ void ks_wlan_hw_sleep_doze_request(struc
 
        if (atomic_read(&priv->sleepstatus.status) == 0) {
                rw_data = GCR_B_DOZE;
-               retval =
-                   ks7010_sdio_write(priv, GCR_B, &rw_data, sizeof(rw_data));
-               if (retval) {
+               if (ks7010_sdio_write(priv, GCR_B, &rw_data, sizeof(rw_data))) {
                        DPRINTK(1, " error : GCR_B=%02X\n", rw_data);
                        goto out;
                }
…


Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to