From 9ae4915e9cd2388916cc680e30a531798026ca57 Mon Sep 17 00:00:00 2001 From: lizzie Date: Mon, 1 Jun 2026 19:05:44 +0000 Subject: [PATCH] [*] basic in-house cpp linting Signed-off-by: lizzie --- src/frontend_common/data_manager.h | 5 +--- src/frontend_common/firmware_manager.h | 5 +--- src/frontend_common/mod_manager.h | 1 + src/qt_common/abstract/frontend.h | 4 +-- src/qt_common/qt_common.h | 4 +-- src/qt_common/util/applet.h | 4 +-- src/qt_common/util/content.h | 4 +-- src/qt_common/util/fs.h | 4 +-- src/qt_common/util/game.h | 5 +--- src/qt_common/util/meta.h | 4 +-- src/qt_common/util/path.h | 5 +--- src/qt_common/util/rom.h | 9 ++---- src/video_core/smaa_area_tex.h | 5 +--- src/video_core/smaa_search_tex.h | 5 +--- src/yuzu/data_dialog.h | 5 +--- src/yuzu/migration_dialog.h | 5 +--- src/yuzu/migration_worker.h | 5 +--- src/yuzu/ryujinx_dialog.h | 5 +--- tools/cpp-lint.sh | 40 ++++++++++++++++++++++++++ 19 files changed, 60 insertions(+), 64 deletions(-) create mode 100755 tools/cpp-lint.sh diff --git a/src/frontend_common/data_manager.h b/src/frontend_common/data_manager.h index afb7cb0d2b..317437f6c6 100644 --- a/src/frontend_common/data_manager.h +++ b/src/frontend_common/data_manager.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef DATA_MANAGER_H -#define DATA_MANAGER_H +#pragma once #include "common/common_types.h" #include @@ -21,5 +20,3 @@ std::string ReadableBytesSize(u64 size) noexcept; u64 DataDirSize(DataDir dir); }; // namespace FrontendCommon::DataManager - -#endif // DATA_MANAGER_H diff --git a/src/frontend_common/firmware_manager.h b/src/frontend_common/firmware_manager.h index 94469e9295..a9119d9e39 100644 --- a/src/frontend_common/firmware_manager.h +++ b/src/frontend_common/firmware_manager.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef FIRMWARE_MANAGER_H -#define FIRMWARE_MANAGER_H +#pragma once #include "common/common_types.h" #include "core/core.h" @@ -107,5 +106,3 @@ inline std::pair GetFirmwareVersion // TODO(crueter): GET AS STRING } - -#endif diff --git a/src/frontend_common/mod_manager.h b/src/frontend_common/mod_manager.h index 57fdbc3533..79c9e8ade7 100644 --- a/src/frontend_common/mod_manager.h +++ b/src/frontend_common/mod_manager.h @@ -5,6 +5,7 @@ #include #include +#include #include "common/common_types.h" namespace FrontendCommon { diff --git a/src/qt_common/abstract/frontend.h b/src/qt_common/abstract/frontend.h index 9b70f6849e..48c7c6edd0 100644 --- a/src/qt_common/abstract/frontend.h +++ b/src/qt_common/abstract/frontend.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef FRONTEND_H -#define FRONTEND_H +#pragma once #include #include "qt_common/qt_common.h" @@ -114,4 +113,3 @@ const QString GetTextInput(const QString& title = QString(), const QString& capt const QString& defaultText = QString()); } // namespace QtCommon::Frontend -#endif // FRONTEND_H diff --git a/src/qt_common/qt_common.h b/src/qt_common/qt_common.h index 2109774506..ea8e3f73a2 100644 --- a/src/qt_common/qt_common.h +++ b/src/qt_common/qt_common.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef QT_COMMON_H -#define QT_COMMON_H +#pragma once #include #include @@ -62,4 +61,3 @@ const QString tr(const std::string& str); std::filesystem::path GetEdenCommand(); } // namespace QtCommon -#endif diff --git a/src/qt_common/util/applet.h b/src/qt_common/util/applet.h index f88aa066b2..41294466da 100644 --- a/src/qt_common/util/applet.h +++ b/src/qt_common/util/applet.h @@ -1,9 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef QT_APPLET_UTIL_H -#define QT_APPLET_UTIL_H +#pragma once // TODO namespace QtCommon::Applets {} -#endif // QT_APPLET_UTIL_H diff --git a/src/qt_common/util/content.h b/src/qt_common/util/content.h index 452764ef54..6b0cbb5965 100644 --- a/src/qt_common/util/content.h +++ b/src/qt_common/util/content.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef QT_CONTENT_UTIL_H -#define QT_CONTENT_UTIL_H +#pragma once #include #include "common/common_types.h" @@ -63,4 +62,3 @@ void configureFilesystemProvider(const std::string& filepath); // Profiles // void FixProfiles(); } // namespace QtCommon::Content -#endif // QT_CONTENT_UTIL_H diff --git a/src/qt_common/util/fs.h b/src/qt_common/util/fs.h index 5ab59e2a45..8f42beaaa3 100644 --- a/src/qt_common/util/fs.h +++ b/src/qt_common/util/fs.h @@ -1,12 +1,12 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later +#pragma once + #include #include #include "common/common_types.h" -#pragma once - namespace QtCommon::FS { void LinkRyujinx(std::filesystem::path& from, std::filesystem::path& to); diff --git a/src/qt_common/util/game.h b/src/qt_common/util/game.h index 9a61bb9349..8722574ed7 100644 --- a/src/qt_common/util/game.h +++ b/src/qt_common/util/game.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef QT_GAME_UTIL_H -#define QT_GAME_UTIL_H +#pragma once #include #include @@ -78,5 +77,3 @@ void CreateHomeMenuShortcut(ShortcutTarget target); [[nodiscard]] bool SaveIconToFile(const std::filesystem::path& icon_path, const QImage& image); } // namespace QtCommon::Game - -#endif // QT_GAME_UTIL_H diff --git a/src/qt_common/util/meta.h b/src/qt_common/util/meta.h index ae6dbc49d8..d408b5759c 100644 --- a/src/qt_common/util/meta.h +++ b/src/qt_common/util/meta.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef QT_META_H -#define QT_META_H +#pragma once #include @@ -12,4 +11,3 @@ namespace QtCommon::Meta { void RegisterMetaTypes(); } // namespace QtCommon::Meta -#endif // QT_META_H diff --git a/src/qt_common/util/path.h b/src/qt_common/util/path.h index aff0009f34..ba77625226 100644 --- a/src/qt_common/util/path.h +++ b/src/qt_common/util/path.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef QT_PATH_UTIL_H -#define QT_PATH_UTIL_H +#pragma once #include #include "common/common_types.h" @@ -10,5 +9,3 @@ namespace QtCommon::Path { bool OpenShaderCache(u64 program_id, QObject* parent); } - -#endif // QT_PATH_UTIL_H diff --git a/src/qt_common/util/rom.h b/src/qt_common/util/rom.h index 5ceadaf46b..6ea5082082 100644 --- a/src/qt_common/util/rom.h +++ b/src/qt_common/util/rom.h @@ -1,16 +1,11 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef QT_ROM_UTIL_H -#define QT_ROM_UTIL_H +#pragma once #include #include "qt_common/qt_common.h" namespace QtCommon::ROM { - -bool RomFSRawCopy(size_t total_size, size_t& read_size, QtProgressCallback callback, - const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest, bool full); - +bool RomFSRawCopy(size_t total_size, size_t& read_size, QtProgressCallback callback, const FileSys::VirtualDir& src, const FileSys::VirtualDir& dest, bool full); } -#endif // QT_ROM_UTIL_H diff --git a/src/video_core/smaa_area_tex.h b/src/video_core/smaa_area_tex.h index 40d0941c26..486ff3e3e0 100644 --- a/src/video_core/smaa_area_tex.h +++ b/src/video_core/smaa_area_tex.h @@ -5,8 +5,7 @@ // SPDX-FileCopyrightText: 2013 Diego Gutierrez (diegog@unizar.es) // SPDX-License-Identifier: MIT -#ifndef AREATEX_H -#define AREATEX_H +#pragma once #define AREATEX_WIDTH 160 #define AREATEX_HEIGHT 560 @@ -11219,5 +11218,3 @@ static const unsigned char areaTexBytes[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -#endif diff --git a/src/video_core/smaa_search_tex.h b/src/video_core/smaa_search_tex.h index 61939e2046..3e24d4df6e 100644 --- a/src/video_core/smaa_search_tex.h +++ b/src/video_core/smaa_search_tex.h @@ -5,8 +5,7 @@ // SPDX-FileCopyrightText: 2013 Diego Gutierrez (diegog@unizar.es) // SPDX-License-Identifier: MIT -#ifndef SEARCHTEX_H -#define SEARCHTEX_H +#pragma once #define SEARCHTEX_WIDTH 64 #define SEARCHTEX_HEIGHT 16 @@ -84,5 +83,3 @@ static const unsigned char searchTexBytes[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - -#endif diff --git a/src/yuzu/data_dialog.h b/src/yuzu/data_dialog.h index 2915f00848..b780debdff 100644 --- a/src/yuzu/data_dialog.h +++ b/src/yuzu/data_dialog.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef DATA_DIALOG_H -#define DATA_DIALOG_H +#pragma once #include #include "frontend_common/data_manager.h" @@ -47,5 +46,3 @@ private: std::optional selectProfile(); }; - -#endif // DATA_DIALOG_H diff --git a/src/yuzu/migration_dialog.h b/src/yuzu/migration_dialog.h index a2a2c80358..1cd0f75760 100644 --- a/src/yuzu/migration_dialog.h +++ b/src/yuzu/migration_dialog.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef MIGRATION_DIALOG_H -#define MIGRATION_DIALOG_H +#pragma once #include #include @@ -29,5 +28,3 @@ private: QAbstractButton* m_clickedButton; }; - -#endif // MIGRATION_DIALOG_H diff --git a/src/yuzu/migration_worker.h b/src/yuzu/migration_worker.h index 42abedb9c8..0a8a5b8275 100644 --- a/src/yuzu/migration_worker.h +++ b/src/yuzu/migration_worker.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef MIGRATION_WORKER_H -#define MIGRATION_WORKER_H +#pragma once #include #include "common/fs/path_util.h" @@ -73,5 +72,3 @@ private: MigrationStrategy strategy; QString success_text = tr("Data was migrated successfully."); }; - -#endif // MIGRATION_WORKER_H diff --git a/src/yuzu/ryujinx_dialog.h b/src/yuzu/ryujinx_dialog.h index c067499cc1..e668cf5ca0 100644 --- a/src/yuzu/ryujinx_dialog.h +++ b/src/yuzu/ryujinx_dialog.h @@ -1,8 +1,7 @@ // SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef RYUJINX_DIALOG_H -#define RYUJINX_DIALOG_H +#pragma once #include #include @@ -28,5 +27,3 @@ private: std::filesystem::path m_eden; std::filesystem::path m_ryu; }; - -#endif // RYUJINX_DIALOG_H diff --git a/tools/cpp-lint.sh b/tools/cpp-lint.sh new file mode 100755 index 0000000000..9b07976464 --- /dev/null +++ b/tools/cpp-lint.sh @@ -0,0 +1,40 @@ +#!/bin/sh -ex + +# SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +# tools/../ +ROOTDIR=$(CDPATH='' cd -- "$(dirname -- "$0")/../" && pwd) + +die() { + echo "-- $*" >&2 + exit 1 +} + +usage() { + cat <