Skip to content

Commit

Permalink
[warnings][caffe2] Fix asserts yielding -Wstring-conversion warnings …
Browse files Browse the repository at this point in the history
…(#72013)

Summary:
Pull Request resolved: pytorch/pytorch#72013

Find and replace `assert(!"` with `assert(false && "`
Excludes headers and paths that contain "third-party" or "external"

Clang raises a `-Wstring-conversion` warning when treating a string as a boolean.  This is not uncommon for asserts though (e.g. `assert(!"should never happen")`).  Clang does permit `expr && "string"` though in order to support these assertion use cases.

Test Plan: ci pass

Differential Revision: D33823092

fbshipit-source-id: 9a1af012215bdc91f8b4162ddb2df28d51539773
(cherry picked from commit 0286910350492eea61050bd9c7d21727b607858c)
  • Loading branch information
Nolan O'Brien authored and pytorchmergebot committed Jan 29, 2022
1 parent c238fb5 commit 084eafd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions torch/csrc/jit/codegen/cuda/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,15 @@ class CudaKernelGenerator : private kir::IrVisitor {
}

void visit(const kir::IterDomain* node) final {
TORCH_INTERNAL_ASSERT(!"Unreachable");
TORCH_INTERNAL_ASSERT(false && "Unreachable");
}

void visit(const kir::TensorDomain* node) final {
TORCH_INTERNAL_ASSERT(!"Unreachable");
TORCH_INTERNAL_ASSERT(false && "Unreachable");
}

void visit(const kir::TensorView* tv) final {
TORCH_INTERNAL_ASSERT(!"Unreachable");
TORCH_INTERNAL_ASSERT(false && "Unreachable");
}

void visit(const kir::UnaryOp* node) final {
Expand Down

0 comments on commit 084eafd

Please sign in to comment.