From 09c49b34d9d981abd3baa567c3633bfa4e667822 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 4 Jan 2022 10:18:39 +0000 Subject: [PATCH] Fix -Wunreachable-code-return with newer clang version. When the emit_continuing lambda always returns true, clang is able to detect it and finds that some code is unreachable. This commit changes places that use the lambdas directly to instead use the stored emit_continuing_ member. Bud: dawn:824 Change-Id: Idfd804a6ec53ac793e8988dce79991c659fbbc36 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/75060 Auto-Submit: Corentin Wallez Reviewed-by: Ben Clayton Kokoro: Kokoro Commit-Queue: Corentin Wallez --- src/writer/glsl/generator_impl.cc | 4 ++-- src/writer/hlsl/generator_impl.cc | 4 ++-- src/writer/msl/generator_impl.cc | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/writer/glsl/generator_impl.cc b/src/writer/glsl/generator_impl.cc index 6c83e58d98..dc6a05ad32 100644 --- a/src/writer/glsl/generator_impl.cc +++ b/src/writer/glsl/generator_impl.cc @@ -2110,7 +2110,7 @@ bool GeneratorImpl::EmitLoop(const ast::LoopStatement* stmt) { if (!EmitStatements(stmt->body->statements)) { return false; } - if (!emit_continuing()) { + if (!emit_continuing_()) { return false; } } @@ -2190,7 +2190,7 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) { return false; } - if (!emit_continuing()) { + if (!emit_continuing_()) { return false; } } else { diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc index 9108f9f487..09f946c708 100644 --- a/src/writer/hlsl/generator_impl.cc +++ b/src/writer/hlsl/generator_impl.cc @@ -3203,7 +3203,7 @@ bool GeneratorImpl::EmitLoop(const ast::LoopStatement* stmt) { if (!EmitStatements(stmt->body->statements)) { return false; } - if (!emit_continuing()) { + if (!emit_continuing_()) { return false; } } @@ -3283,7 +3283,7 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) { return false; } - if (!emit_continuing()) { + if (!emit_continuing_()) { return false; } } else { diff --git a/src/writer/msl/generator_impl.cc b/src/writer/msl/generator_impl.cc index a4f8b72705..fffd3715e8 100644 --- a/src/writer/msl/generator_impl.cc +++ b/src/writer/msl/generator_impl.cc @@ -1827,7 +1827,7 @@ bool GeneratorImpl::EmitLoop(const ast::LoopStatement* stmt) { if (!EmitStatements(stmt->body->statements)) { return false; } - if (!emit_continuing()) { + if (!emit_continuing_()) { return false; } } @@ -1908,7 +1908,7 @@ bool GeneratorImpl::EmitForLoop(const ast::ForLoopStatement* stmt) { return false; } - if (!emit_continuing()) { + if (!emit_continuing_()) { return false; } } else {