Commit abc1c6de authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Use not_needed() rather than asserts to avoid warnings in jumbo.gni

gn has a function not_needed() intended to avoid "Variable is not
used" errors in gni files. So far the code has used asserts for the
same purpose but it is better to use the function intended for the
purpose.

Change-Id: I5ec7e50c4089b265e104aaede24d0e4e50452cef
Reviewed-on: https://chromium-review.googlesource.com/c/1314588Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Commit-Queue: Daniel Bratell <bratell@opera.com>
Cr-Commit-Position: refs/heads/master@{#605338}
parent 7cbae5d1
...@@ -86,7 +86,7 @@ template("internal_jumbo_target") { ...@@ -86,7 +86,7 @@ template("internal_jumbo_target") {
gen_target_dir = invoker.target_gen_dir gen_target_dir = invoker.target_gen_dir
assert(gen_target_dir != "") # Prevent "unused variable". not_needed([ "gen_target_dir" ]) # Prevent "unused variable".
if (use_jumbo_build_for_target) { if (use_jumbo_build_for_target) {
jumbo_files = [] jumbo_files = []
...@@ -173,16 +173,14 @@ template("internal_jumbo_target") { ...@@ -173,16 +173,14 @@ template("internal_jumbo_target") {
# If the list subtraction triggers a gn error, # If the list subtraction triggers a gn error,
# jumbo_excluded_sources lists a file that is not in sources. # jumbo_excluded_sources lists a file that is not in sources.
sources_after_exclusion = invoker_sources - excluded_sources sources_after_exclusion = invoker_sources - excluded_sources
assert(sources_after_exclusion != [] || true) # Prevent "unused variable". not_needed([ "sources_after_exclusion" ])
} }
target_type = invoker.target_type target_type = invoker.target_type
if (use_jumbo_build_for_target && target_type == "split_static_library") { if (use_jumbo_build_for_target && target_type == "split_static_library") {
# Meaningless and also impossible if split_count > len(jumbo_files) # Meaningless and also impossible if split_count > len(jumbo_files)
target_type = "static_library" target_type = "static_library"
not_needed(invoker, [ "split_count" ])
# Prevent "unused variable" warning.
assert(!defined(invoker.split_count) || invoker.split_count > 0)
} }
# Perform the actual operation, either on the original sources or # Perform the actual operation, either on the original sources or
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment