Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@

#ifdef __ANDROID_NDK__
#include <malloc.h>
#if __ANDROID_API__ < 26
extern "C" __attribute__((weak)) int mallopt(int, int);

@LebedevRI LebedevRI Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this kind of symbol re-declaration even allowed in C++?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a definition - it's just a weak declaration

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what i'm asking, yes.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is. the attribute is an extension so not covered by the standard but this sort of redclaration is fine. it must match the original declaration exactly (does mallopt have noexcept for eg?).

#endif
#endif

#ifdef BENCHMARK_OS_LINUX
Expand Down
Loading