cocci: Add support for meta attributes to SmPL
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines · Markus Elfring
Quoted 3 lines
Quoted 1 line
Two test cases are included for detecting and removing meta attributes.
Applied.
Does this information indicate that you do not care for specific patch review concerns according to these test cases at the moment?
Yes, that's what it means.
julia
Quoted 10 lines
* https://lore.kernel.org/cocci/[email protected]/
https://systeme.lip6.fr/pipermail/cocci/2020-July/008035.html* https://lore.kernel.org/cocci/[email protected]/
https://systeme.lip6.fr/pipermail/cocci/2020-July/008036.htmlRegards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 9 lines · Markus Elfring
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Applied.
Does this information indicate that you do not care for specific patch review concerns according to these test cases at the moment?
Yes, that's what it means.
Would you like to integrate corresponding patches for known open issues (a bit later) then?
No, the code is fine.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Markus Elfring
Quoted 4 lines
Quoted 2 lines
Would you like to integrate corresponding patches for known open issues (a bit later) then?
No, the code is fine.
Will the Coccinelle software itself present a warning like “metavariable
__attr__not used in the - or context code”?
No. It's not a metavariable.
julia
Quoted 5 lines
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Markus Elfring
Quoted 4 lines
Quoted 2 lines
Will the Coccinelle software itself present a warning like “metavariable
__attr__not used in the - or context code”?No. It's not a metavariable.
Quoted 7 lines
How do you call the following items in the update step “[PATCH 42/43] tests:
Add test case to match meta attribute”?
https://lore.kernel.org/cocci/[email protected]/
https://systeme.lip6.fr/pipermail/cocci/2020-July/008036.htmlattribute name
__attr__;
attribute a;
attribute a; declares a metavariable that matches attributes.
attribute name __attr__; declares that __attr__ is the name of an attribute.
These "name" declarations can be used in the parsing of the C code as a hint that __attr__ should be parsed in a special way.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 5 lines · Markus Elfring
Quoted 5 lines
Quoted 5 lines
How do you call the following items in the update step “[PATCH 42/43] tests:
Add test case to match meta attribute”?
https://lore.kernel.org/cocci/[email protected]/
https://systeme.lip6.fr/pipermail/cocci/2020-July/008036.html
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
attribute name
__attr__;
attribute a;attribute a; declares a metavariable that matches attributes.
attribute name
__attr__; declares that__attr__is the name of an attribute.Is this specification also a declaration of a metavariable?
No.
Quoted 8 lines
Quoted 4 lines
These "name" declarations can be used in the parsing of the C code as a hint that
__attr__should be parsed in a special way.Will a more helpful explanation be added to the software documentation like the SmPL manual?
https://github.com/coccinelle/coccinelle/blob/e06b9156dfa02a28cf3cbf0913a10513f3d163ab/docs/manual/cocci_syntax.tex#L452
The discussion of attribute name and name in general already seems clear enough.
Quoted 3 lines
Which display do you get for the command “spatch --parse-cocci tests/metaattr.cocci” according to the discussed development version of your software?
There is no warning. The code is now on github. You can test it yourself.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Markus Elfring
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
attribute name
__attr__; declares that__attr__is the name of an attribute.Is this specification also a declaration of a metavariable?
No.
How do you distinguish between metavariables and other SmPL variables then?
Metavariables don't have "name" in their declaration. There is a sentence about that in the documentation.
The {\bf name} modifier specifies that instead of declaring a metavariable to match over some kind, the identifiers are to be considered as elements of that kind when they appear in the code.
"instead of declaring a metavariable" says that the thing that is declared is not a metavariable.
julia
Quoted 14 lines
Quoted 7 lines
Quoted 5 lines
Will a more helpful explanation be added to the software documentation like the SmPL manual?
https://github.com/coccinelle/coccinelle/blob/e06b9156dfa02a28cf3cbf0913a10513f3d163ab/docs/manual/cocci_syntax.tex#L452The discussion of attribute name and name in general already seems clear enough.
I got an other impression.
Quoted 3 lines
Quoted 2 lines
Which display do you get for the command “spatch --parse-cocci tests/metaattr.cocci” according to the discussed development version of your software?
Quoted 8 lines
Quoted 1 line
There is no warning. The code is now on github. You can test it yourself.
Should software users get informed about unused items in consistent ways?
https://github.com/coccinelle/coccinelle/blob/04f36d537b9f6c0c127d05184cccd21f1a46b952/parsing_cocci/check_meta.ml#L711Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 16 lines · Markus Elfring
Quoted 8 lines
Quoted 1 line
How do you distinguish between metavariables and other SmPL variables then?
Metavariables don't have "name" in their declaration. There is a sentence about that in the documentation.
The {\bf name} modifier specifies that instead of declaring a metavariable to match over some kind, the identifiers are to be considered as elements of that kind when they appear in the code.
Quoted 2 lines
"instead of declaring a metavariable" says that the thing that is declared is not a metavariable.
Quoted 6 lines
It seems that we stumble on different interpretations also around a wording like “to match over some kind”.
* Which is the category of SmPL identifiers which contain the key word “name” in their data type (or “kind” if you would like to prevent to denote them as metavariables)?
The ones that have "name" in the BNF.
Quoted 5 lines
* How do you think about to add square brackets to a line in the TeX SmPL grammar?
https://github.com/coccinelle/coccinelle/blob/e06b9156dfa02a28cf3cbf0913a10513f3d163ab/docs/manual/cocci_syntax.tex#L245\CASE{attribute \opt{name} \NT{ids} ;}
No, there will be a separate entry for attribute name;. Putting \opt{} would lead to the confusion that you are falling into. They are different things.
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Should software users get informed about unused items in consistent ways?
https://github.com/coccinelle/coccinelle/blob/04f36d537b9f6c0c127d05184cccd21f1a46b952/parsing_cocci/check_meta.ml#L711Do you care if a SmPL name variable would accidentally not be used
(like in the script “https://github.com/coccinelle/coccinelle/blob/04f36d537b9f6c0c127d05184cccd21f1a46b952/tests/metaattr.cocci#L2”)?
It actually is used, to help parsing the .c file. This information will be added to the documentation shortly.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 14 lines · Markus Elfring
Quoted 5 lines
Quoted 2 lines
Do you care if a SmPL name variable would accidentally not be used
(like in the script “https://github.com/coccinelle/coccinelle/blob/04f36d537b9f6c0c127d05184cccd21f1a46b952/tests/metaattr.cocci#L2”)?It actually is used, to help parsing the .c file. This information will be added to the documentation shortly.
I would expect that the following SmPL script variant will generate also a patch.
(Why would extra “help” be needed for parsing source files?)@replacement@
attribute a;
identifier b;
@@
Review
Quoted 3 lines
(quoted diff) +1
-1-int +char b a = 1;
Only if the C code is able to be parsed (note that you could have tested this instead of expecting something).
It's not well defined whether something is an attribute or not. Coccinelle has some heuristics for that.
But even if the declaration is completely useless, I also don't care. It's one line in a test case. It hurts nothing. Much more time has been wasted on this discussion than on any confusion that line would cause.
Quoted 18 lines
By the way:
I have noticed another detail which I find questionable at the moment.elfring@Sonne:~/Projekte/Coccinelle/20160205> spatch --parse-cocci
tests/metaattr-2.cocci…
(
-intQuoted 1 line
Quoted 1 line
Quoted 1 line
char
b a = 1;
|(quoted diff) +0
-2-signed >>> char -int b a = 1;)
…
Quoted 4 lines
I would interpret the display for the second part of such a SmPL disjunction in the way that a variable definition will be deleted (instead of taking only the key word “signed” also into account according to the isomorphism “add_signed”).
I'm not sure why the whole declaration became removed. Thanks for the report.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 37 lines · Markus Elfring
Quoted 9 lines
Quoted 5 lines
Do you care if a SmPL name variable would accidentally not be used
(like in the script “
https://github.com/coccinelle/coccinelle/blob/04f36d537b9f6c0c127d05184cccd21f1a46b952/tests/metaattr.cocci#L2”
)?It actually is used, to help parsing the .c file. This information will
be added to the documentation shortly.I would expect that the following SmPL script variant will generate also a patch.
(Why would extra “help” be needed for parsing source files?)@replacement@
attribute a;
identifier b;
@@(quoted diff) +1
-1-int +char b a = 1;By the way:
I have noticed another detail which I find questionable at the moment.elfring@Sonne:~/Projekte/Coccinelle/20160205> spatch --parse-cocci
tests/metaattr-2.cocci
…
((quoted diff) +0
-3-int >>> char b a = 1; -signed >>> char -int b a = 1;
Quoted 3 lines
)
…
Probably a pretty printing mistake. I'll fix this.
Thanks,
Jaskaran.
Quoted 9 lines
I would interpret the display for the second part of such a SmPL disjunction
in the way that a variable definition will be deleted (instead of taking only
the key word “signed” also into account according to the isomorphism “add_signed”).Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Markus Elfring
Quoted 1 line
Probably a pretty printing mistake. I'll fix this.
How do you think about to clarify any related software dependencies?
What do you mean?
Quoted 2 lines
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci