Commit Graph

675 Commits

Author SHA1 Message Date
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
Andrea Gelmini
b0388ef109 Fix typo in code
Change-Id: Ib1daf257018d5a5da90773dd39086f18666fea9f
Reviewed-on: https://gerrit.libreoffice.org/24533
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
2016-05-01 09:46:58 +00:00
Noel Grandin
8762aa986d clang-tidy modernize-loop-convert in b*
Change-Id: I8ac6eb59e213eafa78e3dc4578738b53e8adef5b
2016-04-21 10:27:17 +02:00
Julien Nabet
2f3dcc44ce tdf#99357: Basic, return if .with pNode null
Program received signal SIGSEGV, Segmentation fault.
0x00002aaaaed9741e in SbiExprNode::GetVar (this=0x0) at /home/julien/lo/libreoffice/basic/source/comp/exprnode.cxx:118
118	    if( eNodeType == SbxVARVAL )
(gdb) bt
0  0x00002aaaaed9741e in SbiExprNode::GetVar (this=0x0) at /home/julien/lo/libreoffice/basic/source/comp/exprnode.cxx:118
1  0x00002aaaaed9afd6 in SbiParser::With (this=0x50eac70) at /home/julien/lo/libreoffice/basic/source/comp/loops.cxx:266
2  0x00002aaaaed9d1a7 in SbiParser::Parse (this=0x50eac70) at /home/julien/lo/libreoffice/basic/source/comp/parser.cxx:437

Change-Id: If0ecacd007a14e2ba81181da0fe472ea667c4cb7
Reviewed-on: https://gerrit.libreoffice.org/24147
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2016-04-17 13:47:07 +00: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
Caolán McNamara
a139320da2 deref of null
regression from

commit f17a4694b0
Author: Arnaud Versini <arnaud.versini@gmail.com>
Date:   Sat Feb 13 20:17:41 2016 +0100

    BASIC : use std::unique_ptr for storing SbiExprList

    Change-Id: I37f2a1c837c6742cf6d403962d2730b5e80004ec
    Reviewed-on: https://gerrit.libreoffice.org/22345

because they have been moved into the container at this
point

Change-Id: If21e0321ffdce66aa9629637d0ff8c16efbbd25e
2016-03-09 15:16:07 +00: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
Norbert Thiebaud
42f9b97dfb WaE vs2015 truncation of literal on static_cast
Change-Id: I63a89c50c653145ea49aa34e4e4dd554da66598f
Reviewed-on: https://gerrit.libreoffice.org/22597
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
2016-02-22 02:39:34 +00: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
Arnaud Versini
f17a4694b0 BASIC : use std::unique_ptr for storing SbiExprList
Change-Id: I37f2a1c837c6742cf6d403962d2730b5e80004ec
Reviewed-on: https://gerrit.libreoffice.org/22345
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-17 07:08:59 +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
Noel Grandin
b14224fe97 loplugin:unusedmethods
using an idea from dtardon:

<dtardon> noelgrandin, hi. could you try to run the unusedmethods clang
plugin with "make build-nocheck"? that would catch functions that are
only used in tests. e.g., i just removed the whole o3tl::range class,
which has not been used in many years, but htere was a test for it...
<noelgrandin> dtardon, interesting idea! Sure, I can do that.

Change-Id: I5653953a426a2186a1e43017212d87ffce520387
Reviewed-on: https://gerrit.libreoffice.org/22041
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-08 06:08:14 +00:00
Arnaud Versini
c474e610e4 BASIC : Use vector in SbiExprList to avoid any dependencies
Change-Id: I1ae88ae9c4276452a00aadaaadebf582e639b15a
Reviewed-on: https://gerrit.libreoffice.org/22174
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
2016-02-08 06:06:40 +00:00
Arnaud Versini
4cac0c05c6 BASIC: SbiExpression::IsIntConstant has side effects.
Also renames IsIntConstant to ConvertToIntConstIfPossible.

Change-Id: Ib4b465ac0d890762547fb2d83c26ad6be6ee75e8
Reviewed-on: https://gerrit.libreoffice.org/21746
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
2016-01-27 15:36:52 +00:00
Arnaud Versini
7d0e520e22 BASIC : Remove class SbiDimList and SbiParameters
Change-Id: I039bdc786a65ad534390e7138f584cdb470428af
Reviewed-on: https://gerrit.libreoffice.org/21734
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2016-01-24 17:43:15 +00:00
Arnaud Versini
49b5eed56c BASIC : Remove SbiExprList::pParser
Change-Id: Ib9386d97ddb12f148cf76dc71aa8c41003286f50
Reviewed-on: https://gerrit.libreoffice.org/21534
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-01-24 06:48:45 +00:00
Noel Grandin
bc80f951c1 loplugin:unusedmethods unused return value in basic
Change-Id: I0ccbf994d2c9be35f43fc3c62e60da90634bacdf
2016-01-11 10:49:24 +02:00
Arnaud Versini
5e0d36adc3 BASIC : use std::vector instead of SbArray for Modules.
Change-Id: I9594efb13b3dccc637ccd61eea4b42255c2a775c
Reviewed-on: https://gerrit.libreoffice.org/20817
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
2016-01-07 12:18:40 +00:00
Andrea Gelmini
92e60e1b80 Fix typos
Change-Id: I1b79005d9c4e32325b8dadcc4f805975d6bf2727
Reviewed-on: https://gerrit.libreoffice.org/21103
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2016-01-05 07:32:28 +00:00
Julien Nabet
ec3e174569 Remove some includes (stdio/stdlib)
Change-Id: I4aa649961efac521e72c363efb5d0a3192125da5
Reviewed-on: https://gerrit.libreoffice.org/20966
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2015-12-27 17:24:11 +00:00
Arnaud Versini
4251e676bb BASIC : Refactor FoldConstants for extracting it from SwExprNode.
Change-Id: Ia47597b26d63db216dd3ab71acbb18449ece7b1a
Reviewed-on: https://gerrit.libreoffice.org/16963
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
Tested-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2015-12-22 11:13:03 +00:00
Julien Nabet
36984c75cc cppcheck: false positive deallocuse
Help cppcheck by returning early and remove a now useless bool var

Change-Id: If4dcb6f64bcfd6c3cb22136163caf3679d6fd5a8
2015-12-20 22:17:36 +01:00
Damjan Jovanovic
a22702ab0d Resolves: #i126272# compile error : if statement followed by End If...
- in next Line ???

Allow the Else in a single-line If statement to be terminated by a comment instead of only EOL.

Patch by: me

(cherry picked from commit cbd43d0cb1165add5b9b559c3608a93ea631da13)

Change-Id: I3dcf014c9fe501bc9770ae3cfd69e7730c0b86cb
2015-12-16 09:18:23 +00:00
Arnaud Versini
4df183e2c9 BASIC: use c++ foreach loops when possible.
Change-Id: Ia1c734e26da88010eef40a4375c423b0765f43ae
Reviewed-on: https://gerrit.libreoffice.org/20423
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Arnaud Versini <arnaud.versini@libreoffice.org>
2015-12-13 15:57:42 +00:00
Stephan Bergmann
c4c059beb3 DBG_TRACE_BASIC/PROFILING had been rotting for quite some time now
...e.g., it still used the long-gone tools String class

Change-Id: I9d1930c72fbae3208a0f3da14c6991f30d89a9bc
2015-12-10 08:18:15 +01:00
Damjan Jovanovic
d5443023ef #i117960# Basic: Line Input doesn't work in single-line If
i92642 added the ability to use certain keywords as variable names (eg. name = 1, line = "hi"),
but also caused a regression where "Line Input" is broken in single-line If statements.
This patch fixes that by allowing Then and Else to also be the start-of-line tokens expected to
immediately preceed the "Line" token in order for that "Line" token to be recognized a keyword instead
of a variable name. Also added FVT spreadsheet tests for "Line" as both a variable name and as "Line Input".

Patch by: me

(cherry picked from commit f8a51d0f5a645704bc2bdc939474ac931d55559c)
2015-11-25 20:46:26 +00:00
Stephan Bergmann
08e49fa337 loplugin:nullptr (automatic rewrite)
Change-Id: I1ec9a671fe3ac838feb36297915e3cdf8749d944
2015-11-10 10:31:17 +01:00
Stephan Bergmann
a80bab7058 loplugin:stringconstant: elide explicit ctor usage (automatic rewrite)
Change-Id: I9979100550a86ac3f42d74a5403fb3ffd9d5006b
2015-11-06 09:34:39 +01:00
Benjamin Ni
be729e7721 tdf#94269: Replace "n" prefix for bool variables with "b"
Change-Id: I178545792c7354a362658ac7ef8b1d4cf0865797
Signed-off-by: Michael Stahl <mstahl@redhat.com>
2015-11-02 23:40:57 +01:00
Michael Stahl
51eb04a158 basic: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I98c4ac860fbdb55a61f9be0e9d2d5f29fb849e05
2015-10-26 16:09:20 +01:00
Stephan Bergmann
b36963c0a6 Replace "SAL_OVERRIDE" with "override" in LIBO_INTERNAL_ONLY code
Change-Id: I2ea407acd763ef2d7dae2d3b8f32525523ac8274
2015-10-12 17:52:29 +02:00
Stephan Bergmann
4d00131b67 Reduce variable scope
Change-Id: I87850db982f413b328976e043d8386b7577ba17c
2015-10-07 11:32:42 +02: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
Stephan Bergmann
5e02785ff1 clang-analyzer-deadcode.DeadStores
Change-Id: Ib26cbbc839040c49288606f588cb7400d7e40b83
2015-10-06 15:31:15 +02: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
Andrea Gelmini
2957be02c5 Fix typos
Change-Id: I776c517ba87838c0c3391f79010a30fa7fe2abd3
Reviewed-on: https://gerrit.libreoffice.org/18939
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2015-10-02 08:54:51 +00:00
Noel Grandin
58aea3f36c loplugin:unusedmethods
- improvements to the plugin to find more method calls
- improvements to python script to remove more false+
- fix the FORCE_COMPILE_ALL build flag to include code in
  the $WORKDIR

Change-Id: I4d6015dcb9b9d60c26f0bcee8abad807177a7836
Reviewed-on: https://gerrit.libreoffice.org/19064
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-01 10:43:24 +00:00
Andrea Gelmini
9e4c87be31 Fix typos
Change-Id: Ie0e941d48457d758525353d6c5cf858652f86fd3
Reviewed-on: https://gerrit.libreoffice.org/18938
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2015-09-30 05:53:57 +00:00
Oliver Specht
d3c7c9ea81 tdf#94559: first step to remove rtti.hxx
replaced use of PTR_CAST, IS_TYPE, ISA in
avmedia, basctl, basic, cui, dbaccess, vcl,xmloff

Change-Id: If4496762e82e896b6fbc362e6626502703c245f5
Reviewed-on: https://gerrit.libreoffice.org/18905
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
2015-09-29 12:26:20 +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
Caolán McNamara
3a00aaef2a boost->std
Change-Id: Ie490bf2c6921f393bdeed96b1a8815996b701bf0
Reviewed-on: https://gerrit.libreoffice.org/18670
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2015-09-18 07:59:14 +00:00
Stephan Bergmann
1f6b082388 Fix previous commit
...4b4a7c0d87eb580272aba0777c9021789025bdc0 "Revert a fix that can never have
worked in the first place?"---which presumably did work after all, as Noel
thankfully pointed out to me,
<http://lists.freedesktop.org/archives/libreoffice/2015-September/070193.html>
"Re: [Libreoffice-commits] core.git: basic/source 'Revert a fix that can never
have worked in the first place?'"

Change-Id: I411bfaacbfebf50589290c6a3040d0300c256439
2015-09-09 10:54:03 +02:00
Stephan Bergmann
4b4a7c0d87 Revert a fix that can never have worked in the first place?
clang-analyzer-deadcode.DeadStores finds that conditionally assigning

  eTok = SYMBOL

inside the "if( SbiTokenizer::IsKws( eTok ) )" block is useless, as the directly
following

  if( DoParametersFollow( pParser, eCurExpr, eTok = eNextTok ) )

will unconditionally assign into eTok again, without intermediate use of the old
eTok value.

Now, the conditional "eTok = SYMBOL" assignment was added as
5d98ed5c6a "INTEGRATION: CWS ab12fixes: #118234#
SbiExpression::Term(): Allow Input as symbol for action option compatible,"
while the unconditional "eTok = eNextTok" assignment had followed that block
ever since c25ec0608a "initial import."

The referenced "#118234#" was a Sun-internal bug and is no longer available, but
it does very much look as if this alleged bugfix never worked in the first
place.  So revert the code back to what it looked before
5d98ed5c6a, for now.

Change-Id: I1fe1178d2c5b0c0372da32b8dd0f2dfbdb22a1ae
2015-09-08 10:57:54 +02: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
4f87e9da41 loplugin: defaultparams
Change-Id: I29ef505ee77965df33677f8051ec39398ef0c74e
2015-08-11 09:48:17 +02:00