File indexing completed on 2024-04-28 05:38:41
0001 #include <QtCore/qmetatype.h> 0002 #include <QtCore/qhash.h> 0003 #include <QtCore/QTextStream> 0004 #include <QtTest/QTest> 0005 0006 0007 const char *cstring = "foo"; 0008 void foo(int) {} 0009 bool someBool() { return true; } 0010 void foo1() 0011 { 0012 bool b; 0013 foo(b); // Warning 0014 foo(someBool()); // Warning 0015 foo('a'); 0016 enum A { Defined = true }; 0017 bool b2; 0018 if (b == b2) return; 0019 if (b) return; 0020 foo((int)b); 0021 } 0022 0023 void foo2(const bool) {} 0024 0025 void test() 0026 { 0027 QHash<QString, bool> hash123; 0028 bool b; 0029 const bool b123 = b; // OK 0030 foo2(b); // OK 0031 hash123.insert("foo", b); // OK 0032 0033 QTextStream stream; 0034 stream << b; 0035 0036 QAtomicInt ref; 0037 ref = b; 0038 } 0039 0040 struct A 0041 { 0042 A() : f(false), f2(false) {} 0043 QAtomicInt f; 0044 unsigned int f2; 0045 void a() 0046 { 0047 bool b; 0048 foo(qint8(b)); 0049 } 0050 }; 0051 0052 void takesBool(bool, A*) {} 0053 void setEnabled(bool) {} 0054 0055 struct B 0056 { 0057 B(bool, A*) 0058 { 0059 } 0060 0061 }; 0062 0063 void testPointerToInt() 0064 { 0065 A *a; 0066 takesBool(a, a); // Warning 0067 setEnabled(a); 0068 B b(a, a); // Warning 0069 bool boo1; 0070 } 0071 0072 void testQStringArgOK() 0073 { 0074 bool b; 0075 QString().arg(b); 0076 } 0077 0078 0079 void testQVERIFY() // Bug 354064 0080 { 0081 A *a; 0082 QVERIFY(a); // OK 0083 QVERIFY2(a, "msg"); // OK 0084 }