Re: [PATCH 02/17] cocci: fix incorrect & verbose "the_repository" rules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Every time I try to read cocci and spatch docs, I'm impressed at how
impenetrable they are ;) Nevertheless, I'd still like to understand how
the pattern works. I'll take a stab in the dark, and perhaps you can
correct me.

Ævar Arnfjörð Bjarmason         <avarab@xxxxxxxxx> writes:

> +(
> +- read_object_file
> ++ repo_read_object_file
> +|
> +- has_object_file
> ++ repo_has_object_file
> +|
> +- has_object_file_with_flags
> ++ repo_has_object_file_with_flags
> +|
> +- parse_commit_internal
> ++ repo_parse_commit_internal
> +|
> +- parse_commit
> ++ repo_parse_commit
> +|
> +- get_merge_bases
> ++ repo_get_merge_bases
> +|
> +- get_merge_bases_many
> ++ repo_get_merge_bases_many
> +|
> +- get_merge_bases_many_dirty
> ++ repo_get_merge_bases_many_dirty
> +|
> +- in_merge_bases
> ++ repo_in_merge_bases
> +|
> +- in_merge_bases_many
> ++ repo_in_merge_bases_many
> +|
> +- get_commit_buffer
> ++ repo_get_commit_buffer
> +|
> +- unuse_commit_buffer
> ++ repo_unuse_commit_buffer
> +|
> +- logmsg_reencode
> ++ repo_logmsg_reencode
> +|
> +- format_commit_message
> ++ repo_format_commit_message
> +)

I assume that `|` characters in parentheses are a logical OR, and each
of the expressions checks for the `-` side in the original and replaces
it with the `+` side.

> +  (
> ++ the_repository,
> +  ...)

Then this is another expression that matches literal `()` after the
previous expression? `+the_repository` adds `the_repository` right after
the opening `(`, then leaves the uninteresting `...` in place.

If so, I don't know how cocci/spatch tells the difference between
literal `()` vs an expression in the syntax (preceding whitespace?).

Either way, as Elijah said, your plain explanation is clear enough that
I feel comfortable with this.

> -- 
> 2.40.0.rc1.1034.g5867a1b10c5




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux