Skip to contentSkip to conversation

Software analysis around data type annotations

Cocci Markus Elfring 3 participants 7 messages Jun 16, 2020 – Jun 17, 2020

lore
Share & tools
lore
#0 lore raw

Hello,

The support for data processing with attributes was extended recently.
https://github.com/coccinelle/coccinelle/commits?q=committer-date%3A%3C2020-06-16

Under which circumstances will a source code analysis approach become supported by a script (like the following) for the semantic patch language?

@display@
identifier action;
@@
*void __iomem * action(...)
{ ... }

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci show_iomem_functions.cocci …
minus: parse error:
File "show_iomem_functions.cocci", line 4, column 14, charpos = 46
around = '*',
whole content = *void __iomem * action(...)

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

#1 lore raw

Hi Markus,

I'm away from my computer right now so can't test this, but try declaring __iomem as an attribute:

@display@
identifier action;
attribute name __iomem;
@@

Quoted 27 lines · On Tue, 16 Jun 2020, 10:21 p.m. Markus Elfring <[email protected] wrote:

Hello,

The support for data processing with attributes was extended recently.

https://github.com/coccinelle/coccinelle/commits?q=committer-date%3A%3C2020-06-16

Under which circumstances will a source code analysis approach become supported
by a script (like the following) for the semantic patch language?

@display@
identifier action;
@@
*void __iomem * action(...)
{ ... }

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci show_iomem_functions.cocci
…
minus: parse error:
File "show_iomem_functions.cocci", line 4, column 14, charpos = 46 around = '*',
whole content = *void __iomem * action(...)

Quoted 3 lines

Regards,
Markus

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

#2 lore raw
Quoted 1 line

I'm away from my computer right now so can't test this, but try declaring __iomem as an attribute:

@display@
attribute name __iomem;
identifier action;
@@
*void __iomem * action(...)
{ ... }

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci show_iomem_functions2.cocci …
minus: parse error:
File "show_iomem_functions2.cocci", line 5, column 14, charpos = 70
around = '*',
whole content = *void __iomem * action(...)

Test version: 1.0.8-00131-g675b9670

How many software development resources will be needed to get such SmPL script variants to work?

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

#3 lore raw
Quoted 20 lines · Markus Elfring
Quoted 2 lines

I'm away from my computer right now so can't test this, but try declaring __iomem as an attribute:

@display@
attribute name __iomem;
identifier action;
@@
*void __iomem * action(...)
{ ... }

elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci show_iomem_functions2.cocci
…
minus: parse error:
File "show_iomem_functions2.cocci", line 5, column 14, charpos = 70 around = '*',
whole content = *void __iomem * action(...)

Quoted 2 lines

Test version: 1.0.8-00131-g675b9670

Hm, okay this is due to a certain quirk in the SmPL parser, w/r/t pointers. I don't think it was a big deal before, but now it might be due to attributes...

Once I'm done with what I'm working on right now I'll get around to this. Meanwhile, you could do the following:

@display@
attribute name __iomem;
identifier action;
@@
*void * __iomem action(...)
{...}

It's not quite in line with the what-you-see-is-what-you-get principle, but it'll work for your use case.

Quoted 4 lines

How many software development resources will be needed to get such SmPL script variants to work?

Please stop asking such questions and I'll be happy to help you out.

Cheers,
Jaskaran.

Quoted 2 lines

Regards,
Markus

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

#4 lore raw
Quoted 5 lines

*void * __iomem action(...)
{...}

It's not quite in line with the what-you-see-is-what-you-get principle, but it'll work for your use case.

Usable output is produced after the adjusted position for the macro.

elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/show_iomem_functions3.cocci drivers/base/platform.c …
-void __iomem *
-devm_platform_ioremap_resource_byname(struct platform_device *pdev,
- const char *name)
…

Quoted 4 lines
Quoted 2 lines

How many software development resources will be needed to get such SmPL script variants to work?

Please stop asking such questions

I am going to present similar questions occasionally.

Quoted 1 line

and I'll be happy to help you out.

Thanks for your positive feedback.

I imagine that I can offer more concrete development items (besides the ones you might know already) if I would get also additional resources.

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

#5 lore raw
Quoted 16 lines · Markus Elfring
Quoted 5 lines

*void * __iomem action(...)
{...}

It's not quite in line with the what-you-see-is-what-you-get principle, but it'll work for your use case.

Usable output is produced after the adjusted position for the macro.

elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/show_iomem_functions3.cocci drivers/base/platform.c …

(quoted diff) +0 -3
-void __iomem *
-devm_platform_ioremap_resource_byname(struct platform_device *pdev,
-				      const char *name)
…
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

How many software development resources will be needed to get such SmPL script variants to work?

Please stop asking such questions

I am going to present similar questions occasionally.

Please stop. The chance that people will help you will increase. No one is interested in quantifying software development resources. Even your favorite phrase "my software development attention" is really really annoying. Just drop "software development" from your vocabulary and it will be a step in the right direction.

julia

Quoted 10 lines
Quoted 3 lines

and I'll be happy to help you out.

Thanks for your positive feedback.

I imagine that I can offer more concrete development items (besides the ones you might know already) if I would get also additional resources.

Quoted 7 lines

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

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

#6 lore raw
Quoted 3 lines
Quoted 1 line

I am going to present similar questions occasionally.

Please stop.

I hope that I can continue as usual for while according to a desire to achieve further improvements.

Quoted 1 line

The chance that people will help you will increase.

This would be nice.

Quoted 1 line

No one is interested in quantifying software development resources.

Really?

I suggest to reconsider such a view.

Quoted 3 lines

Even your favorite phrase "my software development attention" is really really annoying. Just drop "software development" from your vocabulary and it will be a step in the right direction.

Will it become more interesting to clarify corresponding communication difficulties?

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