• Stephan Bergmann's avatar
    Enable loplugin:cstylecast for some more cases · cab0427c
    Stephan Bergmann yazdı
    ...mostly of C-style casts among arithmetic types, and automatically rewrite
    those into either static_cast or a functional cast (which should have identical
    semantics, but where the latter probably looks better for simple cases like
    casting a literal to a specific type, as in "sal_Int32(0)" vs.
    "static_cast<sal_Int32>(0)").
    
    The main benefit of reducing the amount of C-style casts across the code base
    further is so that other plugins (that have not been taught about the complex
    semantics of C-style cast) can pick those up (cf. the various recent
    "loplugin:redundantcast" commits, which address those findings after this
    improved loplugin:cstylecast has been run).  Also, I found some places where
    a C-style cast has probably been applied only to the first part of a larger
    expression in error (because it's easy to forget parentheses in cases like
    "(sal_uInt16)VOPT_CLIPMARKS+1"); I'll follow up on those individually.
    
    The improved loplugin:cstylecast is careful to output either "(performs:
    static_cast)" or "(performs: functional cast)", so that
    compilerplugins/clang/test/cstylecast.cxx can check that the plugin would
    automatically rewrite to one or the other form.
    
    To allow fully-automatic rewriting, this also required loplugin:unnecessaryparen
    to become a rewriting plugin, at least for the parens-around-cast case (where
    "((foo)bar)" first gets rewritten to "(static_cast<foo>(bar))", then to
    "static_cast<foo>(bar)".  Rewriting could probably be added to other cases of
    loplugin:unnecessaryparen in the future, too.
    
    (The final version of this patch would even have been able to cope with
    361dd257 "Replace some C-style casts in ugly
    macros with static_cast", so that manual change would not have been necessary
    after all.)
    
    Change-Id: Icd7e319cc38eb58262fcbf7643d177ac9ea0220a
    Reviewed-on: https://gerrit.libreoffice.org/47798Tested-by: 's avatarJenkins <ci@libreoffice.org>
    Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
    cab0427c
Adı
Son kayıt (commit)
Son güncelleme
..
store Loading commit data...
test Loading commit data...
automem.cxx Loading commit data...
badstatics.cxx Loading commit data...
blockblock.cxx Loading commit data...
casttovoid.cxx Loading commit data...
charrightshift.cxx Loading commit data...
check.cxx Loading commit data...
check.hxx Loading commit data...
checkconfigmacros.cxx Loading commit data...
checkunusedparams.cxx Loading commit data...
commaoperator.cxx Loading commit data...
comparisonwithconstant.cxx Loading commit data...
compat.hxx Loading commit data...
constantparam.bitmask.results Loading commit data...
constantparam.booleans.results Loading commit data...
constantparam.constructors.results Loading commit data...
constantparam.cxx Loading commit data...
constantparam.numbers.results Loading commit data...
constantparam.py Loading commit data...
constparams.cxx Loading commit data...
conststringvar.cxx Loading commit data...
convertlong.cxx Loading commit data...
countusersofdefaultparams.cxx Loading commit data...
countusersofdefaultparams.py Loading commit data...
cppunitassertequals.cxx Loading commit data...
cstylecast.cxx Loading commit data...
datamembershadow.cxx Loading commit data...
derefnullptr.cxx Loading commit data...
dllprivate.cxx Loading commit data...
dodgyswitch.cxx Loading commit data...
dyncastvisibility.cxx Loading commit data...
dynexcspec.cxx Loading commit data...
expandablemethods.cxx Loading commit data...
expandablemethods.py Loading commit data...
expressionalwayszero.cxx Loading commit data...
externandnotdefined.cxx Loading commit data...
externvar.cxx Loading commit data...
faileddyncast.cxx Loading commit data...
finalclasses.cxx Loading commit data...
finalclasses.py Loading commit data...
finalprotected.cxx Loading commit data...
flatten.cxx Loading commit data...
fragiledestructor.cxx Loading commit data...
functionaddress.hxx Loading commit data...
getimplementationname.cxx Loading commit data...
implicitboolconversion.cxx Loading commit data...
includeform.cxx Loading commit data...
inlinefields.cxx Loading commit data...
inlinefields.py Loading commit data...
inlinesimplememberfunctions.cxx Loading commit data...
inlinevisible.cxx Loading commit data...
literaltoboolconversion.cxx Loading commit data...
loopvartoosmall.cxx Loading commit data...
memoryvar.cxx Loading commit data...
mergeclasses.cxx Loading commit data...
mergeclasses.py Loading commit data...
mergeclasses.results Loading commit data...
nullptr.cxx Loading commit data...
oncevar.cxx Loading commit data...
oslendian.cxx Loading commit data...
override.cxx Loading commit data...
overrideparam.cxx Loading commit data...
passparamsbyref.cxx Loading commit data...
passstuffbyref.cxx Loading commit data...
plugin.cxx Loading commit data...
plugin.hxx Loading commit data...
pluginhandler.cxx Loading commit data...
pluginhandler.hxx Loading commit data...
privatebase.cxx Loading commit data...
ptrvector.cxx Loading commit data...
rangedforcopy.cxx Loading commit data...
redundantcast.cxx Loading commit data...
redundantcopy.cxx Loading commit data...
redundantinline.cxx Loading commit data...
redundantpointerops.cxx Loading commit data...
refcounting.cxx Loading commit data...
rendercontext.cxx Loading commit data...
reservedid.cxx Loading commit data...
salbool.cxx Loading commit data...
salcall.cxx Loading commit data...
sallogareas.cxx Loading commit data...
sallogareas.hxx Loading commit data...
salunicodeliteral.cxx Loading commit data...
sfxpoolitem.cxx Loading commit data...
simplifybool.cxx Loading commit data...
simplifydynamiccast.cxx Loading commit data...
singlevalfields.cxx Loading commit data...
singlevalfields.py Loading commit data...
singlevalfields.results Loading commit data...
staticaccess.cxx Loading commit data...
staticanonymous.cxx Loading commit data...
staticmethods.cxx Loading commit data...
stringconcat.cxx Loading commit data...
stringconstant.cxx Loading commit data...
stringstatic.cxx Loading commit data...
subtlezeroinit.cxx Loading commit data...
unicodetochar.cxx Loading commit data...
unnecessarycatchthrow.cxx Loading commit data...
unnecessaryoverride.cxx Loading commit data...
unnecessaryparen.cxx Loading commit data...
unnecessaryvirtual.cxx Loading commit data...
unnecessaryvirtual.py Loading commit data...
unnecessaryvirtual.results Loading commit data...
unoany.cxx Loading commit data...
unreffun.cxx Loading commit data...
unusedenumconstants.cxx Loading commit data...
unusedenumconstants.py Loading commit data...
unusedenumconstants.readonly.results Loading commit data...
unusedenumconstants.untouched.results Loading commit data...
unusedenumconstants.writeonly.results Loading commit data...
unusedfields.cxx Loading commit data...
unusedfields.py Loading commit data...
unusedfields.readonly.results Loading commit data...
unusedfields.untouched.results Loading commit data...
unusedfields.writeonly.results Loading commit data...
unusedfieldsremove.cxx Loading commit data...
unusedindex.cxx Loading commit data...
unusedmethods.cxx Loading commit data...
unusedmethods.py Loading commit data...
unusedmethods.results Loading commit data...
unusedmethods.unused-returns.results Loading commit data...
unusedmethodsremove.cxx Loading commit data...
unusedvariablecheck.cxx Loading commit data...
unusedvariablecheck.hxx Loading commit data...
useuniqueptr.cxx Loading commit data...
vclwidgets.cxx Loading commit data...
weakobject.cxx Loading commit data...