Skip to content

Commit

Permalink
Fix NDEBUG usages (facebookincubator#10612)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebookincubator#10612

Fixing NDEBUG broken usages. NDEBUG should be set when NOT in debug
mode.

Reviewed By: Yuhta

Differential Revision: D60483747

fbshipit-source-id: a45a0fc734f94eae9e341faad92eaa280464cf01
  • Loading branch information
pedroerp authored and facebook-github-bot committed Jul 31, 2024
1 parent 8ab9d11 commit 97ad9ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion velox/common/memory/HashStringAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void HashStringAllocator::clear() {
new (&state_.freeLists()[i]) CompactDoubleList();
}

#ifdef NDEBUG
#ifndef NDEBUG
static const auto kHugePageSize = memory::AllocationTraits::kHugePageSize;
for (auto i = 0; i < state_.pool().numRanges(); ++i) {
const auto range = state_.pool().rangeAt(i);
Expand Down
15 changes: 3 additions & 12 deletions velox/functions/sparksql/tests/DateTimeFunctionsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,23 +882,14 @@ TEST_F(DateTimeFunctionsTest, fromUnixtime) {

// In debug mode, Timestamp constructor will throw exception if range check
// fails.
#ifdef NDEBUG
// Integer overflow in the internal conversion from seconds to milliseconds.
EXPECT_EQ(
#ifndef NDEBUG
VELOX_ASSERT_THROW(
fromUnixTime(std::numeric_limits<int64_t>::max(), "yyyy-MM-dd HH:mm:ss"),
"1969-12-31 23:59:59");
"Timestamp seconds out of range");
#endif

// 8 hours ahead UTC.
setQueryTimeZone("Asia/Shanghai");
// In debug mode, Timestamp constructor will throw exception if range check
// fails.
#ifdef NDEBUG
// Integer overflow in the internal conversion from seconds to milliseconds.
EXPECT_EQ(
fromUnixTime(std::numeric_limits<int64_t>::max(), "yyyy-MM-dd HH:mm:ss"),
"1970-01-01 07:59:59");
#endif

EXPECT_EQ(fromUnixTime(0, "yyyy-MM-dd HH:mm:ss"), "1970-01-01 08:00:00");
EXPECT_EQ(fromUnixTime(120, "yyyy-MM-dd HH:mm"), "1970-01-01 08:02");
Expand Down

0 comments on commit 97ad9ad

Please sign in to comment.