All of lore.kernel.org
 help / color / mirror / Atom feed
From: elfring@users.sourceforge.net (SF Markus Elfring)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Searching with SmPL for missing clean-up settings in designated initialisers
Date: Fri, 4 Dec 2015 14:55:34 +0100	[thread overview]
Message-ID: <56619B56.7040508@users.sourceforge.net> (raw)
In-Reply-To: <20151203234832.GB20409@wotan.suse.de>

> virtual context                                                                 
>                                                                                 
> @ is_tty @                                                                      
> identifier fops;                                                                
> @@                                                                              
> struct tty_operations fops = {                                                  
> };                                                                              
>                                                                                 
> @ tty_has_cleanup depends on is_tty @                                           
> identifier is_tty.fops;                                                         
> identifier fn;                                                                  
> @@                                                                              
> struct tty_operations fops = {                                                  
>         .cleanup = fn,                                                          
> };                                                                              
>                                                                                 
> @ depends on is_tty && !tty_has_cleanup && context @                            
> identifier is_tty.fops;                                                         
> @@                                                                              
> * struct tty_operations fops = {                                                
> };

How do you think about a SmPL approach like the following?


virtual show_context_diff

@contains_member_functions@                                                                      
identifier var;
struct operations =~ "^(?x)
(?:
   \w+_operations
|
   (?:
# Alternation placeholder
   )
)$";
@@
 operations var = { ... };                                                                              
                                                                                
@contains_cleanup_function
 contains_member_functions@                                           
expression assign;                                                                  
identifier release =~ "^(?x)
(?:
   cleanup
|
   (?:
# Another alternation placeholder
   )
)$",
           contains_member_functions.var;                                                         
type contains_member_functions.operations;                                                         
@@                                                                              
 operations var = { ...,
                    .cleanup = (assign),
                    ...
                  };                                                                              
                                                                                
@show_member_functions
 depends on show_context_diff
            && contains_member_functions
            && !contains_cleanup_function@
identifier contains_member_functions.var;                                                         
struct contains_member_functions.operations;                                                         
@@                                                                              
*operations var = { ... };                                                                              


Would this SmPL script variant need any further fine-tuning
(or other software extensions)?

Regards,
Markus

  reply	other threads:[~2015-12-04 13:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 13:04 [Cocci] how to find missing initializer Peter Hurley
2015-12-03 18:46 ` Lars-Peter Clausen
2015-12-03 22:12   ` Julia Lawall
2015-12-03 23:48     ` Luis R. Rodriguez
2015-12-04 13:55       ` SF Markus Elfring [this message]
2015-12-04 14:44         ` [Cocci] Searching with SmPL for missing clean-up settings in designated initialisers Julia Lawall
2015-12-04 15:42           ` SF Markus Elfring
2015-12-04 11:31     ` [Cocci] how to find missing initializer SF Markus Elfring
2015-12-04 13:18       ` Julia Lawall
2015-12-04 11:54   ` Peter Hurley
2015-12-03 19:26 ` Luis R. Rodriguez
2015-12-04  8:55 ` SF Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56619B56.7040508@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.