gn: Don't write invalid output when pool //:console exists; treat all other pools named 'console' as invalid.

Before, defining and referencing pool "//:console" would make gn write a
ninja file that tries to redeclare ninja's built-in console pool, causing
ninja to reject the generated manifest file.

Don't write pools definitions that cause this. This means //:console now represents
ninja's built-in console pool.

Disallow pools in other scopes or in the non-default toolchain to be called "console".
If this was allowed but these pools behaved like regular pools instead of like the
console pool, that'd be confusing.  If they'd all behave like the console pool,
that would be inconsistent with how regular pools work in gn -- the pool depth
there is per-toolchain, while it'd always be globally 1 shared among all console pools
in all toolchains.

While here, also improve the source location for the "pool depths must not be negative"
diagnostic.

Bug: 835319
Change-Id: Idbec9c08f42a0de7b316d8e5e8819c6c8c3c3c45
Reviewed-on: https://chromium-review.googlesource.com/1020010
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#552353}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: e9867a58c30f15c66d0b08b5f78050ff127155f9
4 files changed
tree: a9a3c3f7eba9a494d76777a491f6c3063bb06426
  1. tools/