Re: [Cocci] Source code analysis around "switch"

2015-05-09 Thread SF Markus Elfring
> @hascase@ > position p; > @@ > switch@p (...) > { > case...:... > } > > @hasdefault@ > @@ > switch (...) > { > default:... > } > > @script: python depends on hascase && !hasdefault@ > p< @@ > print "%s %s" % (p[0].file, p[0].line) > > there likely is a simpler solution than this though. I f

Re: [Cocci] Source code analysis around "switch"

2015-05-09 Thread Nicholas Mc Guire
On Sat, 09 May 2015, SF Markus Elfring wrote: > > @hascase@ > > position p; > > @@ > > switch@p (...) > > { > > case...:... > > } > > > > @hasdefault@ > > @@ > > switch (...) > > { > > default:... > > } > > > > @script: python depends on hascase && !hasdefault@ > > p< > @@ > > print "%s %s" %

Re: [Cocci] Source code analysis around "switch"

2015-05-09 Thread SF Markus Elfring
> hascase has a position variable in it and only if > that rule applied is the python script executed - and if there > was a default then hasdefault matched and so the python script > will not be executed when hasdefault matched Do the source code positions matter also for your second SmPL rule?