Fix loplugin:fakebool (clang-cl)

Desktop / LibreOffice - Stephan Bergmann [redhat.com] - 19 November 2019 17:30 EST

...where it failed with

> [build CXX] setup_native/source/win32/customactions/sellang/sorttree.cxx > C:/lo-clang/core/setup_native/source/win32/customactions/sellang/sorttree.cxx(43,5): error: CStyleCastExpr, suspicious cast from 'LRESULT' (aka 'long long') to 'BOOL' (aka 'int') [loplugin:fakebool] > TreeView_SortChildren(hwndTV, dicts, TRUE); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/um\commctrl.h(5227,5): note: expanded from macro 'TreeView_SortChildren' > (BOOL)SNDMSG((hwnd), TVM_SORTCHILDREN, (WPARAM)(recurse), (LPARAM)(HTREEITEM)(hitem)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/lo-clang/core/setup_native/source/win32/customactions/sellang/sorttree.cxx(43,5): error: conversion from 'LRESULT' (aka 'long long') to 'BOOL' (aka 'int') [loplugin:fakebool] > TreeView_SortChildren(hwndTV, dicts, TRUE); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/um\commctrl.h(5227,11): note: expanded from macro 'TreeView_SortChildren' > (BOOL)SNDMSG((hwnd), TVM_SORTCHILDREN, (WPARAM)(recurse), (LPARAM)(HTREEITEM)(hitem)) > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/PROGRA~2/WI3CF2~1/10/Include/10.0.18362.0/um\prsht.h(73,16): note: expanded from macro 'SNDMSG' > #define SNDMSG ::SendMessage > ^

(And the improved check in FakeBool::VisitImplicitCastExpr nicely removes the need to list all the individual false/true macros.)

Change-Id: I815172f32f493bba336008aaacc00545e61ada7b Reviewed-on: https://gerrit.libreoffice.org/83215

d273ea2a4388 Fix loplugin:fakebool (clang-cl)
compilerplugins/clang/fakebool.cxx | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)

Upstream: cgit.freedesktop.org


  • Share