summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/badstatics.cxx
AgeCommit message (Collapse)Author
2022-05-31jsdialog: introduce popup managementSzymon Kłos
Popup windows are managed by vcl (some moving between parents happens on show/hide popup). We need to access correct popup window to correctly close popup in LOK. So remember popup instances. Change-Id: I9e1ba18ded5a1bf675f95bd7178043eebd9bbd5a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134576 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Mert Tumer <mert.tumer@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134675 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135197 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2021-11-30Silence loplugin:badstaticsStephan Bergmann
> /Users/stephan/lo/core/vcl/osx/a11yfocustracker.cxx:40:33: error: bad static variable causes crash on shutdown [loplugin:badstatics] > static AquaA11yFocusTracker SINGLETON; > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~ > /Users/stephan/lo/core/vcl/inc/osx/a11yfocustracker.hxx:85:35: note: ... due to this member of 'AquaA11yFocusTracker' [loplugin:badstatics] > std::set<VclPtr<vcl::Window>> m_aDocumentWindowList; > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ Change-Id: I7fd0b1808e5433bab6e1436c345044a5ce804f4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126115 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-11-22sw: prefix members of SwDBManager, SwWebGlosDocShell, SwWordCountWrapper ...Miklos Vajna
... and SwZoomControl See tdf#94879 for motivation. Change-Id: I74f31e45a8c215d406371a23b64d548fbb851d28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125641 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
2021-09-02loplugin:badstaticsNoel Grandin
whitelist another that started showing up when I built clang from recent trunk Change-Id: I37cb3a430a72df7e39e1ef8a5cf5f51383b4eaf9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121493 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-23no need to allocate these static vars on demandNoel Grandin
the constructor can be laid out at compile/link time Change-Id: I377a537e15199ae81394d76ac662576280a25c25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119362 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-27tdf#47065 Add new file open UI options and implement a new threadMatt K
Add new UI options when opening a locked or non-writeable document to allow the user to be notified when such a document becomes editable . If the user selects "Notify", then that document is added to a list of open documents to be checked by a thread every 60 seconds for read/write access and whether lock file is available/obtainable. If access is allowed for a document, then show UI dialog to the user asking to Reload that document. If Reload is selected by the user then that document is reloaded with read/write access. The checking thread is spawned only once no matter how many "Notify" documents there are. The thread is spawned if not already running when a new "Notify" document is opened, and it terminates when all "Notify" documents have been closed or the application terminates. Also update badstatics clang plugin to ignore new global variables introduced. Change-Id: I7555ce6f5df79c2c87216e0129ef3b2883c7d921 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111654 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-05-10rename to remove the gtk3 prefixCaolán McNamara
Change-Id: I219798ed42aff11d09fd45c26ca1a018c2d22c08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115239 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-08-12use unique_ptr for ScGlobal::pFieldEditEngineNoel Grandin
Change-Id: Ic9894f9fb77ee270a3c09c0a3b5a008331016295 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100562 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-03notebookbar: allow to create multiple instances for onlineSzymon Kłos
Change-Id: Ic8a3d07ec6ec5a5d6d56a3958e91d3074ce1493e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96936 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97788 Tested-by: Jenkins
2020-06-19jsdialog: Remember builder connected with LOK window idSzymon Kłos
Change-Id: I9e38fe570b2296341c1694fe8128da30ba209494 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94184 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94616 Tested-by: Jenkins
2020-04-21weld FontNameBoxCaolán McNamara
with custom row rendering Change-Id: Ia909b5b9ad56b6ea4611e9ea0a1e2cb0064a8cd4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91841 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2019-11-22Extend loplugin:external to warn about classesStephan Bergmann
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend loplugin:external to warn about enums". Cases where free functions were moved into an unnamed namespace along with a class, to not break ADL, are in: filter/source/svg/svgexport.cxx sc/source/filter/excel/xelink.cxx sc/source/filter/excel/xilink.cxx svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx All other free functions mentioning moved classes appear to be harmless and not give rise to (silent, even) ADL breakage. (One remaining TODO in compilerplugins/clang/external.cxx is that derived classes are not covered by computeAffectedTypes, even though they could also be affected by ADL-breakage--- but don't seem to be in any acutal case across the code base.) For friend declarations using elaborate type specifiers, like class C1 {}; class C2 { friend class C1; }; * If C2 (but not C1) is moved into an unnamed namespace, the friend declaration must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither qualified nor a template-id and the declaration is a function or an elaborated-type-specifier, the lookup to determine whether the entity has been previously declared shall not consider any scopes outside the innermost enclosing namespace.") * If C1 (but not C2) is moved into an unnamed namespace, the friend declaration must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882> "elaborated-type-specifier friend not looked up in unnamed namespace". Apart from that, to keep changes simple and mostly mechanical (which should help avoid regressions), out-of-line definitions of class members have been left in the enclosing (named) namespace. But explicit specializations of class templates had to be moved into the unnamed namespace to appease <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of template from unnamed namespace using unqualified-id in enclosing namespace". Also, accompanying declarations (of e.g. typedefs or static variables) that could arguably be moved into the unnamed namespace too have been left alone. And in some cases, mention of affected types in blacklists in other loplugins needed to be adapted. And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is not moved into an unnamed namespace (because it is declared in sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler doesn’t give this warning for types defined in the main .C file, as those are unlikely to have multiple definitions." (<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The warned-about classes also don't have multiple definitions in the given test, so disable the warning when including the .cxx. Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4 Reviewed-on: https://gerrit.libreoffice.org/83239 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-10-01Silence a supposedly unproblematic loplugin:badstatics (clang-cl)Stephan Bergmann
Change-Id: I9c76fb4aca21757a0bf033103bd6dc2bea740eb5 Reviewed-on: https://gerrit.libreoffice.org/79932 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-09-04tdf#118314 Code clean up on imestatuswindowSzabolcs Toth
Change-Id: I8bc5a73a91f28fcfd22ef716e9cf87d53997b1ad Reviewed-on: https://gerrit.libreoffice.org/77337 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: László Németh <nemeth@numbertext.org>
2019-08-01skip some indirectionNoel Grandin
these don't need to use std::unique_ptr Change-Id: I03140c7957fd59443db932c37890a6742c6d3bec Reviewed-on: https://gerrit.libreoffice.org/76800 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-05-07loplugin:badstaticsNoel Grandin
add some more false+ which interestingly enough, only started showing up when I switched on --enable-pch=system Change-Id: I2d52644dc3665db19b28772eb818c138e063dae4
2019-04-21Fix typoAndrea Gelmini
Change-Id: Iaaea14851bb935e4ddfc4e6573356a2314ecd866 Reviewed-on: https://gerrit.libreoffice.org/71029 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2019-03-12make (some) clang plugins share the same RecursiveASTVisitorLuboš Luňák
Each plugin currently uses its own recursive AST run, which adds up. This patch adds another shared plugin which internally contains all (suitable) plugins and dispatches to them from the same one recursive run. This patch converts ~25 plugins and for starmath's accessibility.cxx reduces clang build time from 5.43s to 5.14s (and it's 4.39s without any plugins). As there are almost 50 more plugins to go, this can theoretically result in 4.56s final time, although probably not all plugins can be that easily converted, if at all. This mostly requires very little change in many plugins (see e.g. BadStatics), some even work without any functionality change (e.g. CharRightShift). Traverse* calls require some changes but are often not that difficult. WalkUp* probably can't be supported, although some plugins can(?) possibly be adjusted to not rely on them. And of course some plugins can be left as they are, using their own recursive run. See description at the top of generator.cxx for description of how to convert a plugin. The sharedvisitor.cxx source is generated based on scanning relevant plugin sources using a clang-based scanner/generator. The generated source is intentionally included instead of getting always generated, as the generating currently takes some time, so it should get updated in git whenever a change in a plugin triggers a source change in it. Change-Id: Ia0d2e3a5a464659503dbb4ed6c20b6cc89b4de01 Reviewed-on: https://gerrit.libreoffice.org/68026 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2019-03-01do not call GetFormatTable() from GetNonThreadedContext() (tdf#121949)Luboš Luňák
ScDocument dtor calls ClearLookupCaches(), which calls GetNonThreadedContext(). But ScDocument instances used for copy&paste GetFormatTable() fails on null mxPoolHelper, because ScDocument ctor doesn't set it in such a case. So set up the pointer in ScInterpreterContext on demand only if actually needed. Change-Id: If3811da5bb00a2d7d404c089ee1bf46037a2cddb Reviewed-on: https://gerrit.libreoffice.org/68350 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2018-12-28Fix typo in codeAndrea Gelmini
Change-Id: I3a4bfbd84735ddcc8d2d0754973f73a98e06c303 Reviewed-on: https://gerrit.libreoffice.org/65652 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2018-11-14make ScInterpreterContext also accessible without passing it aroundLuboš Luňák
E.g. ScModelObj::GetFormatter() can be rather deep in the call chain and it just doesn't make sense to pass ScInterpreterContext* to all the relevant places (and it's a question if it makes sense to pass it around at all, googling shows that thread_local is not really _that_ slow). Change-Id: I9114ef8a10d82a10968391718099edccde7a2663 Reviewed-on: https://gerrit.libreoffice.org/63184 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
2018-08-14filter out some of the AST in the pluginsNoel Grandin
by checking if the current namespace decl is in our code, so we have to scan less stuff, which results in a 10% perf improvement for me Change-Id: Idf0e30d57b6d0dcd13daa9ed679c28b9d233d387 Reviewed-on: https://gerrit.libreoffice.org/58942 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-04-12vcl: Add a internal (memory) manager for Graphic objectsTomaž Vajngerl
This adds vcl::graphic::Manager which is a manager singleton that tracks all the creation fo graphic objects and swaps them out on a time and allocation basis. Time based - every number of seconds it looks for Graphics that weren't used for a time. Allocation based - when creating a new Graphic and the total of Graphic uses more than the total amount of memory for Graphics defined in configuration, it tries to release the Graphics that weren't used for a time. Change-Id: I5dbf74db4a6455d32c4abcbad7be21c7f0534642 Reviewed-on: https://gerrit.libreoffice.org/52396 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2018-01-04sw: move some globals in fetab.cxx into SwFEShellMichael Stahl
It looks like the main point of these being globals is so that they can be cleared from various places when tables or table frames are destroyed. Add a SwDoc parameter to ClearFEShellTabCols() and just iterate over all shells. Change-Id: I75ad6b695ee1bfa76b9a05c606b07a3574c70ac4
2017-12-05lokdialog: Make the badstatic loplugin happy.Jan Holesovsky
Change-Id: Ic19bbd2a3533e4e600d8856e55c4e8d06f0ad752 Reviewed-on: https://gerrit.libreoffice.org/45500 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2017-11-29TODO: silence new loplugin:badstatics for nowStephan Bergmann
Change-Id: Ia57dd190a173f664b0c624617b13f2876008835a
2017-11-07Clean away temporarily added using declarationsStephan Bergmann
Change-Id: I26734c13515394162d88351a1cbe2b20abdac865
2017-09-22compilerplugins: add test for badstaticsMichael Stahl
Change-Id: Ibdb3144c0510ed723a01ca28d7cdcd6b21caec54 Reviewed-on: https://gerrit.libreoffice.org/42596 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-09-09tdf#108572 remove connections only for current shellSzymon Kłos
Also remove connections to temp files. Change-Id: Ie5c09eb365d1246e053dc52884c72687ac226f3c Reviewed-on: https://gerrit.libreoffice.org/42095 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2016-12-19vcl: separate ImplImageTree - ImageTree singleton and public ifaceTomaž Vajngerl
ImplImageTree was used outside of VCL which is not consistent with the name and the header also contains a lot of implementation detail. This separates the implementation to ImplImageTree and the public interface and singleton to ImageTree only. Change-Id: I3a26444f0f6971a6b1d83472e9cef19c93192d3e Reviewed-on: https://gerrit.libreoffice.org/32134 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2016-12-12Whitelist aLogger, in FormulaLogger& FormulaLogger::get()Tor Lillqvist
To avoid this: sc/source/core/tool/formulalogger.cxx:55:26: error: bad static variable causes crash on shutdown [loplugin:badstatics] static FormulaLogger aLogger; ~~~~~~~~~~~~~~~~~~~~~^~~~~~~ sc/inc/formulalogger.hxx:42:31: note: ... due to this member of 'FormulaLogger' [loplugin:badstatics] const ScFormulaCellGroup* mpLastGroup = nullptr; ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ sc/inc/formulacell.hxx:66:20: note: ... due to this member of 'ScFormulaCellGroup' [loplugin:badstatics] ScFormulaCell *mpTopCell; ~~~~~~~~~~~~~~~^~~~~~~~~ sc/inc/formulacell.hxx:114:21: note: ... due to this member of 'ScFormulaCell' [loplugin:badstatics] ScDocument* pDocument; ~~~~~~~~~~~~~~~~^~~~~~~~~ sc/inc/document.hxx:312:27: note: ... due to this member of 'ScDocument' [loplugin:badstatics] VclPtr<SfxPrinter> pPrinter; ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ Change-Id: I533e45f655ca928a801188aa48ee818d89a962ac
2016-10-09loplugin:badstatics: reliably look into std container typesStephan Bergmann
Change-Id: Ifca7325533e3f7d5ce5c59cc6b14d4232d4fc792 Reviewed-on: https://gerrit.libreoffice.org/29614 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-10-09loplugin:badstaticsStephan Bergmann
ScAddInListener has a member ScAddInDocs* pDocs; // documents where this is used where ScAddInDocs is set<ScDocument*>, and ScDocument has a memmber VclPtr<SfxPrinter> pPrinter; so that's only a chain of (apparently non-owning) pointers. Change-Id: I050218320eb2c588dcfaee80225f4e45a515ed32 Reviewed-on: https://gerrit.libreoffice.org/29613 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-07-29sfx2: introduce SfxViewShell::GetViewShellId()Miklos Vajna
This is quite similar to SwFrame::GetFrameId(), i.e. it assigns a numeric identifier to each instance to help debugging, as those identifiers are stable accross runs. Change-Id: I9cc57e316435f0284a1d481a956a703be859d67e Reviewed-on: https://gerrit.libreoffice.org/27669 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
2016-06-30loplugin:badstatics: new static only found with libc++Stephan Bergmann
Change-Id: I93f12629fe6aa4bddae7379a5a7ac4f4c42c7923
2016-06-30loplugin:badstatics: further (Linux-only) static only found with libc++Stephan Bergmann
Change-Id: I048212e3feb3f548d5a65940dd71ccb71cade778
2016-06-29loplugin:badstatics: whitelist some more staticsStephan Bergmann
...which use std containers and are only found at all with the libc++ container implementations, not the libstdc++ ones. Change-Id: Ic9af06139823befad4af1a9a825cba10c115aceb
2016-06-28More Clang 3.4 "(anonymous namespace)" fixesStephan Bergmann
Change-Id: I7cb43f915565dadd611b90ee30373e472f97efb5 Reviewed-on: https://gerrit.libreoffice.org/26748 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
2016-04-22Avoid reserved identifiersStephan Bergmann
Change-Id: I27ff0f4f0eb395d7e0a60dd604758c220a3134c4
2016-04-18tdf#99352 - Some VclPtrs leak past DeInitVCLNoel Grandin
Change-Id: I74b27b1d8b662a644df580ae128643b8495355f8 Reviewed-on: https://gerrit.libreoffice.org/24204 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-04-15update badstatics plugin to look for VclPtr<> staticsNoel Grandin
maybe we should create a "StaticVclPtr<>" class that checks if VCL is still "alive" before destructing the object? Change-Id: If8619f689c29294efa19c37ec782fa07acec728d Reviewed-on: https://gerrit.libreoffice.org/24085 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
2016-01-25compilerplugins: rejoice, for pStaticThesSubMenu is deadMichael Stahl
Change-Id: I6c7f250af4c1f09feb836aef3c468d97e8266e4b
2015-12-08More loplugin::TypeCheck useStephan Bergmann
Change-Id: I2f4a26a918134568f541cd45bdcf5a12b1f1d2ee
2015-11-26compilerplugins: adapt commentMiklos Vajna
...after 49c2b9808df8a6b197dec666dfc0cda6321a4306 "bin/rename-sw-abbreviations.sh" Change-Id: Ibd74246403bead8100d181b335f9145013f31e5e
2015-11-26Adapt whitelisted namesStephan Bergmann
...after 49c2b9808df8a6b197dec666dfc0cda6321a4306 "bin/rename-sw-abbreviations.sh" Change-Id: I90cec551bdc52ea4d76dd9e32b45692e8a3be70f
2015-11-17vcl, sd: rename some overly generic static variablesMichael Stahl
Change-Id: I89159df36361f9ceff3401ef379c8230465617b7
2015-11-17Fix check for std::weak_ptr (that may be in an inline namespace)Stephan Bergmann
Change-Id: I048aef08df43d07544aafc69b711d258dc40bc21
2015-11-17Work around loplguins:badstaticsStephan Bergmann
Change-Id: I597dbc3e4288acb5b71f7a344ae78ba568451614
2015-11-17Work around loplguins:badstaticsStephan Bergmann
Change-Id: I9d8d0f6cc001de09d8d3f96d8ad7e243e07f426d
2015-11-17Work around loplguins:badstaticsStephan Bergmann
Change-Id: I243dcb86cc1a99550b26962daf47c19eb62aa8df