Skip to content

Commit 64eee3d

Browse files
committed
Move the debug sort-order check inside a function (compile error at file scope)
#1 (comment)
1 parent 9f72098 commit 64eee3d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

components/nspanel_easy/page_utilities.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
#include "esp32-hal-psram.h"
1212
#endif
1313

14-
#ifndef NDEBUG_INITIAL_UTILITIES_GROUPS
15-
// Verify sort order in debug builds
16-
for (size_t i = 1; i < UTILITIES_GROUPS_COUNT; ++i) {
17-
assert(std::strcmp(INITIAL_UTILITIES_GROUPS[i-1].group_id,
18-
INITIAL_UTILITIES_GROUPS[i].group_id) < 0);
19-
}
20-
#endif
21-
2214
namespace nspanel_easy {
2315

2416
bool page_utilities_enabled = false;
@@ -30,6 +22,14 @@ namespace nspanel_easy {
3022

3123
void resetUtilitiesGroups() {
3224

25+
#ifndef NDEBUG
26+
// Verify sort order in debug builds
27+
for (size_t i = 1; i < UTILITIES_GROUPS_COUNT; ++i) {
28+
assert(std::strcmp(INITIAL_UTILITIES_GROUPS[i-1].group_id,
29+
INITIAL_UTILITIES_GROUPS[i].group_id) < 0);
30+
}
31+
#endif // NDEBUG
32+
3333
cleanupUtilitiesGroups(); // Free any existing allocation first
3434

3535
#ifdef USE_ESP_IDF // To-do: Review if this arduino specific code is still needed

0 commit comments

Comments
 (0)