* [Cocci] Checking search results for two enumerations
@ 2020-04-30 17:06 Markus Elfring
2020-04-30 17:16 ` Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2020-04-30 17:06 UTC (permalink / raw)
To: Coccinelle
Hello,
I have tried another tiny script out for the semantic patch language
(according to the software combination “Coccinelle 1.0.8-00029-ga549b9f0”).
@display@
int i;
@@
return
* -i
;
Are the following search results worth for further software development considerations?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/net/wireless/intersil/hostap/hostap_main.c
elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/show_returns_of_negative_integers2.cocci drivers/net/wireless/intersil/hostap/hostap_main.c
…
@@ -328,7 +327,6 @@ int hostap_set_encryption(local_info_t *
u16 val, old_val;
int i, keylen, len, idx;
char keybuf[WEP_KEY_LEN + 1];
- enum { NONE, WEP, OTHER } encrypt_type;
idx = local->crypt_info.tx_keyidx;
if (local->crypt_info.crypt[idx] == NULL ||
…
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/sound/drivers/opl3/opl3_midi.c
elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/show_returns_of_negative_integers2.cocci sound/drivers/opl3/opl3_midi.c
…
@@ -136,7 +136,6 @@ static int opl3_get_voice(struct snd_opl
/* This is our "allocation cost" table */
enum {
- FREE = 0, CHEAP, EXPENSIVE, END
};
/* Keeps track of what we are finding */
…
Why are source code places presented which do not contain a key word
I was looking for this test approach?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Cocci] Checking search results for two enumerations
2020-04-30 17:06 [Cocci] Checking search results for two enumerations Markus Elfring
@ 2020-04-30 17:16 ` Julia Lawall
2020-05-01 5:15 ` [Cocci] Checking SmPL data processing for enumerations Markus Elfring
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-04-30 17:16 UTC (permalink / raw)
To: Markus Elfring; +Cc: Coccinelle
[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]
On Thu, 30 Apr 2020, Markus Elfring wrote:
> Hello,
>
> I have tried another tiny script out for the semantic patch language
> (according to the software combination “Coccinelle 1.0.8-00029-ga549b9f0”).
>
>
> @display@
> int i;
> @@
> return
> * -i
> ;
>
>
> Are the following search results worth for further software development considerations?
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/net/wireless/intersil/hostap/hostap_main.c
>
> elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/show_returns_of_negative_integers2.cocci drivers/net/wireless/intersil/hostap/hostap_main.c
> …
> @@ -328,7 +327,6 @@ int hostap_set_encryption(local_info_t *
> u16 val, old_val;
> int i, keylen, len, idx;
> char keybuf[WEP_KEY_LEN + 1];
> - enum { NONE, WEP, OTHER } encrypt_type;
>
> idx = local->crypt_info.tx_keyidx;
> if (local->crypt_info.crypt[idx] == NULL ||
> …
>
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/sound/drivers/opl3/opl3_midi.c
>
> elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/show_returns_of_negative_integers2.cocci sound/drivers/opl3/opl3_midi.c
> …
> @@ -136,7 +136,6 @@ static int opl3_get_voice(struct snd_opl
>
> /* This is our "allocation cost" table */
> enum {
> - FREE = 0, CHEAP, EXPENSIVE, END
> };
>
> /* Keeps track of what we are finding */
> …
>
>
> Why are source code places presented which do not contain a key word
> I was looking for this test approach?
I don't know. With --debug you can see that there are only two matches.
So maybe it is a pretty printing problem.
julia
[-- Attachment #2: Type: text/plain, Size: 136 bytes --]
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Cocci] Checking SmPL data processing for enumerations
2020-04-30 17:16 ` Julia Lawall
@ 2020-05-01 5:15 ` Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-05-01 5:15 UTC (permalink / raw)
To: Julia Lawall; +Cc: Coccinelle
>> @display@
>> int i;
>> @@
>> return
>> * -i
>> ;
…
>> Why are source code places presented which do not contain a key word
>> I was looking for this test approach?
>
> I don't know. With --debug you can see that there are only two matches.
> So maybe it is a pretty printing problem.
Can another tiny source file example help here for further clarification?
elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch show_returns_of_negative_integers2.cocci ../Probe/enum-test1.c
…
@@ -1,5 +1,3 @@
int my_test(void)
{
-enum { x } e;
-return -1;
}
How can such a software situation be improved?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-01 5:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-30 17:06 [Cocci] Checking search results for two enumerations Markus Elfring
2020-04-30 17:16 ` Julia Lawall
2020-05-01 5:15 ` [Cocci] Checking SmPL data processing for enumerations Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).