Skip to content

Commit

Permalink
fixes to support -Wstring-conversion compiler warning
Browse files Browse the repository at this point in the history
Summary: We're in the process of enable `-Wstring-conversion` in the default arvr build modes. The reason is that it flags legitimate bugs such as D35316465.

Reviewed By: mhorowitz

Differential Revision: D35389996

fbshipit-source-id: 20fdb00f0b630a723d5a253fd80257edfa87bafb
  • Loading branch information
h-friederich authored and facebook-github-bot committed Apr 5, 2022
1 parent de205a3 commit 250d889
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cxx/fbjni/detail/SimpleFixedString.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ namespace fixedstring {
// it's testing for fails. In this way, precondition violations are reported
// at compile-time instead of at runtime.
[[noreturn]] inline void assertOutOfBounds() {
assert(!"Array index out of bounds in SimpleFixedString");
assert(!(bool)"Array index out of bounds in SimpleFixedString");
throw std::out_of_range(
"Array index out of bounds in SimpleFixedString");
}
Expand All @@ -92,7 +92,7 @@ constexpr std::size_t checkOverflowOrNpos(std::size_t i, std::size_t max) {

// Intentionally NOT constexpr. See note above for assertOutOfBounds
[[noreturn]] inline void assertNotNullTerminated() noexcept {
assert(!"Non-null terminated string used to initialize a SimpleFixedString");
assert(!(bool)"Non-null terminated string used to initialize a SimpleFixedString");
std::terminate(); // Fail hard, fail fast.
}

Expand Down

0 comments on commit 250d889

Please sign in to comment.