File: disable-some-tests-on-32bit-platforms

package info (click to toggle)
cppcheck 2.10-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 22,128 kB
  • sloc: cpp: 227,006; python: 12,193; ansic: 7,078; xml: 958; sh: 865; makefile: 709; cs: 291
file content (83 lines) | stat: -rw-r--r-- 2,683 bytes parent folder | download
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
Description: Disable tests not working on 32bit platforms.
Author: Joachim Reichel <reichel@debian.org>
Bug: https://trac.cppcheck.net/ticket/10282, https://trac.cppcheck.net/ticket/10417

Index: cppcheck/test/test64bit.cpp
===================================================================
--- cppcheck.orig/test/test64bit.cpp
+++ cppcheck/test/test64bit.cpp
@@ -79,6 +79,7 @@ private:
     }
 
     void functionpar() {
+#if __SIZEOF_POINTER__ >= 8
         check("int foo(int *p)\n"
               "{\n"
               "    int a = p;\n"
@@ -106,6 +107,7 @@ private:
               "    *p = 0;\n"
               "}");
         ASSERT_EQUALS("[test.cpp:3]: (portability) Assigning an integer to a pointer is not portable.\n", errout.str());
+#endif
 
         check("int f(const char *p) {\n" // #4659
               "    return 6 + p[2] * 256;\n"
@@ -160,6 +162,7 @@ private:
     }
 
     void structmember() {
+#if __SIZEOF_POINTER__ >= 8
         check("struct Foo { int *p; };\n"
               "void f(struct Foo *foo) {\n"
               "    int i = foo->p;\n"
@@ -175,6 +178,7 @@ private:
               "    s.e = S::E::e1;\n"
               "}\n");
         ASSERT_EQUALS("", errout.str());
+#endif
     }
 
     void ptrcompare() {
@@ -199,11 +203,13 @@ private:
               "}");
         ASSERT_EQUALS("", errout.str());
 
+#if __SIZEOF_POINTER__ >= 8
         check("void foo(int *p) {\n"
               "    int x = 10;\n"
               "    int *a = x * x;\n"
               "}");
         ASSERT_EQUALS("[test.cpp:3]: (portability) Assigning an integer to a pointer is not portable.\n", errout.str());
+#endif
 
         check("void foo(int *start, int *end) {\n"
               "    int len;\n"
@@ -213,10 +219,12 @@ private:
     }
 
     void returnIssues() {
+#if __SIZEOF_POINTER__ >= 8
         check("void* foo(int i) {\n"
               "    return i;\n"
               "}");
         ASSERT_EQUALS("[test.cpp:2]: (portability) Returning an integer in a function with pointer return type is not portable.\n", errout.str());
+#endif
 
         check("void* foo(int* i) {\n"
               "    return i;\n"
@@ -240,6 +248,7 @@ private:
               "}");
         ASSERT_EQUALS("", errout.str());
 
+#if __SIZEOF_POINTER__ >= 8
         check("int foo(char* c) {\n"
               "    return c;\n"
               "}");
@@ -249,6 +258,7 @@ private:
               "    return 1+c;\n"
               "}");
         ASSERT_EQUALS("[test.cpp:2]: (portability) Returning an address value in a function with integer return type is not portable.\n", errout.str());
+#endif
 
         check("std::string foo(char* c) {\n"
               "    return c;\n"