drm_hwcomposer: Enable misc-use-internal-linkage clang-tidy check
... and fix the following warning:
hwc3/ComposerResources.cpp:30:56: error: function 'ToHwc2Display' can be
made static or moved into an anonymous namespace to enforce internal
linkage [misc-use-internal-linkage,-warnings-as-errors]
Change-Id: I97dcfcf6db3ad3bcf9379f0f896a66b377a730c8
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/.ci/Makefile b/.ci/Makefile
index f5cfa03..4020757 100644
--- a/.ci/Makefile
+++ b/.ci/Makefile
@@ -57,7 +57,6 @@
-readability-avoid-unconditional-preprocessor-if \
-modernize-type-traits \
-readability-static-accessed-through-instance \
- -misc-use-internal-linkage \
-performance-avoid-endl \
TIDY_CHECKS_NORMAL := \
diff --git a/hwc3/ComposerResources.cpp b/hwc3/ComposerResources.cpp
index ae0edf4..5e19082 100644
--- a/hwc3/ComposerResources.cpp
+++ b/hwc3/ComposerResources.cpp
@@ -25,20 +25,21 @@
#include "hardware/hwcomposer2.h"
#include "hwc3/Utils.h"
+namespace {
+using Hwc2Display = ::android::hardware::graphics::composer::V2_1::Display;
+using Hwc2Layer = ::android::hardware::graphics::composer::V2_1::Layer;
+
+auto ToHwc2Display(uint64_t display_id) -> Hwc2Display {
+ return static_cast<Hwc2Display>(display_id);
+}
+
+auto ToHwc2Layer(int64_t layer_id) -> Hwc2Layer {
+ return static_cast<Hwc2Layer>(layer_id);
+}
+} // namespace
+
namespace aidl::android::hardware::graphics::composer3::impl {
-::android::hardware::graphics::composer::V2_1::Display ToHwc2Display(
- uint64_t display_id) {
- return static_cast<::android::hardware::graphics::composer::V2_1::Display>(
- display_id);
-}
-
-::android::hardware::graphics::composer::V2_1::Layer ToHwc2Layer(
- int64_t layer_id) {
- return static_cast<::android::hardware::graphics::composer::V2_1::Layer>(
- layer_id);
-}
-
std::unique_ptr<ComposerResourceReleaser>
ComposerResources::CreateResourceReleaser(bool is_buffer) {
return std::make_unique<ComposerResourceReleaser>(is_buffer);