Skip to content
Merged
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions libc/test/UnitTest/HermeticTestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ int atexit(void (*func)(void));

} // namespace LIBC_NAMESPACE_DECL

extern "C" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why extern C? Constexpr has no linkage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was inside an extern "C" block before so I kept it the same way when moving up. Is it safe to remove extern "C" then?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

constexpr uint64_t ALIGNMENT = alignof(uintptr_t);
}

namespace {

// Integration tests cannot use the SCUDO standalone allocator as SCUDO pulls
Expand All @@ -42,7 +46,7 @@ namespace {
// which just hands out continuous blocks from a statically allocated chunk of
// memory.
static constexpr uint64_t MEMORY_SIZE = 65336;
static uint8_t memory[MEMORY_SIZE];
alignas(ALIGNMENT) static uint8_t memory[MEMORY_SIZE];
static uint8_t *ptr = memory;

} // anonymous namespace
Expand Down Expand Up @@ -74,8 +78,6 @@ void *memset(void *ptr, int value, size_t count) {
// This is needed if the test was compiled with '-fno-use-cxa-atexit'.
int atexit(void (*func)(void)) { return LIBC_NAMESPACE::atexit(func); }

constexpr uint64_t ALIGNMENT = alignof(uintptr_t);

void *malloc(size_t s) {
// Keep the bump pointer aligned on an eight byte boundary.
s = ((s + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT;
Expand Down
Loading