summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gentoo.org>2018-09-18 16:00:00 -0700
committerMatt Turner <mattst88@gentoo.org>2018-09-18 16:04:07 -0700
commit9322294404f2c5011564047a1534c4c049a7ccfa (patch)
treed75640c3d6cfd33cf6a6e7c79ec6801e90412724 /dev-util/cppcheck/files
parentdev-libs/tinyxml2-6.2.0: added ~ppc64, bug 664468 (diff)
downloadgentoo-9322294404f2c5011564047a1534c4c049a7ccfa.tar.gz
gentoo-9322294404f2c5011564047a1534c4c049a7ccfa.tar.bz2
gentoo-9322294404f2c5011564047a1534c4c049a7ccfa.zip
dev-util/cppcheck: Add upstream patch to fix test
On some platforms 'char' is unsigned by default, causing the test to fail. See https://trofi.github.io/posts/203-signed-char-or-unsigned-char.html
Diffstat (limited to 'dev-util/cppcheck/files')
-rw-r--r--dev-util/cppcheck/files/cppcheck-1.84-char-signedness.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/dev-util/cppcheck/files/cppcheck-1.84-char-signedness.patch b/dev-util/cppcheck/files/cppcheck-1.84-char-signedness.patch
new file mode 100644
index 000000000000..ee1b136c9a9a
--- /dev/null
+++ b/dev-util/cppcheck/files/cppcheck-1.84-char-signedness.patch
@@ -0,0 +1,88 @@
+From 320a957bbc912325363cf86b61108db860195ec3 Mon Sep 17 00:00:00 2001
+From: Alexander Mai <amai@users.sf.net>
+Date: Thu, 28 Jun 2018 22:16:18 +0200
+Subject: [PATCH] Extend TestSymbolDatabase::findFunction19 to outline
+ different results depending whether char is signed or unsigned on compile
+ time
+
+---
+ test/testsymboldatabase.cpp | 28 ++++++++++++++++++++--------
+ 1 file changed, 20 insertions(+), 8 deletions(-)
+
+diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp
+index 0dafd2730..28473e8e9 100644
+--- a/test/testsymboldatabase.cpp
++++ b/test/testsymboldatabase.cpp
+@@ -26,6 +26,7 @@
+ #include "tokenlist.h"
+ #include "utils.h"
+
++#include <climits>
+ #include <cstddef>
+ #include <list>
+ #include <map>
+@@ -5065,6 +5066,7 @@ private:
+ " long get(long x) { return x; }\n"
+ " long long get(long long x) { return x; }\n"
+ " unsigned char get(unsigned char x) { return x; }\n"
++ " signed char get(signed char x) { return x; }\n"
+ " unsigned short get(unsigned short x) { return x; }\n"
+ " unsigned int get(unsigned int x) { return x; }\n"
+ " unsigned long get(unsigned long x) { return x; }\n"
+@@ -5079,12 +5081,13 @@ private:
+ " long v5 = 1; v5 = get(get(v5));\n"
+ " long long v6 = 1; v6 = get(get(v6));\n"
+ " unsigned char v7 = '1'; v7 = get(get(v7));\n"
+- " unsigned short v8 = 1; v8 = get(get(v8));\n"
+- " unsigned int v9 = 1; v9 = get(get(v9));\n"
+- " unsigned long v10 = 1; v10 = get(get(v10));\n"
+- " unsigned long long v11 = 1; v11 = get(get(v11));\n"
+- " E1 v12 = e1; v12 = get(get(v12));\n"
+- " E2 v13 = E2::e2; v13 = get(get(v13));\n"
++ " signed char v8 = '1'; v8 = get(get(v8));\n"
++ " unsigned short v9 = 1; v9 = get(get(v9));\n"
++ " unsigned int v10 = 1; v10 = get(get(v10));\n"
++ " unsigned long v11 = 1; v11 = get(get(v11));\n"
++ " unsigned long long v12 = 1; v12 = get(get(v12));\n"
++ " E1 v13 = e1; v13 = get(get(v13));\n"
++ " E2 v14 = E2::e2; v14 = get(get(v14));\n"
+ " }\n"
+ "};");
+
+@@ -5094,7 +5097,10 @@ private:
+ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 4);
+
+ f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v2 ) ) ;");
+- ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 5);
++ if (std::numeric_limits<char>::is_signed)
++ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 5);
++ else
++ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 10);
+
+ f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v3 ) ) ;");
+ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 6);
+@@ -5112,7 +5118,10 @@ private:
+ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 10);
+
+ f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v8 ) ) ;");
+- ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 11);
++ if (std::numeric_limits<char>::is_signed)
++ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 5);
++ else
++ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 10);
+
+ f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v9 ) ) ;");
+ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 12);
+@@ -5128,6 +5137,9 @@ private:
+
+ f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v13 ) ) ;");
+ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 16);
++
++ f = Token::findsimplematch(tokenizer.tokens(), "get ( get ( v14 ) ) ;");
++ ASSERT_EQUALS(true, db && f && f->function() && f->function()->tokenDef->linenr() == 17);
+ }
+
+ void findFunction20() { // # 8280
+--
+2.16.4
+