Skip to content

Commit

Permalink
Variable "_custom_impl_clusters" unused before it went out of scope (p…
Browse files Browse the repository at this point in the history
…roject-chip#25177)

When generating data model with no clusters then a build error is
generated due to the "_custom_impl_clusters" variable being unused
before it went out of scope.

```
ERROR at //src/app/chip_data_model.gni:192:29: Assignment had no effect.
    _custom_impl_clusters = []
                            ^
You set the variable "_custom_impl_clusters" here and it was unused
before it went out of scope.
```

To prevent the issue, "_custom_impl_clusters" can be marked as not
needed.
  • Loading branch information
swan-amazon authored Feb 23, 2023
1 parent 8501d76 commit 19fbda3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ template("chip_data_model") {
_custom_impl_clusters = invoker.zap_clusters_with_custom_implementation
}

if (_cluster_sources == []) {
# The variable is only used within the nested foreach-loop and will be
# unused before it goes out of scope when the outter-loop is not entered.
not_needed([ "_custom_impl_clusters" ])
}

foreach(cluster, _cluster_sources) {
_custom_impl = false
foreach(ci, _custom_impl_clusters) {
Expand Down

0 comments on commit 19fbda3

Please sign in to comment.