Coccinelle archive on lore.kernel.org
 help / Atom feed
* [Cocci] Continuation for a code search after a common SmPL rule?
       [not found] <a639ce38-81a1-8825-73b0-2b7ba53e6588@web.de>
@ 2019-05-21  5:54 ` Markus Elfring
  2019-05-21  5:57   ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2019-05-21  5:54 UTC (permalink / raw)
  To: Coccinelle

Message repetition from 2019-05-16 because of a temporary technical difficulty
with the mailing list services:

=====

Hello,

The semantic patch language can handle several rules which can contain
remarkable amounts of source code search specifications.
It can happen then that a few of these SmPL rules contain a bit of
common specifications.

Example:
@one@
@@
code_area_1
code_area_2

@two@
@@
code_area_1
code_area_3


Now I would like to clarify possibilities again to reduce unwanted
code duplication at such places.
The common code part can be moved to another SmPL rule.

@start@
@@
code_area_1


Subsequent SmPL rules can refer to metavariables from previous rules.
But how can be achieved that the code search will be continued at a place
after the position where a previous rule ended its search
(without extra code repetition)?

Can the splitting and recombination of such rules become more convenient
with extensions for the Coccinelle software?

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] Continuation for a code search after a common SmPL rule?
  2019-05-21  5:54 ` [Cocci] Continuation for a code search after a common SmPL rule? Markus Elfring
@ 2019-05-21  5:57   ` Julia Lawall
  2019-05-21  6:15     ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2019-05-21  5:57 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Coccinelle



On Tue, 21 May 2019, Markus Elfring wrote:

> Message repetition from 2019-05-16 because of a temporary technical difficulty
> with the mailing list services:
>
> =====
>
> Hello,
>
> The semantic patch language can handle several rules which can contain
> remarkable amounts of source code search specifications.
> It can happen then that a few of these SmPL rules contain a bit of
> common specifications.
>
> Example:
> @one@
> @@
> code_area_1
> code_area_2
>
> @two@
> @@
> code_area_1
> code_area_3
>
>
> Now I would like to clarify possibilities again to reduce unwanted
> code duplication at such places.
> The common code part can be moved to another SmPL rule.
>
> @start@
> @@
> code_area_1
>
>
> Subsequent SmPL rules can refer to metavariables from previous rules.
> But how can be achieved that the code search will be continued at a place
> after the position where a previous rule ended its search
> (without extra code repetition)?
>
> Can the splitting and recombination of such rules become more convenient
> with extensions for the Coccinelle software?

In general it can't.  Coccinelle doesn't have the goal of minimizing the
number of characters in te semantic patch.  It has the goal of making
readable specifications that follow the structure of the matched code.

julia
_______________________________________________
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] Continuation for a code search after a common SmPL rule?
  2019-05-21  5:57   ` Julia Lawall
@ 2019-05-21  6:15     ` Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-05-21  6:15 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Coccinelle

>> Can the splitting and recombination of such rules become more convenient
>> with extensions for the Coccinelle software?
>
> In general it can't.

This feedback seems to fit to the current software situation.


> Coccinelle doesn't have the goal of minimizing the number of characters
> in te semantic patch.

Such a view has got consequences.

* We tolerate additional characters in source files according to
  coding style variations.

* Some source code duplication can become questionable (also in SmPL
  search specifications).


> It has the goal of making readable specifications that follow the structure
> of the matched code.

I hope that this approach can become easier and more convenient.
I got another idea for this purpose.
How do you think about development possibilities around the following
software extension?

Additional key words would help in rule headers of the semantic patch language,
wouldn't they?
* prepend to
* append to
* enclose

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, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <a639ce38-81a1-8825-73b0-2b7ba53e6588@web.de>
2019-05-21  5:54 ` [Cocci] Continuation for a code search after a common SmPL rule? Markus Elfring
2019-05-21  5:57   ` Julia Lawall
2019-05-21  6:15     ` Markus Elfring

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr cocci@archiver.kernel.org
	public-inbox-index cocci


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/ public-inbox