Commit Graph

116 Commits

Author SHA1 Message Date
Andreas Heinisch
d6063f416c tdf#131563 - Add vba color constants
Change-Id: I59bcd11b5da1450fced77671c2cf6ed44e299a06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122607
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
2021-09-27 15:31:54 +02:00
Mike Kaganski
d84deb9536 Use std::vector in SbiBuffer
This removes memory management from the class; unifies the types
used throughout the code using it; and simplifies it all greatly.

Also this changes errors handling. Prevoiusly setting errors to
parser didn't handle case when no parser was passed to SbiBuffer
ctor, as BufferTransformer did, and could dereference nullptr.

Change-Id: I068eb1b3e9a616a5744fc8233781c4dd4403c84d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106452
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-11-24 17:11:53 +01:00
Stephan Bergmann
d902e04baf Upcoming improved loplugin:staticanonymous -> redundantstatic: basic
Change-Id: I1046ee1ea28e19afa51b0e20ee573105ced77535
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97522
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-30 19:05:48 +02:00
Stephan Bergmann
da527cd45b Upcoming improved loplugin:elidestringvar: basic
Change-Id: Ie5422ac19289693c44ce81548a74bd727bb0be36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97193
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-26 11:46:49 +02:00
Stephan Bergmann
f4c0c3fef7 Remove no-longer-relevant comments
...left over by 27239ad230 "basic: String ->
OUString",

>                  // Force length 1 and make char 0 afterwards
> -                String aNullCharStr( rtl::OUString(" ") );
> -                aNullCharStr.SetChar( 0, 0 );
> +                OUString aNullCharStr( (sal_Unicode)0);
>                  return aNullCharStr;

and

>      // Force length 1 and make char 0 afterwards
> -    String aNullCharStr( rtl::OUString(" ") );
> -    aNullCharStr.SetChar( 0, 0 );
> +    OUString aNullCharStr((sal_Unicode)0);
>      addStringConst( aPublics, "vbNullChar", aNullCharStr );

Change-Id: Icbf69ff7b92374b690cb5c7f0129c6a494db48f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97031
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-06-24 16:19:19 +02:00
Noel Grandin
7c96fc7c8e fix leak in basic
Change-Id: I9971a824b98193e7d6f926208a4bb9bfe92d5b43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93935
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-11 08:28:14 +02:00
Noel Grandin
8b0a69498b loplugin:flatten in basic
Change-Id: Icb8e3cda312b50c9a9f12f96bec1c746f41c8979
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92483
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-04-19 08:30:49 +02:00
Stephan Bergmann
f853ec317f Extend loplugin:external to warn about classes
...following up on 314f15bff0 "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-11-22 12:57:32 +01:00
Gabor Kelemen
7ddedd2594 tdf#42949 Fix IWYU warnings in basic/
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I325149be2ea7697b5b4a2ce4a662edd2f8be6e50
Reviewed-on: https://gerrit.libreoffice.org/82312
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2019-11-12 09:20:55 +01:00
Noel Grandin
587ac01f97 loplugin:indentation in basctl..bridges
Change-Id: Ie4e27466c4258c6f774a3ebb82ec3a88c28fd753
Reviewed-on: https://gerrit.libreoffice.org/67525
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-02-08 10:01:05 +01:00
Gabor Kelemen
e48e063254 o3tl::make_unique -> std::make_unique in basctl...bridges
Since it is now possible to use C++14, it's time to replace
the temporary solution with the standard one

Change-Id: I9a20a58c68d12656359dcaa060d8ab41f621af32
Reviewed-on: https://gerrit.libreoffice.org/66262
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-16 07:20:49 +01:00
Noel Grandin
819149fb1f loplugin:collapseif in accessibility..cui
Change-Id: I1437b493f3289b4ac97d061bd71973580571e792
Reviewed-on: https://gerrit.libreoffice.org/62933
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-11-06 10:28:47 +01:00
Stephan Bergmann
206b5b2661 New loplugin:external
...warning about (for now only) functions and variables with external linkage
that likely don't need it.

The problems with moving entities into unnamed namespacs and breaking ADL
(as alluded to in comments in compilerplugins/clang/external.cxx) are
illustrated by the fact that while

  struct S1 { int f() { return 0; } };
  int f(S1 s) { return s.f(); }
  namespace N {
    struct S2: S1 { int f() { return 1; } };
    int f(S2 s) { return s.f(); }
  }
  int main() { return f(N::S2()); }

returns 1, both moving just the struct S2 into an nunnamed namespace,

  struct S1 { int f() { return 0; } };
  int f(S1 s) { return s.f(); }
  namespace N {
    namespace { struct S2: S1 { int f() { return 1; } }; }
    int f(S2 s) { return s.f(); }
  }
  int main() { return f(N::S2()); }

as well as moving just the function f overload into an unnamed namespace,

  struct S1 { int f() { return 0; } };
  int f(S1 s) { return s.f(); }
  namespace N {
    struct S2: S1 { int f() { return 1; } };
    namespace { int f(S2 s) { return s.f(); } }
  }
  int main() { return f(N::S2()); }

would each change the program to return 0 instead.

Change-Id: I4d09f7ac5e8f9bcd6e6bde4712608444b642265c
Reviewed-on: https://gerrit.libreoffice.org/60539
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-09-17 09:05:38 +02:00
Stephan Bergmann
6070aaa47d More loplugin:cstylecast: basic
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I20b38196ee1b6a34384dc46d9de1b6e1b44947ae
2018-01-12 20:29:14 +01:00
Andrea Gelmini
d0222ba1fd Fix typos
Change-Id: I3d16dc162e5fa2e08134d848a835eb392e64056e
Reviewed-on: https://gerrit.libreoffice.org/47126
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2017-12-29 09:54:33 +01:00
Mike Kaganski
daf7c3e732 basic: consistently use "" and <> in include directives
Change-Id: I147c0e9b9b1e09af593f54799e45e1348cd40716
Reviewed-on: https://gerrit.libreoffice.org/43298
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2017-10-10 07:43:46 +02:00
Stephan Bergmann
85d71244eb loplugin:oncevar: empty strings: basic
Change-Id: I4edf130e526c4004aa8913e6aafdcd1e2f4ac1ef
2017-07-13 11:47:27 +02:00
Noel Grandin
7b5fac67fd loplugin:unusedfields in accessibility..comphelper
Change-Id: Ifb68d65fc3e48dd80e3ff2b7a4124468fdda1695
Reviewed-on: https://gerrit.libreoffice.org/39137
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-23 09:01:24 +02:00
Noel Grandin
7aee0ea7c5 replace SbxError typedef with ErrCode
part of a larger patch to convert ErrCode to strong_int

Change-Id: Ia56e5d6d8c4217d6f258e2113d20ce737977892f
Reviewed-on: https://gerrit.libreoffice.org/38813
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-15 09:48:11 +02:00
Noel Grandin
3059ede409 drop SbError typedef
in favour of ErrCode.
Part of a larger patch to convert ErrCode to strong_int

Change-Id: Ia846bfc93c58c85c6a6cec79e9d19b9ecbd1c05f
Reviewed-on: https://gerrit.libreoffice.org/38783
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2017-06-15 08:25:22 +02:00
Takeshi Abe
f99c95c80d basic: Fix VBA constant vbNewLine with unit test
... making its value CRLF on Windows and LF on others.

A winding road of regressions passed through it;
first b680e35254,
then 7beeced463.

Change-Id: I9e4da4a17436949b4fea35481b8355b4321cb268
Reviewed-on: https://gerrit.libreoffice.org/37500
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-05-15 04:57:59 +02:00
Jochen Nitschke
959496794c cleanup osl/diagnose.h includes
with command
> git grep -l osl/diagnose.h *.cxx |
  xargs grep -L -w 'OSL_\w*' |
  xargs sed -i '/#include *\(<\|\"\)osl\/diagnose.h\(>\|\"\).*/d'

headers need more work

Change-Id: I906519ebbd47a04703b4fa5943b2f7abea7a97ab
Reviewed-on: https://gerrit.libreoffice.org/37350
Tested-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2017-05-09 15:41:46 +02:00
Stephan Bergmann
f06e696723 loplugin:salunicodeliteral: basic
Change-Id: I479666b439f1d6324f07253d65181983b7c2c3ea
2017-04-28 18:27:01 +02:00
Stephan Bergmann
8c78aa379f Just pass in OUString directly
Change-Id: Id9bd288080fdd5ed4dfaee77b697954ad7bc2458
2017-01-27 17:15:43 +01:00
Noel Grandin
3a705ab405 OSL_TRACE->SAL in avmedia..canvas
Change-Id: Id9077ea29e7028c12f40abfd4c57756c863e3cd9
2016-12-13 08:14:00 +02:00
Andrea Gelmini
8f9af8dd97 Fix typos
Change-Id: Ie44267e7c9f92eb1920f05235826abff761251f1
Reviewed-on: https://gerrit.libreoffice.org/29430
Reviewed-by: jan iversen <jani@documentfoundation.org>
Tested-by: jan iversen <jani@documentfoundation.org>
2016-10-03 13:43:44 +00:00
Noel Grandin
a2b77b4368 loplugin:singlevalfields in basic..idl
Also fix obvious bug in the initialisation of the
connectivity::odbc::OConnection::m_bClosed field.
Probably closes some kind of connection leak there.

Change-Id: I04579cf91bcd6d6c51c697d83971da4142743a82
Reviewed-on: https://gerrit.libreoffice.org/28932
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-09-16 08:30:26 +00:00
Arnaud Versini
f5615df5e8 BASIC: Move SbiParser's destructor to cpp file.
Change-Id: Id920a83693969ab2d93047524a9affa267a231dc
Reviewed-on: https://gerrit.libreoffice.org/27931
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-08-08 06:32:32 +00:00
Noel Grandin
e5e7475feb loplugin:countusersofdefaultparams in basctl..basic
Change-Id: I16fac3317ebf55581cb9aaef676a9759de51d695
Reviewed-on: https://gerrit.libreoffice.org/27793
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-08-04 05:46:22 +00:00
Noel Grandin
f107d45381 Convert SbxClassType to scoped enum
Change-Id: I48afcdd9924d22b52a8db21aa253061e4d38c85b
Reviewed-on: https://gerrit.libreoffice.org/25259
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-23 11:49:32 +00:00
Arnaud Versini
464348e82d BASIC: SbiParser Remove useless static_cast and indent the code correctly.
Change-Id: I8c7a01c3023f998785c8b719f7ae53da57ff3e47
Reviewed-on: https://gerrit.libreoffice.org/23939
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2016-05-07 12:01:23 +00:00
Noel Grandin
f3d9aab841 teach passstuffbyref plugin to check for..
unnecessarily passing primitives by const ref.

Suggested by Tor Lillqvist

Change-Id: I445e220542969ca3e252581e5953fb01cb2b2be6
Reviewed-on: https://gerrit.libreoffice.org/24672
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-05-06 06:48:38 +00:00
Noel Grandin
8762aa986d clang-tidy modernize-loop-convert in b*
Change-Id: I8ac6eb59e213eafa78e3dc4578738b53e8adef5b
2016-04-21 10:27:17 +02:00
Stephan Bergmann
45adae8fd6 Avoid reserved identifiers
Change-Id: Ibba1a36d4f3744fa68f7e9d0076c997e076262cb
2016-04-06 08:31:46 +02:00
Stephan Bergmann
f7a3bdf623 Turn SbiOpcode into scoped enum
Change-Id: I75d808dd3a42e57e7f55bad97e24fef65bb62dc6
2016-04-06 08:31:46 +02:00
Stephan Bergmann
7beeced463 Avoid reserved identifiers
Change-Id: I3fbc7cb107bdab770d5ce9ed3ecddb962d2d4666
2016-04-06 08:31:46 +02:00
Noel Grandin
bd2bf6bd55 loplugin:unuseddefaultparams in basic
Change-Id: I286efdac6af47a859693fccc71b445915f76945c
2016-03-03 08:11:02 +02:00
Noel Grandin
2d0dab5b15 loplugin:commaoperator in basic/
Change-Id: I320a06e50d032a55d8d5e6354959c12327e319ee
2016-02-22 16:55:11 +02:00
Noel Grandin
2087484c65 use consistent #define checks for the Windows platform
stage 2 of replacing usage of various checks for the windows platform
with the compiler-defined '_WIN32' macro

In this stage we focus on replacing usage of the WIN macro

Change-Id: Ie8a4a63198a6de96bd158ecd707dadafb9c8ea84
Reviewed-on: https://gerrit.libreoffice.org/22393
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-17 11:33:57 +00:00
Chris Sherlock
a238b1f8d3 Remove excess newlines
A ridiculously fast way of doing this is:

for i in $(pcregrep -l -M -r --include='.*[hc]xx$' \
  --exclude-dir=workdir --exclude-dir=instdir '^
{3,}' .)
do
    perl -0777 -i -pe 's/^
{3,}/

/gm' $i
done

Change-Id: Iebb93eccbee9e4fc5c4380474ba595858a27ac2c
Reviewed-on: https://gerrit.libreoffice.org/22224
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
2016-02-09 08:18:05 +00:00
Arnaud Versini
6c6cb30bf4 BASIC : Use std::unique_ptr in SbiExpression and SbiExpList
Change-Id: I6f09615d19560673319e103af36c40c94ea77f12
Reviewed-on: https://gerrit.libreoffice.org/22186
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-02-08 20:32:15 +00:00
Stephan Bergmann
08e49fa337 loplugin:nullptr (automatic rewrite)
Change-Id: I1ec9a671fe3ac838feb36297915e3cdf8749d944
2015-11-10 10:31:17 +01:00
Caolán McNamara
31ee230b6e Related: tdf#94814 some cleanup of static_cast following dynamic_cast
to the same type

Change-Id: I197e88acbc30f8e8bb9e7f2d54803971df6062af
2015-10-06 15:10:51 +01:00
Oliver Specht
89d39bc100 tdf#94559: 4th step to remove rtti.hxx
replaced use of PTR_CAST, IS_TYPE, ISA in
    idl, editeng, sc, sd, sw, sfx2, sot, starmath

Change-Id: I4a5bba4fdc4829099618c09b690c83f876a3d653
Reviewed-on: https://gerrit.libreoffice.org/19132
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
2015-10-06 07:29:37 +00:00
Caolán McNamara
365b13e152 pVar != null, so static_cast(pVar) != null
Change-Id: Id22808858b5884b2f87064b389eb411e0712bab4
Reviewed-on: https://gerrit.libreoffice.org/18881
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-09-26 11:49:06 +00:00
Arnaud Versini
d417059dae BASIC : SbiParser::DefXXX Only convert the first letter to uppercase
Change-Id: Iccee4712459653b35b11d8dbe99c45df753307be
Reviewed-on: https://gerrit.libreoffice.org/17859
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <s.mehrbrodt@gmail.com>
2015-09-05 09:22:41 +00:00
Arnaud Versini
7985e5245a BASIC : SbiParser::pBasic is useless
Change-Id: I5aa041f78ea5685b996a6baf1d7bc22d5bd957ab
Reviewed-on: https://gerrit.libreoffice.org/17782
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-08-17 07:20:31 +00:00
Noel Grandin
b1c25a0d8f inline "old" SbERR constants
Change-Id: I3e6665351de97692ae70207e8b623ad008ca8c9a
2015-07-28 08:35:34 +02:00
Noel Grandin
b4ee16da65 com::sun::star->css in basic
Change-Id: I637fd7aedeb97b7dca22521474a54a1d4274f212
Reviewed-on: https://gerrit.libreoffice.org/17206
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-07-20 09:39:36 +00:00
Arnaud Versini
0766db041e BASIC: Don't use SbiStringPool to pass SbiParser.
Change-Id: I15949e604285d804de1554d36acf36e8a407ebd9
Reviewed-on: https://gerrit.libreoffice.org/16137
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2015-06-13 11:53:03 +00:00