Skip to content

Commit

Permalink
fix compilation warning "infinite recursion detected"
Browse files Browse the repository at this point in the history
In ESP-IDFv5.1 branch, more warnings are turned into error.
In particular here, `-Werror=infinite-recursion` gives the following error:
```
main/test_framework.cpp: In function 'void test_stackoverflow(int, OvmsWriter*, OvmsCommand*, int, const char* const*)':
main/test_framework.cpp:174:6: error: infinite recursion detected [-Werror=infinite-recursion]
  174 | void test_stackoverflow(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
      |      ^~~~~~~~~~~~~~~~~~
main/test_framework.cpp:180:21: note: recursive call
  180 |   test_stackoverflow(verbosity+1, writer, cmd, argc, argv);
      |   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

We add an attribute to confirm that we know what we're doing here.

Signed-off-by: Ludovic LANGE <[email protected]>
  • Loading branch information
llange committed Apr 25, 2023
1 parent 3ace067 commit 0c4ba7d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions vehicle/OVMS.V3/main/test_framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ void test_watchdog(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc
writer->puts("Error: We should never get here");
}

__attribute__((noreturn))
void test_stackoverflow(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
uint8_t data[256];
Expand Down

0 comments on commit 0c4ba7d

Please sign in to comment.