From 1205a4b77401eeb2270fe25193286066bb59d173 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 14 Nov 2019 11:47:08 +0100 Subject: New loplugin:consttobool ...to: "Find implicit conversions from non-'bool' constants (e.g., 'sal_False') to 'bool'". Due to how FALSE is defined as just #define FALSE (0) (i.e., a literal of type 'int') but TRUE is defined as #define TRUE (!FALSE) (i.e., an implicit conversion from 'int' to 'bool') in GLib (see the comment in ConstToBool::VisitImplicitCastExpr), we get more warnings about uses of 'TRUE' than of 'FALSE'. For example, in libreofficekit/source/gtk/lokdocview.cxx there is a warning about the 'TRUE' in g_main_context_iteration(nullptr, TRUE); but not about the 'FALSE' in g_main_context_iteration(nullptr, FALSE); (where the parameter of 'g_main_context_iteration' is of type 'gboolean'). Lets live with that asymmetry for now... (Besides the issues addressed directly in this commit, it also found the two bogus asserts at 7e09d08807b5ba2fd8b9831557752a415bdad562 "Fix useless assert(true) (which would never fire)" and 122a0be8ae480473bd1d7f35e197a2529f4621e3 "Fix useless assert(true) (which would never fire)", plus 5f0d6df7f57ae281fe161e61c7f25d67453fddd2 "Use two-argument form of static_assert".) Change-Id: Id77322de9f94b85a7b65608a03e0e9865d14467b Reviewed-on: https://gerrit.libreoffice.org/82667 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- solenv/CompilerTest_compilerplugins_clang.mk | 1 + 1 file changed, 1 insertion(+) (limited to 'solenv') diff --git a/solenv/CompilerTest_compilerplugins_clang.mk b/solenv/CompilerTest_compilerplugins_clang.mk index 6766e3821bf2..226d0686dd52 100644 --- a/solenv/CompilerTest_compilerplugins_clang.mk +++ b/solenv/CompilerTest_compilerplugins_clang.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CompilerTest_add_exception_objects,compilerplugins_clang, \ $(if $(filter-out WNT,$(OS)),compilerplugins/clang/test/constfields) \ compilerplugins/clang/test/constparams \ compilerplugins/clang/test/constmethod \ + compilerplugins/clang/test/consttobool \ compilerplugins/clang/test/constvars \ compilerplugins/clang/test/convertlong \ compilerplugins/clang/test/cppunitassertequals \ -- cgit