Warn when RAII lock returned from function is discarded

Discarding RAII lock returned from function almost always
is a bug. This change introduces usage of [[no_discard]]
attribute from C++17 to prevent such misues.

Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:
Patryk Wrobel
2022-09-01 15:54:57 +00:00
committed by Compute-Runtime-Automation
parent d672920121
commit 90ba50bf52
15 changed files with 23 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Intel Corporation
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -71,7 +71,7 @@ class AubSubCaptureManager {
MOCKABLE_VIRTUAL std::string generateFilterFileName() const;
MOCKABLE_VIRTUAL std::string generateToggleFileName(const std::string &kernelName) const;
bool isKernelIndexInSubCaptureRange(uint32_t kernelIdx, uint32_t rangeStartIdx, uint32_t rangeEndIdx) const;
MOCKABLE_VIRTUAL std::unique_lock<std::mutex> lock() const;
[[nodiscard]] MOCKABLE_VIRTUAL std::unique_lock<std::mutex> lock() const;
bool subCaptureIsActive = false;
bool subCaptureWasActiveInPreviousEnqueue = false;