Skip to content

Commit

Permalink
clang-tidy-18
Browse files Browse the repository at this point in the history
  • Loading branch information
krupkat committed Sep 22, 2024
1 parent 4c0e0d6 commit 3b28b6a
Show file tree
Hide file tree
Showing 28 changed files with 75 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ HeaderFilterRegex: "xpano.*xpano.*"

CheckOptions:
- key: misc-include-cleaner.IgnoreHeaders
value: SDL.*;opencv2.*;exiv2.*;spdlog/fmt/.*
value: SDL.*;opencv2.*;exiv2.*;spdlog.*;nfd.*
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ClassMemberCase
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:

jobs:
clang-tidy-check:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion misc/scripts/tidy.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
run-clang-tidy-15 `pwd`/xpano `pwd`/tests -p=build -quiet
run-clang-tidy-18 `pwd`/xpano `pwd`/tests -p=build -quiet
1 change: 1 addition & 0 deletions tests/stitcher_pipeline_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <catch2/matchers/catch_matchers_floating_point.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include <catch2/matchers/catch_matchers_vector.hpp>

#include "xpano/algorithm/algorithm.h"
#include "xpano/pipeline/options.h"
#include "xpano/utils/vec.h"
Expand Down
1 change: 1 addition & 0 deletions xpano/algorithm/blenders.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <vector>

#ifdef XPANO_WITH_MULTIBLEND
#include <mb/image.h>
#include <mb/multiblend.h>
#endif

Expand Down
16 changes: 11 additions & 5 deletions xpano/algorithm/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include <array>
#include <cstdint>

#include "xpano/constants.h"

Expand All @@ -12,7 +13,7 @@ namespace xpano::algorithm {
// Bump kOptionsVersion in xpano/pipeline/options.h when changing the
// definitions

enum class ProjectionType {
enum class ProjectionType : std::uint8_t {
kPerspective,
kCylindrical,
kSpherical,
Expand All @@ -24,16 +25,21 @@ enum class ProjectionType {
kTransverseMercator
};

enum class FeatureType { kSift, kOrb };
enum class FeatureType : std::uint8_t { kSift, kOrb };

enum class WaveCorrectionType { kOff, kAuto, kHorizontal, kVertical };
enum class WaveCorrectionType : std::uint8_t {
kOff,
kAuto,
kHorizontal,
kVertical
};

enum class InpaintingMethod {
enum class InpaintingMethod : std::uint8_t {
kNavierStokes,
kTelea,
};

enum class BlendingMethod { kOpenCV, kMultiblend };
enum class BlendingMethod : std::uint8_t { kOpenCV, kMultiblend };

const char* Label(ProjectionType projection_type);
const char* Label(FeatureType feature_type);
Expand Down
3 changes: 2 additions & 1 deletion xpano/algorithm/progress.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
#pragma once

#include <atomic>
#include <cstdint>

namespace xpano::algorithm {

enum class ProgressType {
enum class ProgressType : std::uint8_t {
kNone,
kLoadingImages,
kStitchingPano,
Expand Down
3 changes: 2 additions & 1 deletion xpano/algorithm/stitcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

#pragma once

#include <cstdint>
#include <vector>

#include <opencv2/core.hpp>
Expand All @@ -59,7 +60,7 @@

namespace xpano::algorithm::stitcher {

enum class Status {
enum class Status : std::uint8_t {
kSuccess,
kSuccessResolutionCapped,
kCancelled,
Expand Down
3 changes: 3 additions & 0 deletions xpano/cli/pano_cli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include "xpano/version_fmt.h"

#ifdef _WIN32
#include <consoleapi.h>
#include <minwindef.h>

#include "xpano/cli/windows_console.h"
#endif

Expand Down
3 changes: 2 additions & 1 deletion xpano/cli/pano_cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

#pragma once

#include <cstdint>
#include <optional>
#include <utility>

#include "xpano/cli/args.h"

namespace xpano::cli {

enum class ResultType {
enum class ResultType : std::uint8_t {
kSuccess,
kError,
kForwardToGui,
Expand Down
3 changes: 2 additions & 1 deletion xpano/cli/signal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
#include "xpano/cli/signal.h"

#ifdef _WIN32
#include <windows.h>
#include <consoleapi.h>
#include <minwindef.h>

#include <spdlog/spdlog.h>
#else
Expand Down
13 changes: 8 additions & 5 deletions xpano/cli/windows_console.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@

#include "xpano/cli/windows_console.h"

#include <cstdio>
#include <windows.h>

#include <windows.h> // IWYU pragma: keep
//
#include <consoleapi.h>
#include <processenv.h>
#include <stdio.h> // NOLINT(modernize-deprecated-headers)
#include <WinBase.h>

namespace xpano::cli::windows {

// This is needed to redirect stdout to the console on Windows, because we are
// building with the WIN32 subsystem (app with no console window).

Attach::Attach() {
if (AttachConsole(ATTACH_PARENT_PROCESS)) {
if (AttachConsole(ATTACH_PARENT_PROCESS) != 0) {
attached_console_ = true;
freopen_s(&attached_stdout_, "CONOUT$", "w", stdout);

Expand All @@ -23,7 +26,7 @@ Attach::Attach() {
}

Attach::~Attach() {
if (attached_stdout_) {
if (attached_stdout_ != nullptr) {
fflush(attached_stdout_);
fclose(attached_stdout_);
}
Expand Down
3 changes: 2 additions & 1 deletion xpano/gui/action.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#pragma once

#include <algorithm>
#include <cstdint>
#include <filesystem>
#include <iterator>
#include <variant>
Expand All @@ -16,7 +17,7 @@

namespace xpano::gui {

enum class ActionType {
enum class ActionType : std::uint8_t {
kNone,
kCancelPipeline,
kToggleCrop,
Expand Down
3 changes: 2 additions & 1 deletion xpano/gui/file_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <cstdint>
#include <filesystem>
#include <string>
#include <vector>
Expand All @@ -14,7 +15,7 @@

namespace xpano::gui::file_dialog {

enum class ErrorType {
enum class ErrorType : std::uint8_t {
kUserCancelled,
kTargetNotDirectory,
kUnsupportedExtension,
Expand Down
1 change: 1 addition & 0 deletions xpano/gui/panels/log_pane.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "xpano/gui/panels/log_pane.h"

#include <imgui.h>

#include "xpano/log/logger.h"

namespace xpano::gui {
Expand Down
7 changes: 4 additions & 3 deletions xpano/gui/panels/preview_pane.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include <array>
#include <cstdint>
#include <optional>
#include <string>

Expand All @@ -20,17 +21,17 @@

namespace xpano::gui {

enum class ImageType {
enum class ImageType : std::uint8_t {
kNone,
kSingleImage,
kMatch,
kPanoPreview,
kPanoFullRes
};

enum class CropMode { kInitial, kEnabled, kDisabled };
enum class CropMode : std::uint8_t { kInitial, kEnabled, kDisabled };

enum class RotateMode { kEnabled, kDisabled };
enum class RotateMode : std::uint8_t { kEnabled, kDisabled };

class PreviewPane {
public:
Expand Down
5 changes: 3 additions & 2 deletions xpano/gui/panels/thumbnail_pane.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <cstdint>
#include <vector>

#include <imgui.h>
Expand Down Expand Up @@ -33,7 +34,7 @@ class HoverChecker {
};

class AutoScroller {
enum class ScrollType {
enum class ScrollType : std::uint8_t {
kNone,
kRatio,
kAbsolute,
Expand All @@ -52,7 +53,7 @@ class AutoScroller {

class ResizeChecker {
public:
enum class Status {
enum class Status : std::uint8_t {
kIdle,
kResizing,
kResized,
Expand Down
5 changes: 3 additions & 2 deletions xpano/gui/panels/warning_pane.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#pragma once

#include <cstdint>
#include <optional>
#include <queue>
#include <string>
Expand All @@ -14,7 +15,7 @@

namespace xpano::gui {

enum class WarningType {
enum class WarningType : std::uint8_t {
kNone,
kWarnInputConversion,
kFirstTimeLaunch,
Expand All @@ -29,7 +30,7 @@ enum class WarningType {

struct Warning {
WarningType type = WarningType::kNone;
std::string extra_message = {};
std::string extra_message;
};

class WarningPane {
Expand Down
3 changes: 2 additions & 1 deletion xpano/gui/pano_gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#pragma once

#include <cstdint>
#include <future>
#include <optional>
#include <string>
Expand Down Expand Up @@ -33,7 +34,7 @@ struct StatusMessage {
std::string tooltip;
};

enum class SelectionType {
enum class SelectionType : std::uint8_t {
kNone,
kImage,
kMatch,
Expand Down
11 changes: 10 additions & 1 deletion xpano/gui/shortcut.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
// SPDX-FileCopyrightText: 2023 Tomas Krupka
// SPDX-License-Identifier: GPL-3.0-or-later

#include <cstdint>

#include "xpano/gui/action.h"

namespace xpano::gui {

enum class ShortcutType { kOpen, kExport, kDebug, kReset, kRotate, kCrop };
enum class ShortcutType : std::uint8_t {
kOpen,
kExport,
kDebug,
kReset,
kRotate,
kCrop
};

const char* Label(ShortcutType type);

Expand Down
4 changes: 2 additions & 2 deletions xpano/gui/widgets/widgets.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

#pragma once


#include <opencv2/core.hpp>
#include <opencv2/stitching/detail/warpers.hpp>


namespace xpano::gui::widgets {

// NOLINTNEXTLINE(performance-enum-size)
enum class EdgeType : int {
kTop = 1,
kBottom = 2,
Expand Down
5 changes: 3 additions & 2 deletions xpano/pipeline/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma once

#include <array>
#include <cstdint>

#include "xpano/algorithm/options.h"
#include "xpano/constants.h"
Expand All @@ -17,7 +18,7 @@ namespace xpano::pipeline {
// - Will result in reloading the default values when loading the config.
constexpr int kOptionsVersion = 5;

enum class ChromaSubsampling {
enum class ChromaSubsampling : std::uint8_t {
k444,
k422,
k420,
Expand All @@ -28,7 +29,7 @@ const char *Label(ChromaSubsampling subsampling);
const auto kSubsamplingModes = std::array{
ChromaSubsampling::k444, ChromaSubsampling::k422, ChromaSubsampling::k420};

enum class MatchingType { kNone, kSinglePano, kAuto };
enum class MatchingType : std::uint8_t { kNone, kSinglePano, kAuto };

const char *Label(MatchingType type);

Expand Down
Loading

0 comments on commit 3b28b6a

Please sign in to comment.