[gjs/cppcheck-fix: 1/4] maint: Avoid bogus cppcheck warning about returning integer as pointer
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/cppcheck-fix: 1/4] maint: Avoid bogus cppcheck warning about returning integer as pointer
- Date: Wed, 25 Aug 2021 06:33:59 +0000 (UTC)
commit 558fce2dc2160adcead07129b6ff898a5afa67ba
Author: Philip Chimento <philip chimento gmail com>
Date: Fri Mar 12 11:07:44 2021 -0800
maint: Avoid bogus cppcheck warning about returning integer as pointer
cppcheck does not know that gboolean is treated as a bool and is not a
regular integer type, so add an explicit cast to type T.
gi/arg-inl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gi/arg-inl.h b/gi/arg-inl.h
index 583980fa..19de766b 100644
--- a/gi/arg-inl.h
+++ b/gi/arg-inl.h
@@ -146,7 +146,7 @@ template <typename T, GITypeTag TAG = GI_TYPE_TAG_VOID>
[[nodiscard]] inline T gjs_arg_get(GIArgument* arg) {
if constexpr (std::is_same_v<T, bool> ||
(std::is_same_v<T, gboolean> && TAG == GI_TYPE_TAG_BOOLEAN))
- return !!gjs_arg_member<T, TAG>(arg);
+ return T(!!gjs_arg_member<T, TAG>(arg));
return gjs_arg_member<T, TAG>(arg);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]