summaryrefslogtreecommitdiff
path: root/scripts/scan-build.sh
blob: 3e8e1a25f7ffe2e7df6c45085825167a150ac48d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash

# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

# Run this script in the toplevel directory of a LibreOffice checkout.

scan()
{
    srcmodule="$1"
    srcdir="$2"
    srcfiles="$3"

    set -ex
    rm -rf scan-build
    mkdir scan-build
    (cd $srcmodule && touch $srcdir/$srcfiles)
    scan-build --use-cc=clang --use-c++=clang++ -o $(pwd)/scan-build make $srcmodule
}

parallelism=$(make -s cmd cmd='echo $(PARALLELISM)'|tail -n 1)

case "$1" in
    sw_docxexport)
        # Writer DOCX export
        scan sw source/filter/ww8 'docx*'
    ;;
    sw_rtfimport)
        # Writer RTF import
        scan writerfilter source/rtftok '*'
    ;;
    sw_rtfpaste)
        # Writer RTF paste
        scan sw source/filter/rtf '*'
    ;;
    sw_rtfexport)
        # Writer RTF export
        scan sw source/filter/ww8 'rtf*'
    ;;
    *)
        echo "Unknown code area. The currently supported ones are:"
        echo
        echo "sw_docxexport"
        echo "sw_rtfexport"
        echo "sw_rtfimport"
        echo "sw_rtfpaste"
    ;;
esac

# vi:set shiftwidth=4 expandtab: