All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] Support for SmPL ellipsis in logical expressions?
@ 2014-12-29 13:08 SF Markus Elfring
       [not found] ` <alpine.DEB.2.10.1412291422340.2558@hadrien>
  0 siblings, 1 reply; 2+ messages in thread
From: SF Markus Elfring @ 2014-12-29 13:08 UTC (permalink / raw)
  To: cocci

Dear Julia,

I have tried the following semantic filter approach out.

@safety_check_with_pointer@
identifier input, member, process, work;
statement is, es;
type input_type, return_type;
@@
 return_type work(input_type * input)
 {
  ... when any
(
* if (!input)
     return ... ;
|
* if (unlikely(ZERO_OR_NULL_PTR(input)))
     return ... ;
|
* if (!input || ... process(& input->member) ... )
     return ... ;
|
* if (input && ... process(& input->member) ... )
     is
  else
     es
)
  ... when any
 }

elfring at Sonne:~/Projekte/Coccinelle/janitor> spatch.opt -sp-file show_input_parameter_validation7.cocci ~/Projekte/Linux/next-patched/fs/kernfs/dir.c
init_defs_builtins: /usr/local/share/coccinelle/standard.h
293 300
Fatal error: exception Failure("minus: parse error: \n = File \"show_input_parameter_validation7.cocci\", line 16, column 20,  charpos = 293\n    around = 'process', whole content = * if (!input || ... process(& input->member) ... )\n")


Does the Coccinelle software not like my placement of the SmPL ellipsis within a condition specification?

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Cocci] Support for SmPL ellipsis in logical expressions?
       [not found] ` <alpine.DEB.2.10.1412291422340.2558@hadrien>
@ 2014-12-29 13:41   ` SF Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: SF Markus Elfring @ 2014-12-29 13:41 UTC (permalink / raw)
  To: cocci

> It has nothing particularly to do with a conditional.

Thanks for your quick feedback.


> || has two arguments, both expressions.

That is clear.


> If you want to describe a subterm of an expression, you have to put
> <+...  ...+> around it.

I have tried to express the possibility that additional operators
like "logical not" are optional in my semantic filter approach.

I try to find also function implementations which have got similar 
properties like the function "kernfs_put".
https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/fs/kernfs/dir.c?id=9b053f3207e8887fed88162a339fdd4001abcdb2#n383

Regards,
Markus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-29 13:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-29 13:08 [Cocci] Support for SmPL ellipsis in logical expressions? SF Markus Elfring
     [not found] ` <alpine.DEB.2.10.1412291422340.2558@hadrien>
2014-12-29 13:41   ` SF Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.