blob: 9b2d784809023aa6a19ff38afd7c4cf114692f1e [file] [log] [blame] [edit]
// Copyright 2022 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <array>
#include "test-data.h"
#if __cplusplus >= 202002L
#define CONSTINIT constinit
#elif defined(__clang__)
#define CONSTINIT [[clang::require_constant_initialization]]
#elif defined(__GNUC__)
#define CONSTINIT __constinit
#else
#error "Unknown compiler"
#endif
const int rodata = 5;
int bss;
CONSTINIT auto data = []() constexpr {
std::array<int, DATA_SIZE + 2> ret{18};
ret.back() = 1;
return ret;
}();
extern "C" const TestData test_data{&rodata, (int*)&data, &bss};