Skip to content

Commit

Permalink
pw_perf_test: Remove invalid constexpr specifier
Browse files Browse the repository at this point in the history
- The TestInfo constructor cannot be constexpr because it calls a
  non-constexpr function.
- Make TestInfo declarations const.

Bug: b/271485754
Change-Id: Ie51ceeef330f36d5ad5755e20a41b5cd7beb7a76
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/131753
Commit-Queue: Auto-Submit <[email protected]>
Pigweed-Auto-Submit: Wyatt Hepler <[email protected]>
Reviewed-by: Ewout van Bekkum <[email protected]>
  • Loading branch information
255 authored and CQ Bot Account committed Mar 4, 2023
1 parent 0c5533f commit 9d2776b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pw_perf_test/public/pw_perf_test/perf_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "pw_preprocessor/arguments.h"

#define PW_PERF_TEST(name, function, ...) \
::pw::perf_test::internal::TestInfo PwPerfTest_##name( \
const ::pw::perf_test::internal::TestInfo PwPerfTest_##name( \
#name, [](::pw::perf_test::State& pw_perf_test_state) { \
static_cast<void>( \
function(pw_perf_test_state PW_COMMA_ARGS(__VA_ARGS__))); \
Expand Down Expand Up @@ -59,6 +59,7 @@ class Framework {
: event_handler_(nullptr),
tests_(nullptr),
run_info_{.total_tests = 0, .default_iterations = kDefaultIterations} {}

static Framework& Get() { return framework_; }

void RegisterEventHandler(EventHandler& event_handler) {
Expand All @@ -84,7 +85,7 @@ class Framework {

class TestInfo {
public:
constexpr TestInfo(const char* test_name, void (*function_body)(State&))
TestInfo(const char* test_name, void (*function_body)(State&))
: run_(function_body), test_name_(test_name) {
// Once a TestInfo object is created by the macro, this adds itself to the
// list of registered tests
Expand Down

0 comments on commit 9d2776b

Please sign in to comment.