Fix code relying on initialization order

Allows Debug - LLVM to boot
This commit is contained in:
Silent 2020-01-30 22:03:36 +01:00 committed by Ivan
parent aeebcfe141
commit 9f678cc47a
9 changed files with 25 additions and 17 deletions

View File

@ -629,7 +629,7 @@ logs::file_listener::file_listener(const std::string& name)
ver.m.ch = nullptr;
ver.m.sev = level::always;
ver.stamp = 0;
ver.text = fmt::format("RPCS3 v%s | %s%s\n%s", rpcs3::version.to_string(), rpcs3::get_branch(), firmware_string, utils::get_system_info());
ver.text = fmt::format("RPCS3 v%s | %s%s\n%s", rpcs3::get_version().to_string(), rpcs3::get_branch(), firmware_string, utils::get_system_info());
file_writer::log(logs::level::always, ver.text.data(), ver.text.size());
file_writer::log(logs::level::always, "\n", 1);

View File

@ -221,7 +221,7 @@ int main(int argc, char** argv)
const bool use_cli_style = find_arg(arg_style, argc, argv) || find_arg(arg_stylesheet, argc, argv);
QScopedPointer<QCoreApplication> app(createApplication(argc, argv));
app->setApplicationVersion(qstr(rpcs3::version.to_string()));
app->setApplicationVersion(qstr(rpcs3::get_version().to_string()));
app->setApplicationName("RPCS3");
// Command line args

View File

@ -21,5 +21,9 @@ namespace rpcs3
// TODO: Make this accessible from cmake and keep in sync with MACOSX_BUNDLE_BUNDLE_VERSION.
// Currently accessible by Windows and Linux build scripts, see implementations when doing MACOSX
const extern utils::version version{ 0, 0, 8, utils::version_type::alpha, 1, RPCS3_GIT_VERSION };
const utils::version& get_version()
{
static constexpr utils::version version{ 0, 0, 8, utils::version_type::alpha, 1, RPCS3_GIT_VERSION };
return version;
}
}

View File

@ -7,6 +7,5 @@ namespace rpcs3
{
std::string get_branch();
std::pair<std::string, std::string> get_commit_and_hash();
extern const utils::version version;
const utils::version& get_version();
}

View File

@ -14,7 +14,7 @@ about_dialog::about_dialog(QWidget* parent) : QDialog(parent), ui(new Ui::about_
ui->close->setDefault(true);
ui->version->setText(tr("RPCS3 Version: %1").arg(qstr(rpcs3::version.to_string())));
ui->version->setText(tr("RPCS3 Version: %1").arg(qstr(rpcs3::get_version().to_string())));
// Events
connect(ui->gitHub, &QPushButton::clicked, [] { QDesktopServices::openUrl(QUrl("https://www.github.com/RPCS3")); });

View File

@ -39,13 +39,13 @@ gs_frame::gs_frame(const QString& title, const QRect& geometry, const QIcon& app
m_disable_mouse = gui_settings->GetValue(gui::gs_disableMouse).toBool();
// Get version by substringing VersionNumber-buildnumber-commithash to get just the part before the dash
std::string version = rpcs3::version.to_string();
std::string version = rpcs3::get_version().to_string();
version = version.substr(0 , version.find_last_of('-'));
// Add branch and commit hash to version on frame unless it's master.
if ((rpcs3::get_branch().compare("master") != 0) && (rpcs3::get_branch().compare("HEAD") != 0))
{
version = version + "-" + rpcs3::version.to_string().substr((rpcs3::version.to_string().find_last_of('-') + 1), 8) + "-" + rpcs3::get_branch();
version = version + "-" + rpcs3::get_version().to_string().substr((rpcs3::get_version().to_string().find_last_of('-') + 1), 8) + "-" + rpcs3::get_branch();
}
m_windowTitle += qstr(" | " + version);

View File

@ -94,7 +94,7 @@ void main_window::Init()
CreateConnects();
setMinimumSize(350, minimumSizeHint().height()); // seems fine on win 10
setWindowTitle(QString::fromStdString("RPCS3 " + rpcs3::version.to_string()));
setWindowTitle(QString::fromStdString("RPCS3 " + rpcs3::get_version().to_string()));
Q_EMIT RequestGlobalStylesheetChange(guiSettings->GetCurrentStylesheetPath());
ConfigureGuiFromSettings(true);

View File

@ -79,7 +79,7 @@ namespace stx
// Destroy all objects and keep them in uninitialized state, must be called first
void reset() noexcept
{
const auto total_count = stx::typelist_v<typeinfo>.count();
const auto total_count = stx::typelist<typeinfo>().count();
if (!m_list)
{
@ -96,13 +96,13 @@ namespace stx
void(*destroy)(void*& ptr) noexcept;
};
auto all_data = std::make_unique<destroy_info[]>(stx::typelist_v<typeinfo>.count());
auto all_data = std::make_unique<destroy_info[]>(stx::typelist<typeinfo>().count());
// Actual number of created objects
unsigned _max = 0;
// Create destroy list
for (auto& type : stx::typelist_v<typeinfo>)
for (auto& type : stx::typelist<typeinfo>())
{
if (m_order[type.index()] == 0)
{
@ -136,7 +136,7 @@ namespace stx
// Default initialize all objects if possible and not already initialized
void init() noexcept
{
for (auto& type : stx::typelist_v<typeinfo>)
for (auto& type : stx::typelist<typeinfo>())
{
type.create(m_list[type.index()]);

View File

@ -112,16 +112,21 @@ namespace stx
// Global typecounter instance
template <typename Info>
inline type_counter<Info> typelist_v{};
auto& typelist()
{
static type_counter<Info> typelist_v;
return typelist_v;
}
template <typename Info>
type_info<Info>::type_info(Info info, decltype(sizeof(int))) noexcept
: Info(info)
, type(typelist_v<Info>.count())
, type(typelist<Info>().count())
{
// Update linked list
typelist_v<Info>.next->next = this;
typelist_v<Info>.next = this;
auto& tl = typelist<Info>();
tl.next->next = this;
tl.next = this;
}
// Type index accessor