File: main.cpp

package info (click to toggle)
clazy 1.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,384 kB
  • sloc: cpp: 24,969; python: 1,429; xml: 448; sh: 237; makefile: 48
file content (84 lines) | stat: -rw-r--r-- 1,189 bytes parent folder | download | duplicates (5)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <QtCore/qmetatype.h>
#include <QtCore/qhash.h>
#include <QtCore/QTextStream>
#include <QtTest/QTest>


const char *cstring = "foo";
void foo(int) {}
bool someBool() { return true; }
void foo1()
{
    bool b;
    foo(b); // Warning
    foo(someBool()); // Warning
    foo('a');
    enum  A { Defined = true };
    bool b2;
    if (b == b2) return;
    if (b) return;
    foo((int)b);
}

void foo2(const bool) {}

void test()
{
    QHash<QString, bool> hash123;
    bool b;
    const bool b123 = b; // OK
    foo2(b); // OK
    hash123.insert("foo", b); // OK

    QTextStream stream;
    stream << b;

    QAtomicInt ref;
    ref = b;
}

struct A
{
    A() : f(false), f2(false) {}
    QAtomicInt f;
    unsigned int f2;
    void a()
    {
        bool b;
        foo(qint8(b));
    }
};

void takesBool(bool, A*) {}
void setEnabled(bool) {}

struct B
{
    B(bool, A*)
    {
    }

};

void testPointerToInt()
{
    A *a;
    takesBool(a, a); // Warning
    setEnabled(a);
    B b(a, a); // Warning
    bool boo1;
}

void testQStringArgOK()
{
    bool b;
    QString().arg(b);
}


void testQVERIFY() // Bug 354064
{
    A *a;
    QVERIFY(a); // OK
    QVERIFY2(a, "msg"); // OK
}