Skip to content

Commit 3b60dc8

Browse files
jbachorikclaude
andcommitted
Fix compilation errors from CppCheck fixes
- Add missing #include <string> to symbols_linux.cpp - Revert alloca() replacement in flightRecorder.cpp - Buffer class requires flexible array allocation that alloca() provides - Keep cppcheck suppression to acknowledge the warning 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e109685 commit 3b60dc8

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

ddprof-lib/src/main/cpp/flightRecorder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,8 +1612,8 @@ void FlightRecorder::recordLog(LogLevel level, const char *message,
16121612

16131613
if (len > MAX_STRING_LENGTH)
16141614
len = MAX_STRING_LENGTH;
1615-
std::vector<char> buf_storage(len + 40);
1616-
Buffer *buf = reinterpret_cast<Buffer *>(buf_storage.data());
1615+
// cppcheck-suppress obsoleteFunctions
1616+
Buffer *buf = (Buffer *)alloca(len + 40);
16171617
buf->reset();
16181618

16191619
int start = buf->skip(5);

ddprof-lib/src/main/cpp/symbols_linux.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <sys/mman.h>
2626
#include <sys/stat.h>
2727
#include <sys/types.h>
28+
#include <string>
2829
#include <unordered_map>
2930
#include <unordered_set>
3031

0 commit comments

Comments
 (0)