Skip to content

Commit 97ad9ad

Browse files
pedroerpfacebook-github-bot
authored andcommitted
Fix NDEBUG usages (facebookincubator#10612)
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
1 parent 8ab9d11 commit 97ad9ad

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

velox/common/memory/HashStringAllocator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void HashStringAllocator::clear() {
101101
new (&state_.freeLists()[i]) CompactDoubleList();
102102
}
103103

104-
#ifdef NDEBUG
104+
#ifndef NDEBUG
105105
static const auto kHugePageSize = memory::AllocationTraits::kHugePageSize;
106106
for (auto i = 0; i < state_.pool().numRanges(); ++i) {
107107
const auto range = state_.pool().rangeAt(i);

velox/functions/sparksql/tests/DateTimeFunctionsTest.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -882,23 +882,14 @@ TEST_F(DateTimeFunctionsTest, fromUnixtime) {
882882

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

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

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

0 commit comments

Comments
 (0)