drm_hwcomposer: clang-tidy: enable cppcoreguidelines-* checks
Our code isn't ready for the following checks therefore keep disabled
-cppcoreguidelines-pro-bounds-array-to-pointer-decay
-cppcoreguidelines-pro-bounds-constant-array-index
-cppcoreguidelines-pro-bounds-pointer-arithmetic
-cppcoreguidelines-pro-type-cstyle-cast
-cppcoreguidelines-pro-type-vararg
-cppcoreguidelines-avoid-magic-numbers
-cppcoreguidelines-macro-usage
-cppcoreguidelines-avoid-c-arrays
+ fixed existing tidy warnings for these checks.
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/drm/VSyncWorker.cpp b/drm/VSyncWorker.cpp
index 9756a6a..e9f4f9c 100644
--- a/drm/VSyncWorker.cpp
+++ b/drm/VSyncWorker.cpp
@@ -53,7 +53,7 @@
hwc2_function_pointer_t hook) {
Lock();
vsync_callback_data_ = data;
- vsync_callback_hook_ = reinterpret_cast<HWC2_PFN_VSYNC>(hook);
+ vsync_callback_hook_ = (HWC2_PFN_VSYNC)hook;
Unlock();
}
@@ -90,7 +90,7 @@
static const int64_t kOneSecondNs = 1 * 1000 * 1000 * 1000;
int VSyncWorker::SyntheticWaitVBlank(int64_t *timestamp) {
- struct timespec vsync;
+ struct timespec vsync {};
int ret = clock_gettime(CLOCK_MONOTONIC, &vsync);
if (ret)
return ret;
@@ -119,7 +119,7 @@
}
void VSyncWorker::Routine() {
- int ret;
+ int ret = 0;
Lock();
if (!enabled_) {
@@ -147,7 +147,7 @@
DRM_VBLANK_RELATIVE | (high_crtc & DRM_VBLANK_HIGH_CRTC_MASK));
vblank.request.sequence = 1;
- int64_t timestamp;
+ int64_t timestamp = 0;
ret = drmWaitVBlank(drm_->fd(), &vblank);
if (ret == -EINTR)
return;